texts: how to get a node field value in a html.tpl.php template file?

texts:
I have a field in a node type called body_styles.

I need to modify html.tpl.php to get the value of body_styles to add it to the classes of the body tag.

I tried with dpm($node->content['body_styles']['#value']); but I get nothing. I think it is because $node is not available in html.tpl.php.

how do I get a node field value in a html.tpl.php template file?

@svetlio: almost done:

The class is correctly added to $variables['classes_array'] but if I inspect the body (see my capture below the code) tag is not there

    function omega_subtheme_2_preprocess_html(&$variables, $hook) {
    if (arg(0) == 'node' && is_numeric(arg(1))) {
        global $language;
        $node = entity_load_unchanged('node', arg(1));

        dpm($node -> field_body_class['und'][0]['value']);

        if (isset($node -> field_body_class['und'][0]['value']) && $node -> field_body_class['und'][0]['value']){
            $variables['classes_array'][] = $node -> field_body_class['und'][0]['value'];
            dpm($variables['classes_array']);
        }
  }


texts: Drupal 7 has lost all "safe" values and summaries

texts:
I suddenly noticed that safe_value and safe_summary are empty now. Regular value is filled with data, but safe values are not. They were working just fine some time ago. I am currently trying hard to find what caused this havoc.

This applies to all nodes and comments. Haven't checked other content types yet.

Thanks!


texts: Upgrading drupal 8 beta3 to beta4 table user__roles not exists

texts:
When I upgrade my drupal site to beta4 release, it says that table user__roles is not exits.

It's look like that new beta version alter table name from users_roles to user__roles. how is possible to apply this change (How is possible to migrate schema of drupal to latest version).

Thanks.


texts: Remove default language from front page url

texts:
I have a drupal 7 site which was originally set up in English. The home page url would display www.mysite.com and other languages with /es /de /it after the url.

After changing the default language to Spanish, my home page url now displays www.mysite.com/es. How can I remove the trailing language from the home page while maintaining all other content like this:

www.mysite.com

www.mysite.com/es/more/content

www.mysite.com/en/more/content

I've tried removing the es from the Path prefix language code but that removes /es from all content which I need to maintain old urls which I migrated.


texts: How can you render fields from an entity reference in node templates? [Drupal 8]

texts:
For context, I'm dealing with two content types: article and team_profile. In article nodes, we have an entity reference field pulling a team_profile node in to serve as the author information.

I would just render the entity with a new display mode, but our design has the photo set directly above the published date and name, next to one another:

In D7 I would dpm($content) and drill down to the node information, double click, and pull out the rest of the reference path. I'm using kint and am able to spit out the entity reference contents to a certain level, {{ kint(content.field_blog_author[0]['#node']) }}. The next level I want to access is values, but trying the following gives me NULL:

content.field_blog_author[0]['#node’][‘values’]
content.field_blog_author[0]['#node’]=>values
content.field_blog_author[0]['#node’]->values

I'd ultimately like to render the title and field_team_image fields from the referenced node (seen here in the kint output). I haven't found information about this is the documentation or by searching. Would someone help me get unstuck?


texts:
I want to theme the user registration form in Drupal 7 by adding new markup, etc. I cannot seem to figure out how to do it.

I've followed a few tutorials which suggested that you could simply invoke hook_theme in template.php, and use a corresponding theme function:

function mytheme_theme(){
  return array(
    'user_register' => array(
      'arguments' => array('form' => NULL),
    ),
  );
}

function mytheme_user_register($form) {
  // print, die, etc
}

But this is not doing anything, regardless of what I do in the theme_user_register() function, or how many times I clear the caches.

Any thoughts about how to do this in D7?


texts:
Is it important to assign CSS injector and JS injector code snippets to specific pages instead of site wide?

If the code is a few lines, is there a REAL performance benefit to assign css and JS to only some pages?

Or does it only matter for very large code?

I'm just wondering if it's over kill to target the specific pages all the time?

An example code snippet combo I'm using is the first word for JS

$('p').each(function() {
var word = $(this).html();
var index = word.indexOf(' ');
if(index == -1) {
    index = word.length;
}
$(this).html('' + word.substring(0, index) +    '' + word.substring(index, word.length));
});

And CSS:

.first-word { font-style:italic; }

So less than 10 lines of code...


texts:
I have a custom registration form with three options(premium, trial and group).
The premium user does not need email verification but other two do. So I need to send verification email pro-grammatically.

I have searched google where I got only options for some modules. But my need is only sending an email with unique URL for verifcation.

Please suggest me the drupal function that helps me achieve this.

Thank you


texts: In Facet API, if I select a item from one category then the count of items in other category will become zero. What can i do for this?

texts:
I'm working with facet API, if I have select a item from one category then the count of items in other category will become zero. What can I do for this ?

this is before i select a item in a category

this is after i select a item in a category(i.e in this picture when i select a item in 'Filter By Location' the count of items in 'Filter by service category' becomes 0


texts: Update webform without losing existing webforms

texts: I'm using webform 7.x-3.20 version and I want to to upgrade it to 7.x-4.x, but I've 7 to 8 existing webforms whenever I update this I'm losing my previous webforms cause of changed table structure. If is there any easiest way to update then please let me know. It'll be appreciated.


texts: How do I ensure the Content-Type header is present?

texts:
I need to set my Content-Type header to "application/json; charset=utf-8" in Services responses.

I have tried drupal_add_http_header() in my callback, in _services_request_postprocess_alter() and in a custom ServicesFormatterInterface:

class ServicesJSON_UTF8Formatter implements ServicesFormatterInterface {
  public function render($data) {
    // json_encode doesn't give valid json with data that isn't an array/object.
    if (is_scalar($data)) {
      $data = array($data);
    }

    drupal_add_http_header('Content-Type', 'application/json; charset=utf-8');

    return json_encode($data, JSON_UNESCAPED_UNICODE);
  }
}

Sometimes the header gets set, and sometimes it comes back just "application/json" without my addition. Where can I set this to make certain my header makes it into the response?


texts: How can I show images upon click in a lightbox using the Full HTML text format?

texts:
I'm using the Lightbox 2 module on Drupal 7.  I have added an image field to my Basic Page content type.  On one particular page, I have uploaded several images into that field, which I then inserted into the body (text format: Full HTML) using the Insert module.

Since the images are small, I want to allow users to click on them to open them in a lightbox on the same page.  I read through the lightbox documentation but it seems like it hasn't really been updated for Drupal 7.

I tried the following:

However, in this case, when I click the image, nothing happens.  When I add some text, however, like this:

click here for the image

The lightbox appears when the text is clicked.  However, I want to show the lightbox when an image is clicked, not when text is clicked.  How can I do this?


texts:
I want to make an Organic group private,to be seen only from members of this group.
All the other will get an "Access denied" or something like that.
For the time being,I can see the Group but not its content.
I would also want NOT to be able to see the existance of the group,if I am not a member of it.
I am working on Drupal 7.
How to do that?
Thanks


texts: How to get value from {{ item.content }}

texts:
I have a node named "reviews" and a custom field named "field_rating".
I created a field template named field--node--field_rating--reviews.html.twig.

I want inside the node to change the color with an if statement.

I try to do something like that:

{% for item in items %}
  {% if item.content > 5 %}

{{ item.content }}

  {% endif %}
{% endfor %}

but it doesn't work.

Any suggestions?

Drupal Version 8.6.1


texts: Altering views exposed form - Adding select list separator causes error

texts:
Problem

I want to break the select list on my exposed form into chunks using select list dividers.

However this breaks my search.

Any attempt to search with values from that select list removes all results and attempts to navigate to the next page display the following error:

"An illegal choice has been detected. Please contact the site administrator"

What is going on?

Set-Up

I have an exposed view form. It has a select list field as one of the filter options.

There are a lot of options in the select list, so I've reordered it (away from alphabetical) to leave the five most popular at the top. This seems a little random so I then altered the form to add in un-selectable dividers. (see top picture)

How to add separator option in Form API 'select' element? (this is for creating forms, I put it into a form alter)

function mymodule_form_alter(&$form, $form_state, $form_id) {
    if ($form_id === 'views_exposed_form') {
      'Most Popular' => array (
          1 => 'China',
          2 => 'Thailand',
          3 => 'Japan',
          4 => 'Spain',
          5 => 'Saudi Arabia',
      ),

      'Countries' => array (
          6 => 'Afghanistan',
          7 => 'Aland Islands',
          8 => 'Albania',
          9 => 'Algeria',
          10 => 'American Samoa',
          ..
       );
    }

Is it somehow appending "Most Popular" or "Countries" onto the select list data value, invalidating the select list and throwing errors?

Allowed values in my select list looks like:

China|China
Thailand|Thailand
Japan|Japan
Saudi Arabia|Saudi Arabia
Spain|Spain
Afghanistan|Afghanistan
Aland Islands|Aland Islands
Albania|Albania

EDIT --

Alfred-Armstrong's answer has fixed the first problem. I now get search results. But the form alter is still breaking my ability to change pages.

This does however depend on what I search for. If I choose a country it works otherwise it breaks on a blank search.

Any more insight would be fantastic.

EDIT--2

Thanks again to Alfred I figured out what the other problem was. I was getting slightly different paths in my views with and without hook_alter_form.

The reason is I have two exposed forms for the same view. This means I have two views with the same path and both have exposed forms. One is on the home page the other on the search page.

The exposed forms have the same $form_id, so I when I alter one using hook_form_alter I alter the other. However I'd altered one exposed form in the views UI and not the other and because they have the same $form_id Drupal tries to pass data between them but can't.


texts:
I'm looking for a bit of code, or module that would insert the following behavior into my user registration flow that exists as a php file.  Use case as follows:

User registers for a free trial
User checks a box that says "Send an email reminder to [WILL AUTOMATICALLY INSERT USER EMAIL].com 3 days before I am charged.

User checks box. The back-end functionality might need to be manual for now. All I want to do is add the box, text, and have it pull the email address token automatically.


texts: How to link to a taxonomy term of a view?

texts:
I would like to add a link in my template to the view page "taxonomy term", for a term of taxonomy to partiluer.

For example, in my taxonomy "thing" I have the term "truc", and I would like the link redirect to the page of the term taxonomy "truc".

I tried {{ 'Name'|t }} but of course it does not work because I do not know where to put the term in question (in example the term "truc").

Do you know how to do it ?


texts: I have created a new content type in Drupal. I would like to customize the add/edit form for the node utilizing hook_form_alter(), but I'm not sure how to implement this hook. How can I implement and change the form with it?


texts: Send Registration Emails To Non-Administrator role / Rules Data Selector By Role

texts:
I'm about to lose it here so hopefully someone here can help me.

I'm working in D8 and I would like to allow users of a certain role (Managers) administrate new site users. There is a permission for that and it works fine, but I can't find a way to send an email to users of the Managers role. It seems that they will only send to the Administrator account (me).

Some people online suggested that I might use Rules to get this to work for me, but this has made things even more confusing. I started down the path with the event being "After saving new user". I click "Add Action" and pick "Send Email". Some screenshots have shown me that in previous versions there might be a "Send Email to Role" option, but that's gone here for some reason.

I'm now at a "Send To" field, which can use the Data Selector. I can't quite use the Data Selector to get to a role. I can choose "user.role" or "user.roles", but then the autocomplete kind of gives up on me. "user.roles" will start giving me numbers after or "entity", but nothing gets me to sending an email to all users with a specific role.

Does anyone know how to get this to work? I'm not married to the Rules module. It just seemed to be the only option because Drupal won't send the default emails to anyone that isn't Account 1.


texts: Theming Print PDF module output when used on non-content page (views)

texts:
I have a View that has an enabled PDF version feature provided by the Print module (http://drupal.org/project/print). Its ok, but I'd like to tweak the output table with theming. According to the module documentation pdf output can be altered using these files:

- To modify the template of printer friendly pages, simply edit the
print.tpl.php or the css/print.css files.

- It is possible to set per-content-type and/or theme-specific templates
  which are searched for in the following order:
   1. print_[format].node-[type].tpl.php in the theme directory
   2. print_[format].node-[type].tpl.php in the module directory
   3. print_[format].tpl.php in the theme directory
   4. print_[format].tpl.php in the module directory
   5. print.node-[type].tpl.php in the theme directory
   6. print.node-[type].tpl.php in the module directory
   7. print.tpl.php in the theme directory
   8. print.tpl.php in the module directory (supplied by the module)

  format is either html, mail or pdf, and type is Drupal's node type (e.g.
  page, story, etc.)

My question is how to do the same when I use this module not on a specific node type but on a view? The views module's theming information table is unaware of the Print module so the possible theming *.tpl.php files are not shown there.

Supposing that the name of my view is foobar, what tpl.php file should I use?

(Views PDF module is not an option for me as it fails on my special characters..)


texts: Set role expiry programmatically in uc_roles_expirations table?

texts:
I am moving a site to drupal. In that site role expire was manually set by admin.

In my drupal site I want this with the use of ubercart recurring subscription.

So how can I set a role expiration date programmatically which will work as we assign a role in features of any product purchase?


texts:
I'm having a bit of difficulty creating a view to show me a user's manager.

The user entity has a User Reference field, called Manager.  This is populated with, well, the user's manager (through an autocomplete widget, if it matters).

I'm trying write a view that will output the user's manager name.

The view I have outputs the field User:Name

The relationship is User:Manager

The contextual filter is giving me a problem.  If I leave this blank, I get the current user, and his manager.  If I set this to just about anything that makes sense (User: UID, for example), there's no output.

Ultimately, a visitor to the site may be viewing a user's profile, with a link to the user's manager's profile.

Edit: I assume I need to use a contextual filter, as this will end up on a user's profile view, as part of a panel.

The field is a "User Reference" - http://drupal.org/project/references

Ideally, I would like to be able to do the reverse as well.  If I look at a manager's profile, it would list his/her subordinates.

Help?

Thanks ..


texts: Dynamic link in nodes to hidden Quick Tabs tab

texts: How can I make an URL that points on the same page Quick Tabs TAB. It will be good if link works without reloading page.


texts: Programmatically populate file field using Entity API

texts:
I need to programmatically generate nodes using some data that I extract from different import files.
For the node creation I use Entity API.
I've written a simple function to which I pass the node data in a structured array and the function imports each field depending on how it's defined:

  function my_module_create_function($item, $node_type, $language) {
    $node = entity_create('node', array ('type' => $node_type));
    $entity = entity_metadata_wrapper('node',  $node);
    $entity->language = 'es';//LANGUAGE_NONE; // Or e.g. 'en' if locale is enabled
    //strings
    foreach ($item as $key=> $field) {
      switch ($field['field_type']) {
        case 'multiple-reference':
          if(is_array($field['value'])){
            $entity->$key = $field['value'];
          }else{
            //some alert log
          }
          break;
        case 'file':
          if (file_exists($field['value']) && isset($field['filename']))
          {
            $file = file_get_contents($field['value']);
            $filename = $field['filename'];
            if(isset($field['folder']) && file_exists($field['folder'])){
              $folder = $field['folder'];
            }else{
              $folder = "public://";
            }
            $file = file_save_data($file, $folder.$filename, FILE_EXISTS_REPLACE);
            $entity->$key= (array)$file;
          }
          else
          {
            // some alert log
          }
          break;
        case 'long-text':
          $entity->$key->set(array(
            'value' =>  $field['value'],
            //'summary' => '',
            'format' => 'full_html',
          ));
          break;
        case 'geolocation':
          $entity->$key->set(array(
            'latitude' => $field['value']['latitude'],
            'longitude' => $field['value']['longitude'],
            //other elements added here (province, postal_code, country [es, en,...],additional, ...)
          ));
          break;
        default:
          $entity->$key= $field['value'];
        break;
      }
    }
    $entity->status = 1; //(1 or 0): published or not
    $entity->promote = 0; //(1 or 0): promoted to front page
    $entity->comment = 0; // 0 = comments disabled, 1 = read only, 2 = read/write
    // Save the entity
    return $entity->save();
  }

This function works great except for the file field type. When I try to import a node with a file it gives me this error:

  PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048
  Column 'my_field_display' cannot be null

the thing is that I have used the same structure:

        $file = file_get_contents("file_path");
        $file = file_save_data($file, $folder.$filename, FILE_EXISTS_REPLACE);
        $entity->$key= (array)$file;

for image fields (or multiple image fields using "[] =" instead of " = ") it works without any problem. Anyone knows if I'm doing anything wrong with this file field?

Any advice would be helpful


texts: How to set Link field value via entity metada wrapper?

texts:
I'm using Link field.

I need to populate link field programmatically. Currently I'm using EMW a lot, so I'm wonder if it possible to set Link field value via EMW.


texts: clientside validation, prevent user to enter same values in two fields before submitting the form

texts:
Im using Drupal7, contributed module: clientside validation
My issue is, I want to prevent user to enter same values in two fields before submitting the form.
Example:
FirstName: Test
Last Name: test
I tried "Reverse" option in Match against a field and Unique values validation options, but not sure how to
configure it properly.
Can you please help on this?


texts: How can I upload and read an unmanaged file?

texts:
On a custom form I have a file field. Having chosen the file and clicked Submit, I'm trying to find how to access and read the uploaded file. I have no need to move or save it, I simply need to open it and use fgetcsv on it.
I've looked at the online examples I can find, but they seem to either deal with managed files or moving and saving unmanaged ones. The Examples module seems to only have a placeholder with regards to the file example.


texts: How do I create a new Group after installing OG?

texts: I downloaded the Organic Groups module for my drupal 7 account. I moved it to my sites/all directory and was able to see it in the Drupal settings where I checked off all of the Organic Groups sections and the Locale. However when I go to Create/Add Content I don't see the option to create a Group. Did I do something wrong? Has anyone else seen this problem before?


texts: Preprocess variables only for certain blocks

texts:
Is it possible preprocess variables only for certain blocks?
I created mytheme_preprocess_block__aggregator(&$vars), but it doesn't work.


texts: DB API: How to add the result of an embedded query and a retrieved value

texts:
More fun with the DB API:  I'm tracking the number of views of instances of a particular node type: I have a table that collects entries of the viewed node's nid and the timestamp of the view (which makes sense for a variety of reasons in the situation).  These nodes, being regular nodes, can also have comments.

I want to retrieve a set of nodes that is ordered by the sum of the number of views and the number of comments on that node.  (Don't ask why... :)  The following code almost works:

$the_tasks = db_select('node', 'n')->range(0, 5);

    $the_tasks->condition('n.type', 'whatever');

    $the_tasks->join('node_comment_statistics', 'ncs', 'n.nid = ncs.nid');

    $count_task_views = "(select count(*) as count from {vr_task_view_log} where tid = n.nid)";
    $the_tasks->addExpression($count_task_views, 'count_task_views');

    $sum_of_views_and_comments = "(count_task_views + ncs.comment_count)";
    $the_tasks->addExpression($sum_of_views_and_comments, 'sum_of_views_and_comments');

    $the_tasks->fields('n', array('nid', 'title'));
    $the_tasks->fields('ncs', array('comment_count'));

    $the_tasks->orderBy('sum_of_views_and_comments', 'desc');

$the_tasks = $the_tasks->execute();
$the_tasks = $the_tasks->fetchAll();

Like I said, it almost works: sum_of_views_and_comments is coming out as just the number of views -- the number of comments (which are getting successfully retrieved and returned as part of the query) aren't getting added in.  I've also tried omitting the "ncs." qualifier from the addition statement, but that has no effect.  Any advice on how to make it work?


texts: How to check if the problem is of clean url when migrating the database from one server to another?

texts:
After uploading the my local db on server my site was not working and what I was getting was white screen of death. After few hours of struggling I found that as the server was not configured for clean url and the in the database the clean url settings was ON that was causing the problem.

Is there any way we can come to know if the problem is of the clean url in such scenario.

Also I can't use the backup and migrate module as the database size was too large.


texts:
I am new to Drupal, so please be fair with me :)

I am trying to create a custom form using FAPI. The code is as follows :

$form['format_document'] = array(
  '#type' => 'radios',
  '#options' => array(
    'yes' => t('Yes'),
    'no' => t('No')
  ),
  '#title' => t('Should we format your document?:'),
  '#required' => TRUE,
  '#default_value' => 'no',

  '#suffix' => 'markup for the help image',

  '#states' => array(
    'visible' => array(
      ':input[name="select_service"]' => array(
        array('value' => '1'),
        array('value' => '2'),
        array('value' => '3'),
      ),
    ),
  ),
);

The #states work fine on the form element visibility; however the #suffix part is always visible. I can create a new form element with the same #states, but I have to do this on large number of elements. Is there something I am missing in the #states?


texts: How can I insert new early steps (tasks) in the installation process?

texts:
I would like to insert a new step (task) in the installation process before the Verify requirements is run. This because the form with options I want in it is part of the requirements verification step.

Unfortunately there seems to be no hook for that. hook_install_tasks is appending new steps at the end, while hook_install_tasks_alter allow me to alter the default core steps.

While I probably could modify the Choose language step, it doesn't feel like an elegant solution as the form I want to add has nothing to do with language.

Is there no such option available?


texts:
I have a main menu with links:
menu1
menu2
menu3
menu4

When entering the menu1 I want to display a secondary menu with links:
sub-menu1
sub-menu2
sub-menu3

and sub-menu1 to be activated as a default.
Every sub-menu has to have a separate page, because in every sub-page the wallpaper will be different.

When entering the sub-menu2, there will be different content, wallpaper, the chosen sub-menu will be activated and also his parent menu, in this case menu1.

How can I do this?


texts: How can I add markup above the table in a custom module?

texts:
I am working on a Drupal 8 custom module which renders pages as shown in the following image.

So far, I am able to build the table and my code is the following.

  public function dexp_layerslider_list() {
    $header = [
        'ID',
        'Name',
        'Action',
    ] ;
    $results = db_select('{dexp_layerslider}', 'd')->fields('d', [
        'id',
        'name',
    ])->execute();
    foreach ($results as $row) {
        $url = Url::fromUserInput("/admin/dexp_layerslider/". $row->id . "/edit");
        $row->name = (Link::fromTextAndUrl($row->name, $url));
        $editslides = Url::fromUserInput('/admin/dexp_layerslider/'.$row->id.'/editslides');
        $editslides_link = (Link::fromTextAndUrl('Edit slides', $editslides))->toString();
        $exportslides = Url::fromUserInput('/admin/dexp_layerslider/'. $row->id . '/export');
        $exportslides_link =  (Link::fromTextAndUrl('Export slides', $exportslides))->toString();
        $deleteslides = Url::fromUserInput('/admin/dexp_layerslider/'. $row->id . '/delete');
        $deleteslides_link =  (Link::fromTextAndUrl('Delete', $deleteslides))->toString();
     $tmp =  [
            '#type' => 'inline_template',
             '#template' => '{{ link1 |raw }}, {{ link2 | raw }}, {{ link3 | raw}}',
                '#context' => [
                         'link1' => $editslides_link->getGeneratedLink(),
                         'link2' => $exportslides_link->getGeneratedLink(),
                            'link3' => $deleteslides_link->getGeneratedLink(),
                            ]
                    ];
        // Row with attributes on the row and some of its cells.
     $rows[] = array(
            'data' => array($row->id,$row->name,$tmp )
                );
        }
     $table = array(
        '#type' => 'table',
        '#header' => $header,
        '#rows' => $rows,
        '#sticky' => FALSE,
        '#empty' => t('No slider created yet.'),
         );
        for($i= 0; $i
            $table['#rows'][$i]['data'][2] = $tmp;
        }
    return $table;
 }

How do I add a "Add slide" and "Export slide" links?


texts: How to create a "wall" with Drupal Commons?

texts:
Does anyone know a way to show a sort of "wall" for any users, under the profile sections, like facebook with drupal commons? I think i'll have to add a block under the bio section right? My goal is that when a user will go to the profile of a trusted contact (friend) he/she can see all it's activities under the bio section.
However, if the user is not marked as trusted contact (friend) the activity will not be published.

I've found this answer but it's a little incomprehensible: https://forums.acquia.com/acquia-products-and-services/drupal-commons/drupal-commons-wall-facebook-wall ...


texts: How do I use translated taxonomy terms in exposed views filters?

texts:
I have a multilingual website with 5 languages.  I want to add exposed filters to the top of my views generated pages. Everthing works fine in English, my source language, but when I create a view for a foreign language and create the exposed filter for taxonomy, I can only choose the English list. I thought this would translate automatically once the page changed languages, but this is not the case.

To see what I am talking about, please click here
http://noboribetsu-spa.jp/ja/泊まる

What module do I need or what do I need to do to get these transalted terms to show up in the exposed filter select list?

thanks


texts:
My client wants to bypass payment options if a custom chooses shipping outside the US. I have figured out some of the parts using rules but I cannot figure out how to 1) skip the payment selection step or 2) hide the other shipping options.

For option 2, would I disable all payment methods in the Admin UI and then, using a series of rules, enable the ones I want based on the shipping method selected?  That seems a little backward but it might work.


texts: Need full Taxonomy URL to be valid else redirect 404

texts:
I have two taxonomy term pages with the following details:

Term id : 1 , url alias : fruits
Term id : 2 , url alias : fruits/apple

When I am typing url http://www.example.com/fruits/apple then content related to term id 2 is getting loaded which is correct

But the problem is when I am typing http://www.example.com/fruits/apple1 which is not a valid url then the content of Term id 1 is getting loaded since it is matching till "fruits". In such scenario I want the site to be getting redirected to a 404 page instead of matching termid of "fruits".

I need the full taxonomy url to be valid or redirect to 404.

I am using views taxonomy term page (Default one which by default remains inactive) where a wild card character is there taxonomy/terms/%.

Please help. I cant find a suitable solution for the same.


texts: Show total amount of results for an exposed filter

texts:
Found this answer, show amount of results for exposed filter and this answer.

However, my issue is that i'm trying find the total number of results after executing an exposed filter.

Views calc looks like it only returns the count of results from a single result not an exposed filter result. Or if i'm wrong please correct me.

Anyways, the question: How do you find the total number of results from an exposed filter?

Desired result:

Complete an exposed result form
return "x number of results found" as a block


texts:
I'm trying to use AngularJS in Drupal 8 template.  My objective is to get the power of drupal as a backend to do content query, and AngularJS as a front end to make a single one page application. I'm implementing AngularJS in drupal module with name drupal_ng. The complete code is in https://github.com/agungsuyono/drupal_ng.  However, I'm wondering whether my implementation is not correct.  Because I didn't see the result as expected; it seemed ng-controller didn't work in the HTML template. The javascript controller that I wrote did not bind to the HTML template.

Here are some of the code of drupal_ng module. I really appreciate for any help.

drupal_ng/drupal_ng.module

    <?php
    /**
     * Implements hook_theme().
     */
    function drupal_ng_theme() {
      return array(
        'drupal_ng_view' => array(
          'template' => 'view',
          'variables' => array('title' => NULL),
        ),
      );
    }

drupal_ng/drupal_ng.libraries.yml

    angularjs:
      version: VERSION
      js:
        'https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js':  {type: external}

    drupal_ng:
      js:
        js/drupal_ng.js: {}
      dependencies:
        - drupal_ng/angularjs

drupal_ng/src/Controller/DrupalNgController.php

    <?php
    namespace Drupal\drupal_ng\Controller;

    use Drupal\Core\Controller\ControllerBase;

    class DrupalNgController extends ControllerBase {

      public function viewDrupalNg() {
        $title = t('Hello!');
        $build['myelement'] = array(
          '#theme' => 'drupal_ng_view',
          '#title' => $title,
        );
        $build['myelement']['#attached']['library'][] = 'drupal_ng/angularjs';
        $build['myelement']['#attached']['library'][] = 'drupal_ng/drupal_ng';
        return $build;
      }
    }

drupal_ng/js/drupal_ng.js

    var myApp = angular.module("myModule", []);

    myApp.controller("myController", function ($scope) {
      $scope.message = "This is AngularJS";
    });

The word "This is AngularJS" should appear in the HTML template below but it didn't.

drupal_ng/templates/view.html.twig

{{  title }}

        {{ message }}

This is the screen shoot of the result in Chrome browser using AngularJS debugger.  From the debugger, it seems that the message "This is AngularJS" is already there, but it didn't appear in the screen.


texts:
I want to show image insida a form I've try it with  tag inside form but it's doesnt render anything heres my code

$form['y']['image_div'] = array(
            '#prefix' => '
',
            '#suffix' => '
',
        );

How do I render an image inside form.inc in drupal ?


texts: How to add data to Drupal.settings without drupal_add_js

texts:
Is there any way to add some variables to Drupal.settings without drupal_add_js (with setting argument).

I'm creating a site that has a custom ctools popup style but I'm not feeling good with drupal_add_js. How can I add this JavaScript snippet to the page using the theme's .info page ? I'm not sure how can I merge my custom variables (literally, they are just static) to Drupal.settings so ctools module can pick them up as it was added via regular drupal_add_js call.

Thank you in advance.


texts: How do I unset a region in template.php AND have it alter the body classes

texts:
In some cases I need to programmatically remove the sidebar_first region in template.php.  So, I'm doing something like:

function template_preprocess_page(&$variables) {
  if(my_condition){
    unset($variables['page']['sidebar_first']);
  }
}

this does, indeed, remove the sidebar, however, it does NOT alter the body classes.  So, I still have a class of

body.two-sidebars

...even though I unset one of them (so the proper class would be body.one-sidebar).

How can I programmatically remove a sidebar AND have it alter the body classes properly?

(please, for various reasons dont suggest creating a new template suggestion and altering the sidebar there.  that won't work in my case.  I am asking specifically how to remove a region programmatically)


texts: how to perform versioning content between users?

texts: I need to create a content type "Project Software". Users can upload source code to their projects as a portfolio editing option. In one project can participate more users. So I need a solution for versioning the project so that it can be shared for online editing code.


texts: How to grant User Points to viewing user when user has viewed content?

texts:
Can anyone provide me with a simple rule that adds 1 user point to a user when this user has viewed an entity of "Article" (for example)?

I have enabled the User Points module and the "Userpoints rules" integration module. But I can't find a way to get this to work.


texts: Views 2 filter: field x = current user's ID

texts:
So I have a view and a filter with field x. I want this field x to be equal to the user ID of the current user.

When adding the filter I'm asked to insert a value, if I insert the value by hand, e.g. 1, the right content is displayed for that user.
However, I wanna automate this system for the rest of the users.

I tried things like %uid in the value box but this doesn't seem to work.

any ideas?

I'm using Drupal 6 and Views 2.


texts: custom node type that save to a custom table

texts:
I’m trying to convert one of my sites into a Drupal site. The site is a travel site and has a lot of data on there, so I’m trying to convert my database tables to custom node types, but my tables are large,  I have about 30 different tables with a total of about 200+ fields.

If I would just convert all the fields to CCK fields I would end up with a database with 400 to 500 tables, I don’t like that, so I’m trying to create custom node types that save to custom tables.

Does anybody know how to do this, and if you know of an example somewhere that would be great

Thanks
Rob


texts: How can I protect development sites with Basic Auth module enabled?

texts:
During development phase a dev site should be protected from being browsable by unauthorized visitors. Usually I use Basic Auth configured in the web server. This way the only information an unauthorized visitor gets is the domain name.

Drupal 8 uses Basic Auth or OAuth for REST (no Cookie method).

If you want to protect dev sites and use REST with Basic Auth you have a problem. Usually, you setup the webserver to use Basic Auth, as said above. But with Basic Auth module enabled Drupal triggers a 403 Access Denied because Drupal tries also to process the Basic Auth header.

Problems:

The header goes also to Drupal, that tries to use it, giving you a 403 because webserver Basic Auth doesn't match with Drupal users.
If you use two Basic Auth headers (one for the webserver or external layer, another for Drupal when consuming the REST services) you have you tweak your REST service consumers to send those two headers. Also, your webserver or external layer should remove the right header and pass header that Drupal should use.

Obvious solutions

(Use always OAuth for REST services) It seems that OAuth uses Authorization header too so not a solution.
Use other method to protect the dev site than Basic Auth.

Any other way to accomplish this?

NOTE: Clients have no static IP and can't use a VPN to connect (this is mainly because customers must be able to check the dev site).


texts: Create a commerce product and add it to cart using Services

texts:
I am using commerce_services module and poster as addon in firefox for my services. I want to create a commerce product and add it to cart using Services. I don't know what are the parameters and url to be provided. Please help...

Here is the poster.


texts: Users that can add other users in drupal 7

texts: Scenario is as follows: admin adds users (coordinators). Coordinators should be able to add another type of users (editors) which can create content. What is the best solution to this scenario? I don't want any of the users assign roles to other users. Coordinator should be able to add only one, defined type of user.


texts:
I'm trying to add the class 'on-load-click' to any btn with the class 'webform-submit'
<div class="form-actions"><button class="webform-submit button-primary btn btn-primary form-submit" type="submit" name="op" value="Submit">Submit</button>

Currently I have this:
function ntc_bootstrap_hook_form_webform_client_form_alter(&$variables) {
  dpm($variables);
  $element = $variables['element'];
  $label = $element['#value'];
  element_set_attributes($element, array('id', 'name', 'value', 'type'));

  $class_intersection = array_intersect($button_classes, $element['#attributes']['class']);

  if ($variables['element']['#type'] == 'submit' && $variables['element']['#value'] == 'Submit' && $variables['element']['class'] == 'webform-submit') {
    $element['#attributes']['class'][] = 'load-on-click';
  }

}

However it isn't working and I don't know why. I was following this Add class to Bootstrap login form button to help me, but I can't work it out. Currently there is an error on the button saying "Uncaught Syntax error: unexpected token ';' ", however I'm unsure if it is related. Any help would be greatly appreciated, thanks.


texts:
I'm attempting to install Drush on a new system OSX 10.10.4.

The process is no longer the simple one it used to be :(

I've complied with the requirement to install via Composer (that was not small feat either), and finally have Drush installed.

However, executing Drush results in the following:

which drush
env: sh\r: No such file or directory

I've seen issues logged similar to this with scripts that had spurious LF/CR. I haven't written any scripts. No idea where this is coming from.

Solutions I've tried include using Composer to uninstall the Drush and install 6. Process appears to work, but results the same when attempting to run Drush.


texts: What are the "Files" that Metatag module allows adding Metadata to?

texts: In Drupal 7, if you go to Configuration > Search and metadata > Metatag > Settings (Tab) the module Metatag allows you to add Metatags to "Files"... What are these files?... As everyone are knows, files are not webpages and I guess there aren't very much good reasons to build themselves as web pages... So why would the module attach them \ associate them with meta tags???


texts: Git showing every changed file not folders

texts:
Git is showing every change in every installed module folder. This makes it unusable because I can't see what I'm committing.

Previously git only showed the module folders. So if i installed Views, it would show me in
git status, untracked files "sites/all/modules/views"

I used git -rm to remove a file, but somehow it managed to completely mess this up and now it shows every single changed file. Here's the bottom part of my latest git status, it's so long most of it is untrackable.

What have I done, how can I change this back to what I had before, because I really need to roll back a commit.

EDIT:

Context for my problem, now having the solution.

Some modules in Drupal have a huge number of files. When you add them to the index, git lists all the files in the folder rather than each individual one.

In the case of some modules, in my case the commerce and jquery_update modules this will probably add more files than your command line shell can display, so you won't be able to see everything.

I got around this by removing the modules from my index with git reset HEAD *filepath*

and then adding them in separate commits.


texts: Entity types created via ECK (Entity Construction Kit) is in code or in DB?

texts:
There is a lot of great articles around creating new entity types like this

also there is module named ECK, I would like know what is the result of this?

And how is efferent from creating entity types via module, in performance and functionality?


texts: How do I correct issue with Imagemagick not resizing images over 1024?

texts: When I resize a very large smartphone image to 1000 x 1000, the resulting size is 160 kb. When I resize the same large image to 1250 x 1250 the resulting size is 1.2 mb. The correct resize should be 250 kb. Any thoughts? I am using Drupal 7.41 and imagemagick module 7.x-1.0


texts:
i have a Drupal 7 site and want to generate a image gallery.

My requirements:

Multi File Upload
one folder per Gallery
only accessible for authenticated user

I tried plup and multiupload_imagefield_widget for multi file upload. This works fine except for the one folder per gallery requirement. All files are stored in the same folder.

Do you have any advices on how to achiev this goal?


texts:
I'm getting an error when using this entity field query, the error says that that the field title cannot be found but I'm only querying the basic node table.

$product_query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'product')->fieldCondition('field_line', 'tid', $selected)->fieldOrderBy('title', 'DESC');


texts: Is there a way to style the main-container without it effecting ALL the site?

texts:
I am using the bootstrap subtheme.

I was wondering if there was a way to style the main-container in relation to a particular node or section of the site, rather than it styling it the same everywhere. The reason I want to do this is because I want to setup multiple small mini-sites with different themes. Sort of like a show-case of what I can do in web-design.

The problem though is I can style the main-container, but it will style it everywhere for every page. Is there a way I can make it target specific only pages?

In this example: I want to style the white space BUT it only be done on my "mech" page. To my current knowledge, if I target .main-container it will style it everywhere on every page, which is what I do not want.


texts: How to load custom menu field when editing?

texts:
I'm extremely new to Drupal so if my question is badly worded I'm sorry. Inside my menu_ui_override.module I have made a made a new field and added a custom submit handler:
function menu_ui_override_form_menu_edit_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  $form['menu_header'] = array(
    '#type' => 'textfield',
    '#title' => t('Menu header'),
    '#weight' => '0',
    '#required' => FALSE,
  );

  $form['actions']['submit']['#submit'][] = 'menu_ui_override_accept_menu_header_submit';
}

function menu_ui_override_accept_menu_header_submit(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
  $values = array(
        'menu_header' => $form_state->getValue('menu_header'),
  );

  $connection = \Drupal::database();

  $connection->update('menu_tree')
  ->fields(array(
    'menu_header' => $values['menu_header'],
  ))
  ->execute();

  drupal_set_message(t('Saved'));
}

This seems to save my new field but now I'm not sure how to load the data entered into that field when I go back to edit the menu after saving it. I'm also not sure where to put the logic for this part. Any help would be greatly appreciated!


texts: Using Rules to create an Entity Reference if two fields in different entities match?

texts:
I'm attempting to use a "registration code" entered during a user's registration to create an entity reference to a node with a corresponding code.

Any help is greatly appreciated.

Specific use case:

"Professor" (users) have "Classes" (nodes) that contain a text-field with a unique 5-digit code (created with Computed Field).

"Students" have a "Registration Code" field on their registration & user profile page (aka a text field on the user entity) for manually entering a 5-digit code that should "assign" them to a "Class" that has the same registration code.

I'm not a programmer, but this might make more sense:

if [Student user's 5-digit registration code] = ["Class" node's 5-digit registration code] then an entity reference is created between [student user] and ["class" node]

I'd like the rule to trigger when a user updates the registration code field.

Essentially, I'm attempting to avoid displaying Entity Reference's autocomplete widget to users.


texts: Change select list argument and rebuild on form state change

texts:
So, I'm trying to filter a select list by one of the other fields on a node.  In this case, we will select a taxonomy term (you can only choose one) and then based on that rerender the select list of an EntityReference field.  I'm aware of how to do this with something like hijacking the #autocomplete method on a form element, but for this use case we need to keep it as a select list.

Currently, I have the view setup and ready to accept an argument by which to filter. I'm not sure how to dynamically pass the argument to the view though.  In my code I have this so far, in a hook_form_alter:

$form_state['field']['field_current_unit']['und']['field']['settings']['handler_settings']['view']['args'][0] = 6;

This is not changing the argument on load like I had hoped.  Beyond that, none of the rebuild options appear to be working for me.  I can only manually set this in the field settings.  Any thoughts?  Sorry if this is too vague.


texts: Workbench Delete or Unpublish Multiple Nodes

texts: I have recently installed work bench, when we view all contents there is no option to select multiple nodes and apply delete or unpublish action on them. I need to edit each node and then delete each node separately. Please suggest any solution.


texts: How to use views contextual filter default argument "Taxonomy term id in url"

texts:
I am following the guide http://www.metachunk.com/blog/adding-related-content-view-drupal-7 to make a related content block.  I have 2 taxonomies that my content is tagged with.  But the contextual filters are not working.

I think it is because the path is node/[nid] and does not contain a taxonomy term id.  How can I fix this so that views can figure out what terms a node is tagged with?  Should I provide the default argument another way?


texts: How to create a rule triggered when saving a node to schedule sending an email at specified date?

texts:
I have a node of content type task which has a field reminder date. When the node is saved or updated, I want to schedule sending an email to list of users on reminder date.

I have used the Rules module for that, like so:

Rules events:

after node is saved
after node is updated

Rules conditions:

node is of type task
data comparison: site current date greater than reminder date

Rules actions:

add a variable
field list of users(it is entity reference field user is the entity)
new. variable members to email
added a loop
to variable members to mail
add action to loop : send mail

The problem encountered is as follows: if I set current date equal to reminder date, then the email is never sent. But when I set a reminder date greater than current date, the mail notification is not sent on the reminder date. I.e. after the current date becomes greater than reminder date, even if the cron is run, the mail is not sent.

I think I need to use Rules Scheduler for that, right? How can I go about it?

I also saw a Using fields for setting evaluation time, which mentions these steps:

  Using flags to load user lists in Rules
  Scheduling a rules component from a triggered rule
  Some words about rescheduling the evaluation if the event date should change
  Using conditions to make fields available in Rules configuration
  Using a date field to set evaluation time
  Adding an offset to the evaluation (-1 day)
  Verifying the configuration by executing the action set manually

How can I implement this?

I also tried the Date Reminder module but it has a limitation that you can send email only if you manually enter the email address or it will send only to drupal user.


texts: how to add one form element into another form?

texts:
I have a webform. And I want to add some fields of user registration form to the webform because I also want to add the facility of registration on webform submission. So I want to add those fields of user registration form which are required to the webform.

Any help?


texts: How to add a CSS attribute to Image generated with image style

texts:
Pretty much all in the title. I would like to add a CSS classes to images generated via a image style theme function, so that the output looks like :

<img class="MYCLASS" alt="" src="site.com/sites/default/files/styles/profile_picture/public/pictures/picture-1-1318455022.jpg" typeof="foaf:Image">

Is there anyway to do so ?


texts: Storage API stream wrappers Traffic Usage

texts:
In my Drupal 7 Project I have configured Storage API stream wrappers in order to save all public and private files over ftp server.

everything works well and files in public and private are copied into ftp server correctly.

Imagine that my base server is domain.com and my ftp server is ftp.com

As you know, public files will be shown with direct link to the source for example

http://ftpdomain.com/public-file.png

and private files are not shown with direct links for example

http://domain.com/system/storage/serve/private-file.rar

Now my question is: when a user try to download private-file.rar via above link, what happens really?
is private file from ftp server being copied to the main server temp folder at first and then download starts?
Or private-file.rar is downloaded directly from ftp server to the client machine despite the URL starts with "http://domain.com/.... "

It is very important for me because of shared server rules in file download limitations , I have to purchase one PHP host for running Drupal script and one download host for placing files folder in order to run a Drupal project commerce file shop.

I want to be sure, download traffic only relate to download server not PHP server.

Thanks a lot for your guidance.


texts: Adding custom button to Add Article form?

texts:
I can't seem to get this to work. In my template.php, I have:

if($form_id == 'article_node_form'){

    global $user;

    if (in_array('administrator', array_values($user->roles))) {
        //print "here" --> this prints out just fine so this is getting hit
        $form['actions']['save_send_review'] = array(
        '#type' => 'submit',
        '#value' => 'Save & Send for Review',
        '#name' => 'op',
        '#submit' => array('myFunction_form_submit'),
        '#weight' => 1000
        );
    }
}

I can't get the button to appear. What I want to do is:

Have the button appear next to the Save/Preview buttons. Then once clicked, I want it to trigger Workflow to change the status from Creation --> Review automatically (without saving it as Draft first).


texts: Blog with subscription option to send emails on new blog entry

texts: I'm working with Drupal 7. How do I setup 'Subscription' option for my blog so that upon every New Entry of the blog, an email is sent out to the subscribers?


texts: Display if and when a particular field exists

texts:
[I have been on D6 for ages, and just shifting to D7.]

In D6, I was using the following in the node.tpl.php:

<?php if (content_format('field_occupation', $field_occupation[0]) != '') : ?>
<?php foreach ($field_occupation as $occupation) { ?>
<strong>Primary occupation: </strong><?php print content_format('field_occupation', $occupation) ?><?php } ?>
<?php endif; ?>

But this doesn't seem to work in D7.

How can I make it work?


texts: How to unpublish a node and any related nodes?

texts:
I am currently working on a problem where, when a Physician node has been unpublished, its related Review nodes will be unpublished as well. They do have an entity reference built in to distinguish which Review belongs to which Physician.

I have been working with the Rules, Views Bulk Operations (VBO), and Workflow modules to get this to work.
I have many failed attempts using the Rules module, so I don't have any code to supply.

Would anyone be able to point me in a direction?


texts: Where is the file selection widget in Drupal code?

texts: If a content type has an image field then when the user creates new content, he is present with an image section on the form with a widget to "Browse" for a file.  Clicking it provides a pop-up window standard dialog box for selecting a file.  I would like to examine how this works to use it in a custom module, but cannot locate the code in the core modules.


texts:
I am new to drupal, now I have function get_node_from_rss() which the file is inside mysite\sites\all\modules\node\node_rss\node_from_rss.module the function will update node from the rss link every 1 hour. Now, I dun know how to make this function add to the cron task. Can I run it without using cron.php? I search in google, they something like simple change the function name like get_node_from_rss_cron(), I also putting some code like:

$interval = variable_get('get_node_from_rss_interval', 60 * 60);
if (time() >= variable_get('get_node_from_rss_next_execution', 0)) {
   watchdog('get_node_from_rss', 'get_node_from_rss ran');
   if (!empty($GLOBALS['wowfi_locamusic_addnode_show_status_message'])) {
     drupal_set_message(t('wowfi_locamusic_addnode executed at %time', array('%time' => date_iso8601(time(0)))));
     drupal_set_message(t('wowfi_locamusic_addnode executed at %time', array('%time' => date_iso8601(time(0)))));
    }
    variable_set('wowfi_locamusic_addnode_next_execution', time() + $interval);
  }

inside my code, but those still not working for me,
Any solution?


texts: Get single edit field from a content type

texts:
I'm writing a module with a custom form. I would to add in this a form a field from an existent content type, with values.

For example: I've a content type "article" wth a node reference field "field_ref".

In my custom form I want to get this "field_ref" field, with values.
Is it possible?

I think that I could get the entire form and then get only the field but I don't like this solution :)


texts: Filter View based on Relationship to Current User

texts:
Similar to this question, I have an elevated user role (Facilitator) that's associated via profile to a location (content type space) and should see a list of pre-authorized users who have matching profile locations that they can authorize or deny. I've built a view using Views Bulk Operations and have a custom action to change the user role, all of which is working, but I can't figure out how to filter the pre-authorized students by their location matched to the location of the currently logged-in user. Do I have to make a custom filter for this?

EDIT:

The data relationship looks like this:

User -> Profile -> Space

A Profile can have multiple associated Spaces. I want the view to only show users whose associated space(s) match one or more of the associated space(s) of the current logged in user.

In general it doesn't have to be locations, it could be interests, or favorite colors, anything. Any matching of nodes/users by associated data values.


texts: Is it safe to use a custom value for users.status column

texts:
Currently status column can have only 2 values:

0 - inactive
1 - active

I need to add a new status for the user: temporarily inactive. Will it be safe if I use status = 2 for it?


texts: Can I create a view that combines multiple images from single node with images from other nodes that entity reference the original node?

texts:
I have a content type called "exhibition" that contains many images added via the standard image field. I also have a separate content type called "video" that uses an entity reference to point to an "exhibition". Each video node has a single image field for a thumbnail.

I want to create a block view that will be displayed on each exhibition's page in a sidebar that combines thumbnails of the exhibition's images with thumbnails of any videos linked to that node. How can I create this sort of combined view?

For example:
node/100 is an exhibition containing: image_1.png,image_2.png,image_3.png

node/200 is a video linked to node/100 containing: videothumb_1.png
node/201 is a video linked to node/100 containing: videothumb_2.png

I want a block to display in the sidebar of node/100 that renders the following:

image_1.png,image_2.png,image_3.png,videothumb_1.png,videothumb_2.png

I am experienced enough with Views that I can create a working block that displays image_1.png,image_2.png,image_3.png. I can also easily create a second block using relationships that correctly displays videothumb_1.png,videothumb_2.png. What I would like to do now is combine these separate block views into a single block. My attempts to combine the two seems to always lead to repeated images from the exhibition paired with repeated images from the videos.


texts: How to create a multisite from an existing Drupal site

texts: I have an existing drupal 7 site that we want to convert into a multi site.  I want the new database to have the same content structure as the existing site.  What would be the steps I have to take?


texts: Automating site install from profile - settings.php

texts:
I'm trying to automate a site deployment/environment generation using profile installation, but I need to change the trusted_host_patterns key in the $settings variable of settings.php.

From what I've read in the API docs, the Settings class is read-only, which means I can't use the profile install hook to change it.

Has anyone experienced or tried to do this? What strategy did you use?

If I wanted to run a PHP script from the command line to do this, what would be the best way?

I'm new to Drupal, but any thoughts and comments are welcome!


texts: Use an entity reference in URL as Views Contextual Filter

texts:
My site allows users to create a "booking request" node related to a "vehicle" node. I use an Entity Reference to connect the two by prepopulating a "Vehicle" field on the "booking request" node via a string in the URL:

http://example.com/vechiclename=&overlay=node/add/booking%3Ffield_vehicle%3D84

I would like to display a views block on this overlaid page with more info from the related vehicle. As you can see, the NID of the vehicle is in the URL (84), but I don't know how to target it.

I'm familiar with grabbing a path component from the URL, but it's the &field_vehicle=84 that is new to me. Any ideas?


texts: How to create a list of paragraphs not linked to a node

texts:
Is there a way to create/edit several paragraphs (from within a UI) and use them grammatically by after.

Here is my use case:

I have a paragraph type made of 3 fields:

Unit Source : taxonomy term reference (Kg, g, piece, box of
tomatoes,...)
Unit target : idem
Conversion factor: floating number

And I would like to encode some data like

Unit source = box of tomatoes
Unit target = kg
Conversion factor = 3

(A box of tomatoes is equal to 3kg of tomatoes)

I would like to be able

1- to encode through a UI a list of those conversion data

2- to be able to call them in some other function by after.


texts: Managing display of articles promoted to front page

texts:
How do we manage the way that blog items that are promoted to the front page are displayed?
Currently using Bootstrap theme, we promote some of our articles, these are displayed in a scroller, but just showing one article at a time.
How would I manage this so that the scroller showed 3 articles?


texts: Update to Search API 1.18 causes HTML to be displayed as plaintext

texts:
A security update to Search API (7.x-1.18) adds new sanitation as a security measure.  Great!  ..Except it now causes my custom field to be displayed as plaintext instead of HTML.

Here is the relevant code that was added to Search API:

/**
 * Sanitizes field values returned from the server.
 *
 * @param array $values
 *   The field values, as returned from the server. See
 *   SearchApiQueryInterface::execute() for documentation on the structure.
 *
 * @return array
 *   An associative array of field IDs mapped to their sanitized values (scalar
 *   or array-valued).
 */
function search_api_get_sanitized_field_values(array $values) {
  // Sanitize the field values returned from the server. Usually we use
  // check_plain(), but this can be overridden by setting the field value to
  // an array with "#value" and "#sanitize_callback" keys.
  foreach ($values as $field_id => $field_value) {
    if (is_array($field_value)
      && isset($field_value['#sanitize_callback'])
      && ($field_value['#sanitize_callback'] === FALSE || is_callable($field_value['#sanitize_callback']))
      && array_key_exists('#value', $field_value)
    ) {
      $sanitize_callback = $field_value['#sanitize_callback'];
      $field_value = $field_value['#value'];
    }
    else {
      $sanitize_callback = 'check_plain';
    }
    if ($sanitize_callback !== FALSE) {
      $field_value = search_api_sanitize_field_value($field_value, $sanitize_callback);
    }
    $values[$field_id] = $field_value;
  }
  return $values;
}

Question

Because it says

  // Sanitize the field values returned from the server. Usually we use
  // check_plain(), but this can be overridden by setting the field value to
  // an array with "#value" and "#sanitize_callback" keys.

I know I need to set the field value to an array with #value (my custom HTML) and #sanitize_callback keys, but where do I set this, and what do I use for #sanitize_callback?

My Custom Code

I'm using a callback to generate my field with custom HTML:

<?php

/**
 * @file
 * Contains SearchApiAlterAddViewedEntity.
 */

/**
 * Search API data alteration callback that adds an URL field for all items.
 */
class MySearchAlterAddUsercacheEn extends SearchApiAbstractAlterCallback {

  /**
   * Only support indexes containing entities.
   *
   * @see SearchApiAlterCallbackInterface::supportsIndex()
   */
  public function supportsIndex(SearchApiIndex $index) {
    return (bool) $index->getEntityType();
  }

  public function alterItems(array &$items) {
    // Prevent session information from being saved while indexing.
    drupal_save_session(FALSE);

    // Force the current user to anonymous to prevent access bypass in search
    // indexes.
    $original_user = $GLOBALS['user'];
    $GLOBALS['user'] = drupal_anonymous_user();

    foreach ($items as &$item) {
      // Since we can't really know what happens in entity_view() and render(),
      // we use try/catch. This will at least prevent some errors, even though
      // it's no protection against fatal errors and the like.
      try {
        $render = user_view($item, 'ensearch', 'en-US');
        $text = render($render);
        if (!$text) {
          $item->search_api_viewed_en = NULL;
          continue;
        }
        $item->search_api_viewed_en = $text;
      }
      catch (Exception $e) {
        $item->search_api_viewed_en = NULL;
      }
    }

    // Restore the user.
    $GLOBALS['user'] = $original_user;
    drupal_save_session(TRUE);
  }

  public function propertyInfo() {
    return array(
      'search_api_viewed_en' => array(
        'label' => t('Entity (en-US) HTML output'),
        'description' => t('The whole HTML content of the entity when viewed.'),
        'type' => 'text',
      ),
    );
  }

}


texts: How do I hide translation vertical tab programmatically?

texts:
I would like to hide the Translation vertical tab. I tried with $form['content_translation']['#access'] = FALSE; but it seems not working.

How do I remove that vertical tab?


texts: How can i add new action for selected users

texts: I would like to add a new action within the With selection field and i don't know how to alter that data, i have tried with hooks but i can't find something that's working. If you ever done something similar can you please tell me the steps i need to make for creating another action?


texts: How to restrict particular user roles from Adding child pages to the particular books only.

texts:
I am using drupal 7. I want to restrict some users from adding book pages to the books.

I have several books on my site and each book has different authors. As i have given add book
pages access to authors any author can add book pages to any book which i dont want.

I just needed to give add book pages access to each author bookwise.
Is there any module available for this i am already using book access for editing the content but i didnt find for adding content restriction.


texts: How to create a new table in drupal without uninstall/installing the custom module

texts: In my requirement i want to create new table without uninstalling and installing the module.. is there any way to do it...?


texts: How to get the nearest place from database

texts: i am using drupal 6 gmap and location module to save the users latitude and longitude in database. I need to create a service in which i am returned the places list in the order of nearest first. I have all the rest of the code ready and would be all set to go if you guys could share the SQL


texts: Use a class on a DIV on specific content with Omega

texts:
I'm using Drupal 7 and my theme is Omega. I have got a class "mask" and its CSS code is like so:

.mask {
    background:url("../img/header_mask.png") repeat-x scroll 0 0 transparent;
    height:200px;
    position:absolute;
    top:0;
    width:100%!important;
    z-index:101
}

I'm creating a class on Omega theme options to show content top, but my div shows on every page. So, I want show this class only on node pages.

This is my node.tpl.php:
<div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>

  <?php print $user_picture; ?>

  <?php print render($title_prefix); ?>
  <?php if (!$page): ?>
    <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?>

  <?php endif; ?>
  <?php print render($title_suffix); ?>

  <?php if ($display_submitted): ?>

      <?php print $submitted; ?>

  <?php endif; ?>

  <div class="content"<?php print $content_attributes; ?>>
    <?php
      // We hide the comments and links now so that we can render them later.
      hide($content['comments']);
      hide($content['links']);
      print render($content);
    ?>

  <?php print render($content['links']); ?>

  <?php print render($content['comments']); ?>

Where should I add my "mask" class in this code?


texts:
The story :
I create lets say a simple module to store input data and sent a mail when you click save.
Now i done the part of store data, send mail and retrieve data, but i would like to add tokens to the mail part.

So for now i have something like this.

 function mymodule_form (){
         $form['name'] = array(
        '#title' => t('Your name'),
        '#type' => 'textfield',
        '#size' => 60,
        '#maxlength' => 100,
        '#description' => t('Input your first and last name.'),

        $form['submit'] = array(
        '#value' => 'Save',
        '#type' => 'submit',
        '#submit' => array('mymodule_submit'),
         );

    return $form;

}

Now you have mymodule_submit that saves the data and sends mail.

function mymodule_submit(){

 here goes the part for saving data into table(not going to write it)....

/*mail send*/
    $text=array();
    $subject=array();
    $mail = db_query("SELECT * FROM {mail_data} WHERE mail_id=2");
    foreach ($mail as $data){
        $text = $data -> text;
        $subject = $data -> subject;
    }

    $params = array(
    'subject' => $subject,
    'body' => $text,
            );
     $to =$emailto; //db_query that selects from table
     $from =$emailfrom; //db_query that selects from table
    drupal_mail('person', 'my_module', $to, language_default(), $params, $from, $send = TRUE);

    /*end mail send */

}

function mymodule_mail($key,&$message,$params)
{

  switch ($key) {
    case "my_module":
        $message['subject'] = $params['subject'];
        $message['body'][] = $params['body'];
      break;

  }
 }

Now I made a form for inserting subject and body of mail hence $mail = db_query("SELECT * FROM {mail_data} WHERE mail_id=2");

My question is how can i allow user to use tokens or something else to add tokens like in drupal account mail settings(like: account activation, account blocked etc...), where you can add tokens to text so that you get :

[user:name],

A site administrator at [site:name] has created an account for you. You may now log in by clicking this link or copying and pasting it to your browser:

[user:one-time-login-url]

So to clarify ... I have a form that user uses to input mail data but for now he can only input text , i want to make it possible for him to use tokens(or something else like drupal_set_message(t('Saved input @var!', array('@var'=>$temp)));) when he inputs data...

Its a form like mymodule_form.


texts: Custom libraries and dependency injection

texts:
I have been using D7 for a while, new to D8; also have a fair amount of experience with Laravel/Lumen and dependancy injection (DI).  One of the big sell's of D8 is the new OO structure, and specifically the Symphony DI system.

So to test this out, I want to develop (port some of my old D7 code) to a D8 custom library, that will 'inject' when needed, and I do not want to do this as a module (I got that right; the objective is to have a PHP library class).

Given some of the documentation I read, I created a folder called /libraries/my_library, and for the hell of it I added a PSR4 mapping to /composer.json like so:

"Drupal\\CustomLib\\": "libraries"

For the record, I tried it without Drupal\\ as well - makes no difference.

In /libraries/my_library/scr/myClass.php I have a single class myClass.  I also added a my_library.services.yml

services:

  myClass:
    class:   CustomLib\mylibrary\myClass

And in my custom theme file I simply tried

use CustomLib\mylibrary;

function quirk_preprocess_html(&$vars) {
  $tools = Drupal::service('myClass');
}

which results in

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service

Can someone point me in the right direction please.  What am I missing.  I am assuming Drupal is not scanning the /libraries/my_library folder for the services definition - but how do I get it to do so?


texts: Do i really need to hack core to install Amazon S3 Module?

texts: I want to run my site through Amazon's Elastic Beanstalk but to do so i need to configure an S3 bucket and the Drupal Amazon S3 module requires that i have to hack core. Surely there must be a way around this? Would Storage API module be a way around this?


texts: Multiple Image Upload and Rename - avoiding multiupload image field

texts:
I'm looking to provide the following functionality on my Drupal site:

I'd like to make an easy to use content type that allows users to upload multiple photos easily. The uploader needs to allow them to dump in files, rename them and upload them. I'm currently using the multiupload image field which I've found to do the job of uploading well but, I don't like the thought of increasing my php upload limit to allow users to upload a whole load of photos at once. I wondered whether there was an uploader that allows users to drop in their photos and, providing an individual photo isn't over the upload limit, will handle the upload of all of the photos?

An added bonus would be the ability to rename photos, once they've been uploaded.

Thanks in advance for your help!


texts: How do I bulk delete all content posted prior a chosen date?

texts:
How can I bulk delete all content posted prior a chosen date? Let's say I want to delete every node posted before/up to year 2012, but keep the ones after 2012.

How can I achieve it in Drupal 6?


texts:
I am trying to update a old custom module written for Drupal 7 for Drupal 8. I have used a lot of view functions like views_include() and views_get_view(). Are they all dropped in Drupal 8?

function validate_email($email) {
    //pass the email to the filter
    views_include('view');
    $name = 'send_otp';
    $display = 'page_1';
    $alter = array('exposed' =>array('field_email_value' => $email));
    $view = views_get_view($name);
    $view->init_display($display);
    $view->preview=TRUE;
    $view->is_cacheable = FALSE;
    if(isset($alter['exposed'])) {
        foreach($alter['exposed'] as $key => $valor) {
            $view->exposed_input[$key] = $valor;
        }
    }
    $view->pre_execute();
    $output = $view->display_handler->preview();
    $view->post_execute();
    //if the result is empty
    if(empty($view->result)) {
        //return 0
        return 0;
    }
    else {
        //return node id
        return $view->result[0]->nid;
    }
}

  Fatal error:  Call to undefined function views_include() in /var/www/html/mdc-conference-backend/sites/all/modules/custom/rest/sendotp.php on line
  43


texts: Bootstrap 3 - parent nav element disabled

texts:
Let's say I have a menu which is structured like this:

-- About (href="/about")
----- Company (href="/about/company")
----- History (href="/about/history")
-- Offer (href="/offer")
-- News (href="/news")
-- Contact (href="/contact")

So the 'Company' and 'History' are children of the 'About' element. Now, Bootstrap automatically creates the dropdown and if I want to visit 'About' and click it, it only opens the dropdown containing the children. So I can't actually visit 'About' from the menu. How can I force the Bootstrap theme to prevent this behavior?

Any idea how to do this?


texts: I want to import user accounts to my Drupal site via the LDAP server. How do I do that? I installed LDAP feeds, but I don't understand how it works. I have LDAP query installed and working.


texts: How to know what is slowing down my drupal site

texts:
My site is still in early stages of development and the page load is getting slower day by day. Even though i really think twice before installing a module for something and try to get it done with jQuery.

Is there a way to know "What Exactly (A module or my theme templates) is slowing down the site ?".

thanks


texts: I can't backup my website on a shared server because memory runs out. What can I do?

texts:
I have a large Drupal7 website on a shared Hostgator server, and I cannot do automated backups because I always run out of resources.

I've tried 2 methods:

1) I first built my own CLI bash file and I set up a cron job to execute it every night. The cron job emails me the output, and it never finishes and it says it ran out of resources. It was to just save the backup to the same machine.

2) I installed the Backup and Migrate module for Drupal and set up an FTP account on a seperate server on a seperate network to send the backup to. When I try it, after a minute it goes to an Error 500 screen. There's an advanced option for choosing to use CLI tools (it says this is better for larger sites) but after several minutes it went to an Error 405: Not Allowed page.

Does anybody have any advice?

Thanks!


texts: How to invoke a custom callback function in Javascript

texts:
I am trying to just invoke callback in my AJAX response.

Currently I have the following response.

   private function responseWithSuccess($message, $status_code = 200)
    {
        $ajax_response = new AjaxResponse();
        $ajax_response->setStatusCode($status_code);
        $response =
            [
                'status' => 'success',
                'message' => $message
            ];

        $ajax_response->setContent(\GuzzleHttp\json_encode($response));
        return $ajax_response;
    }

It returns a response of the specified format, but is it possible to listen for the response text in this case ?

I've found that I have to use the Drupal Command class that is used for communication.

So I created the custom Command, here is code

class CustomCallbackCommand implements CommandInterface, CommandWithAttachedAssetsInterface
{
    use CommandWithAttachedAssetsTrait;
    /**
     * The content for the dialog.
     */
    protected $message;

    /**
     * Constructs a \Drupal\mymodule\Ajax\BootstrapModalCommand object.
     */
    public function __construct($message)
    {
        $this->message = $message;
    }

    /**
     * {@inheritdoc}
     */
    public function render()
    {
        return array(
            'command' => 'onCustomCallback',
            'message' => $this->message,
        );
    }
}

And add it to response like that

private function responseWithSuccess($message, $status_code = 200)
{
    $ajax_response = new AjaxResponse();
    $ajax_response->setStatusCode($status_code);
    $response =
        [
            'status' => 'success',
            'message' => $message
        ];
    $ajax_response->addCommand(new CustomCallbackCommand($response));
    //$ajax_response->setContent(\GuzzleHttp\json_encode($response));
    return $ajax_response;
}

But when I try to send the request, an error appears.

  Fatal error: Call to a member function getLibraries() on null in
  /public_html/core/lib/Drupal/Core/Ajax/AjaxResponse.php on line 48

What is wrong with my code ?

So basically the main question is how to call specific callback when a response comes back.

P.S.

I know that I could just override default handlers of the Drupal JS module, but I am looking for a better way.


texts: Alternative page when node is not translated

texts:
I created a node and translated it in 3 of the 5 languages available on the site, when I'm on the node page and I switch to a language the page is not translated to the node remains in the language I came from, only the url changes from the clean url to node/1234 .

Is there a way to change this behavior and have it redirect to another page, like the home page or just show a 404 page?
I think I saw a checkbox once to alter something like this but i can't find it again.


texts: Selective CSS Aggregation for fast D7 development performance

texts:
On D6, we had the this module. Depite the module's name, it has an hidden extra feature to optimizes all CSS files except for the module or theme being actively developed. This has the benefit of performance (since all files except the actively developed file are compressed) yet allows for quick development.

Which alternative exists for Drupal 7?


texts: How to link to files using a relative path?

texts:
My site is in sites/sandbox folder. When I upload to live server, this will change to sites/mysite

In file system settings, the public file system path is set to sites/sandbox/files. When site goes live, I plan to change this to sites/mysite/files

File module is enabled and I am uploading PDF files. When entering content, how can I link to an uploaded file using a relative path that won't break when the site goes live?

Or perhaps the site directory name ('sandbox') should never be changed?


texts: Possible reasons why status report page is blank

texts:
I'm using Drupal 7.23 on my test site and since a couple of days the status report page is completely blank (no theme, no menu, nothing). No info shown at all. Other (report) pages are shown without noticeable issues.

Does anybody have an idea what could cause this?
I have a almost similar 7.23 life site that shows this /admin/reports/status report perfectly.

Any log-file to check?


texts: How to print correct path to file in .tpl.php?

texts:
<img src="<?php print($base_path . drupal_get_path('theme', 'bartik')); ?>images/some-image.png">

The above code works only if you're in the homepage. If you go to any inner page, it looks for image inside the current URL, not just base URL.

So, it prints the image if you're under www.address.com but if you're under www.address.com/page, it doesn't print the image, because now it's looking for it inside e.g. www.address.com/page/sites/all/themes/bartik/images/some-image.png the problem is, it includes the /page/ part.

In source, the image URL doesn't include the full path (which is the problem I believe?), only the sites/all/themes/bartik/images/some-image.png part.


texts: How do I exclude a single menu item from the sitemap?

texts:
In my sitemap, I am displaying main menu and footer menu, but as per requirement I don't want a specific menu item to display in the sitemap. My footer menu has following items:

industrial
mechanics
sports

Is there a way not to add mechanics to the sitemap?


texts: Bootstrap progress bar missing style option

texts:
Drupal 8 using Bootstrap theme. I am trying to create a progress bar on my form. I have done it in a block with no problem but in the form it loses the "style" option and displays a blank progress bar.

I put in this:

    $form['pr_bar'] = [
        '#markup' => '

            40% Complete (success)

',
    ];

and get a blank bar. When i inspect element:

40% Complete (success)

Why is the style option missing and is this causing the blank bar?


texts: Parent-child node relationship without using taxonomy?

texts:
I'd like to be able to offer sub-site maintainer's the ability to create their own sections of content. I can use a hierarchical taxonomy tree to force multiple levels of content to be classified at different depths of the site. However, I'd rather not be on the hook for revising custom nested term lists for each maintainer.

Is there an easy way to allow publishers to create parent node <-> child node relationships without relying on taxonomy revisions?

I'm using Drupal 7 and Node Hierarchy is unfortunately not yet out of development for D7.


texts: Views Exposed Filter Sort on Entity based on Term Reference Field from Entity Reference Relationship

texts:
I've been playing around with Views exposed filters on an entity. I have so far been able to create a relationship to another entity through an Entity Reference, and exposed the fields belonging to that entity.

What I needed to sort my entity by was a term reference field on the referenced entity (this is a one to many relationship, the sorted entity can have any number of reference entities). I was able to get a multiselect field to do so, but this is really not ideal. Using Better Exposed Filters I was hoping to get a checkbox list. But it seems that the nature of the relationship doesn't open that possibility up.

So the question is, if I needed a View that allowed sorting an entity by an exposed Term Reference Field filter on all of its Entity References, what method would I use, if not Better Exposed Filters?


texts: What module does this site use to handle its great badge system?

texts: Is this a functionality that exists within the existing badge module, or is it anything else?


texts: Drupal 7 page template for right to left languages e.g. page--rtl.tpl.php

texts:
Trying to create a custom page.tpl dependant on language or 'right to left' support, here is what i have so far.

function THEMENAME_preprocess_page(&$variables) {
    if($variables['language']->language == 'ar') {
      $variables['template_file'] = 'page--ar';
    }
}

Am i on the right track?


texts: Displaying a table from local menu (Drupal 7)

texts:
I have added a menu item to one of my nodes and I would like to display a table when the user selects this menu.  Here is my menu implementation:

function arcade_projects_menus_menu() {
  $items  =  array();
  $items['node/%/versions'] = array(
    'title' => 'Versions',
    'description' => 'Configuration for the User Warn Module.',
    'page callback' => 'versions_view',
    'access callback' => 'arcade_versions_access',
    'access arguments' => array(1),
    'type' => MENU_LOCAL_TASK,
  );
  return $items;
}

and here is my page callback:

function versions_view() {
  $block = array();
  $rows = array();
  $header = array('Project Name', 'Screenshot' , 'Updated');
  $format = 'l, F j, Y  - G:i';
  $table = array('rows' => $rows, 'header' => $header, 'empty' => 'No terms found');
  $block['content'] = theme('table', $table);
  return $block;
}

I would expect this code to display an empty table saying 'No terms found' but instead I get a blank white page.  Is it possible to display a table from a page callback?


texts: How to manipulate different regions from a module

texts:
My module has a menu callback which outputs data to a custom template using hook_theme().

Normally, Drupal includes this output into the content region that is rendered at the page.tpl.php level using render($page['content']).

How can I simultaneously output stuff from my module but into other regions of page.tpl.php? For example $page['sidebar_first'] or $page['footer'].

Is this possible?
Alternatively, how can I tell Drupal to use a custom page.tpl.php when the menu callback is called?


texts: unable to get webform submissions into our mail

texts:
I'm unable to get webform submissions data into my default mail,but
  when submitting form i have received mail.getting below Body in my mail

Submitted on

Submitted by user:

Submitted values are:

The results of this submission may be viewed at:

Above name's comming from webform-mail.tpl.php file in webform module

<?php print ($email['html'] ? '
' : '') . t('Submitted on [submission:date:long]'). ($email['html'] ? '
' : ''); ?>

<?php if ($user->uid): ?>
<?php print ($email['html'] ? '
' : '') . t('Submitted by user: [submission:user]') . ($email['html'] ? '
' : ''); ?>
<?php else: ?>
<?php print ($email['html'] ? '
' : '') . t('Submitted by anonymous user: [submission:ip-address]') . ($email['html'] ? '
' : ''); ?>
<?php endif; ?>

<?php print ($email['html'] ? '
' : '') . t('Submitted values are') . ':' . ($email['html'] ? '
' : ''); ?>

[submission:values]

<?php print ($email['html'] ? '
' : '') . t('The results of this submission may be viewed at:') . ($email['html'] ? '
' : '') ?>

<?php print ($email['html'] ? '
' : ''); ?>[submission:url]<?php print ($email['html'] ? '
' : ''); ?>

Please help me I'm new to drupal


texts:
I have a Drupal 7.31 installation.

I have 3 rows in homepage, in which are listed 3 articles for each of them. Here a partial screenshot of Edit View for the first row, in which Sort criteria actually is set to "Publishing Date".

My customer asks me to be able to directly re-arrange the order and I found something about the "DraggableViews" module. I tried to follow two guides (DraggableViews and Custom Sort Drupal Content with the Draggable Views Module) without success.

Reasons are both:

Options and settings that I found in my installation are different from which are listed in tutorials
In both cases, I have to change "Format" in "Table" but doing so results in a wrong display template also in the website, corrupting layout. So I have to remain with "Unformatted List" for output.

It's not important that custom order is made with Drag&Drop, an order specified with dropdowns could be ok, but how to not affect view display, but only order?


texts: How can I use CKEditor for teaser text on a long form text field?

texts:
In Drupal 8, the teaser text for a long form text field (specifically, text of type "long, formatted, with summary") does not have a CKEditor wrapper around it:

How can CKEditor be added to this textarea?


texts:
I am using a Thumbs Up/Down widget of Rate module. Rate module uses the Voting API module to store the vote value. I want to use both Up/Down for vote.

I want to add a sorting filter so It can sort by Up value only. I can write the custom views handler but voting api stores the value like :

entity_id [123], value (1), tag (my_tag)
entity_id [134], value (1), tag (my_tag)
entity_id [123], value (-1), tag (my_tag)
entity_id [123], value (1), tag (my_tag)
entity_id [134], value (1), tag (my_tag)

I want to add a query : Sum of Rows which has value 1 per entity_id.

How can I do this?


texts: Importing external resources via REST as nodes or other entities

texts:
I'm just getting my feet wet with Drupal 8, having written a decent amount of modules for various projects for Drupal 6 and 7. We are trying to leverage Drupal as a CMS add-on to our club management software. A lot of our customers have asked us both how we would integrate into an external system and also how we could provide customer websites. We've decided to try and leverage Drupal 8 to provide a hosted CMS to our customers.

We are developing a REST API for our product that will expose various resources such as Events, Equipment items, Equipment Reservations, etc... What we want to do is have those available in Drupal, preferably as full-fledged entities so that customers could add additional information to these items that is stored with Drupal. For an example, we would provide an Event object via our API and then a customer could add a "photo gallery" field in Drupal to add photos to the event.

We'd also show an events and equipment usage calendars using data from our product, likely as blocks.

What I'm somewhat stuck on is how to define an Entity without storing it in the SQL database. We want our system (via REST) to be the canonical source with addons and UI provided by Drupal.

Can anyone point me in the right direction as to how I could create an entity type with its core storage outside of Drupal and linked via an API?

I should note, I already found the External Entities module, but I don't see how it exposes the external entities as viewable or fieldable objects.  Perhaps I'm just missing something here?

Thanks in advance!


texts: Do I need all drupal core history in my own repository

texts:
I decided to update core via git, mostly by following the approach explained here.

I did this (in my local repo, dev branch):

git remote add core git://drupalcode.org/project/drupal.git
git fetch core
git merge 7.21
(resolved few conflicts)
git commit --amend
drush updatedb

I did this for the sake of making it easy to update core in the future, as proposed:

git fetch core
git merge [new commit hash]

Am I adding too much to my project by fetching all core history, or is this needed? I am interested only in updating core in my existing project.
If so, can I get rid of the core history?
Can I in next core update fetch only by tag?


texts: Altering database tables belonging to core modules

texts:
Using D6's date_api.module module, I noticed that the .install uses db_add_field() to add a "timezone_name" column to the {users} table, and hook_schema_alter() to declare that change.

I was surprised to see a module alter a core module's table, and would have instead expected date_api to create a {date_user_timezone_names} table with "uid" and "timezone_name" fields (and subsequently a hook_user($op='load') to add a timezone_name property to the user object).

The advantages of simply adding a column to another module's table are obvious to me. I'm interested in hearing what the disadvantages are. Are there any gotchas that one should be aware of?


texts: Can you display a variable in a Drupal webform component label?

texts:
I'm trying to create a webform in Drupal 6 where the label of a select webform component is rendered using the contents of a variable.  For example:

client_name = "Starbucks"

and I would like the label of 5 or 5 different webform components to include "Starbucks".  I prefer to code this with a variable, as this webform will be cloned in the future.

Is there a way to do this?  From what I can tell, labels do not accept Drupal tokens and I'm not sure where to define the variable.

any help is appreciated!


texts: drupal 7 remove logon & password for anonymouse users

texts: I have a username and password for my site for development purposes and now want to take the site live and remove the username and password for anonymous users.  How do I do that?


texts: Default menu.html.twig does not print below first level

texts:
Using Drupal 8, trying to integrate a custom theme we statically coded in house, and this is our first foray into Drupal 8.

I copied menu.html.twig verbatim from the core directory into my theme's templates, and no matter what I try, I can't get any links beyond the first level to print. When I try to dump item.below, I get an empty array.

{% import _self as menus %}

{#
  We call a macro which calls itself to render the full tree.
  @see http://twig.sensiolabs.org/doc/tags/macro.html
#}
{{ menus.menu_links(items, attributes, 0) }}

{% macro menu_links(items, attributes, menu_level) %}
  {% import _self as menus %}
  {% if items %}
    {% if menu_level == 0 %}
      <ul{{ attributes }}>
    {% else %}
      <ul>
    {% endif %}
    {% for item in items %}
      <li{{ item.attributes }}>
        {{ link(item.title, item.url) }}
        {% if item.below %}
          {{ menus.menu_links(item.below, attributes, menu_level + 1) }}
        {% endif %}
      </li>
    {% endfor %}
    </ul>
  {% endif %}
{% endmacro %}

To me, this seems like one of the lowest, most basic thing I can do in a Drupal theme, literally print out a menu. What am I missing? What can I check to make sure everything is right? As far as I know, I haven't done anything out of the ordinary.

I checked the block, and it's set to unlimited levels, starting at level 1.


texts: listing page in breadcrumb of single item

texts:
how to make listing page created by views in the breadcrumb of single item of
specific content type like so:

Home >> Activities:   (created by views)
Home >> Activities >> item page: (desired breadcrumb)


texts: How to change the Views exposed filter format from a select box to a slider element?

texts:
I want to change the ways Views presents the exposed filter. Currently it shows as a select box and I'd like it as a slider for a timeline effect. I've looked at the following modules, but they have either not been ported to D8 yet, or don't offer (from playing around with them) what I'm after:

Slide With Style
Contextual Range Filter
Better Exposed Filters

Any suggestions on how I can make this work?