texts: Where are logs created by drush_log() stored?

texts:
I have installed Devel module to use xhprof. In devel settings, I have enabled xhprof, but when I load a page, can't see a link to xhprof. I read the source and found this:

drush_log('xhprof link: ' . devel_xhprof_link($devel_run_id, 'url'), 'notice');

Where is this log stored and how can I see it?


texts:
I made a module for loading a view with Drupal.ajax. This works perfect.

But is there an easy way to load the view on mouseover, and not on click?

This is the code:

<?php

function dynamic_regio_menu() {
  $items = array();

  $items['regio/ajax'] = array(
    'title' => 'Dynamic Regio',
    'page callback' => 'dynamic_regio_get_by_category_id',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK
  );

  return $items;
}

function dynamic_regio_get_by_category_id($cat_id){
  $viewName = 'regio_submenu'; // The name of the view we are going to load

  $args = array($cat_id);  // Array of arguments we set for the view. Only one argument in our example. your actual view may require additional arguments which you may need to set
  $displayId = 'block'; // The display id of for the view.

  // Call the views_embed_view function to returned themed view output
  $html = views_embed_view($viewName, $displayId, $args);

  $commands[] = ajax_command_html('#dynamic_regio-wrapper', $html);

  $page = array('#type' => 'ajax', '#commands' => $commands);
  ajax_deliver($page);

  exit;
}

function dynamic_regio_theme() {
   return array(
      'dynamic_regio_javascript' => array(
         'arguments' => array(),
      ),
   );
}

function dynamic_regio_init() {
  theme('dynamic_regio_javascript');
}

function theme_dynamic_regio_javascript() {
    drupal_add_library('system', 'drupal.ajax');
}


texts: Different responsive image per breakpoint

texts:
I have the following scenario - the main page banner should have at any time 1 of 3 images displayed at a given viewport size. These images are art-directed, that is to say, that will differ in content and layout and are created with desktop, tablet and mobile in mind. (All of this is despite my protests).

I'm wondering what are the options for requesting the correct image at the appropriate viewport size? (Optimisation is very much a concern here! I don't want to serve 3 images only to use 1.) My understanding when it comes to D8 and responsive images is that D8 will create versions of the same image for the srcset rather than giving the option to serve different images at different viewport sizes.

So what are my options here? Perhaps the best option is to have 3 image fields that are outputting directly into a srcset in a banner template.


texts: How to modify a core theme and what is the correct way to do this?

texts:
I modified the core's Bartik theme file, node.tpl.php.  I simply added

echo "Last updated by $name on " . format_date($node->changed);

The problem is that when there is a new core update, my change will be overwritten.  Is there a way to create a module that will easily add this simple line in the node.tpl.php of Bartik's node.tpl.php theme file so that future updates will not overwrite my change?


texts: How to create a taxonomy terms "skills" with level "low", "medium", "high"

texts:
I'm trying to create a field that allows you to add your skill from a select list, and the level of your skill.

i.e.
skill football, level medium.

I may create the taxonomy in this way
Football
-Low
-Medium
-High
and the use hierarchical taxonomy but it means that I need to add the level per each term.

Is there a way to attach a vocabulary to another vocabulary? in this way I may create a vocabulary skills with all the skills and one vocabulary level with 3 terms.
Is there a module or a better technique?

Thanks in advance


texts: Combining Drupal & WordPress on a Multi-Site Project

texts:
This is going to be a tough question to ask without violating the "Questions with too many possible answers or that would require an extremely long answer" rule, but let me give it a try...

I have a variety of websites focusing on a variety of topics, from animals to politics. I'd like to combine them into a single mini-encyclopedia. However, I don't want to delete the existing sites; rather, an article about the aardvark at www.geozoo.org/Life/Aardvark would also appear in the new encyclopedia at www.geobop.com/Aardvark.

At the same time, I'd like to upgrade to a popular CMS, like Drupal or WordPress. (I created my current CMS myself.) Rather than choose between Drupal and WordPress, I'm thinking of using one for the main encyclopedia and the other for the satellite websites. There are two advantages:

Using two different CMS's will help me differentiate the sites, and
a special feature not available on one CMS might be available on the other CMS.

I'll have to find some forum where I can chat about this, but I wondered if someone could give me a short answer - is my idea a good one, is it a lost cause, or is somewhere in between?

One bridge I'll have to cross regards my series of database tables that hold all my content. I assume I'll have to modify them to work with Drupal and WordPress both, and that could be a steep learning curve.

Anyway, I'd just like to know if I'm on the right track or if I'm pursuing a dead end.


texts: How to grant permission to a node for an user programatically?

texts:
I am using ACL module to set user wise permission . Its working fine and I am able to set permission user wise from admin access.

What I need:

I have the nid and uid and I wants to set node view access permission to that user programmatically.


texts: Zen theme not showing second level menu items

texts:
I am creating a zen sub-theme and I edited the menu called "Main menu" to have on root level item that has 5 children (second level). The root level item shows up fine but none of the children are ever output in the HTML.

I verified they are all enabled. Just not sure why they aren't being sent back to the client. Does the Zen theme need some modification to support menus that are deeper than one level?


texts: Entity Reference - User reference field Hide "Restricted access" label instead of showing useless choices

texts:
i have an entity reference (7.x-1.5) select-list within a checkout pane which is being used to allow the user to attach a child to a product during a checkout process.

The user can add multiple "child" under their account via field collections

The user adds a product to their cart, then checks out. During the checkout they can select a "Child" to be attached to the registrations.

My issue is when a user goes to checkout, the select list is constantly growing in values the user(from every user). The current user does not have access to these fields so the select list values simply say: -Restricted access-.

I assumed this would only show values from the logged in user, but apparently, the widget grabs ALL values from every user but hides the data the current user does not have access to. I simply need to hide all data which says -Restricted access- this data so if the user has not entered any "child" field collection data, there will be no option to select from.

Has anyone ever dealt with this issue, and what options are there to fix this? I can simply use an autocomplete widget to solve this issue, but this is poor UX in my opinion.


texts: Is it possible to filter by Content Type Variant in Views?

texts:
I have 3 Variants of a Content Type. On one Variant I am listing nodes of that Content Type with a View. I'd like to control what the View returns by limiting the results to 1 variant of the content type.

I've looked through the filter options but haven't found anything that works. Would anyone know if this is possible?


texts: Programmatically show field in different regions depending on content

texts:
I'm creating an Omega sub theme & three regions ("Sidebar 1", "Content" & "Sidebar 2") inside of the "Content zone". "Sidebar 1" & "Content" are both set to always show, "Sidebar 2" however is set to only show if there's content inside of it.

I also have a field which contains links related to the page, this is output programmatically into all three regions but CSS hides all but one. This is done so it can be shown in the "Sidebar 1" region which stacks above the "Content" region on small screens but on larger screens it'll be hidden in the "Sidebar 1" region & shown in the "Sidebar 2" region instead, on the right hand side. If "Sidebar 2" doesn't exist it'll then be shown in "Content."

"Sidebar 1" pretty much only contains a menu, only on some pages though, which is again programmatically output. The reason being that I want to label / title of the menu to be set to the name of the currently active page and it was the best way I could see of doing it.

I've almost got it all working as I have a class set on the content zone div which states how many regions are inside of it (2 means no "Sidebar 2", 3 means it's there) & the first sidebar now adds a class stating if it's empty or not.

I've attempted to add a class to the "Sidebar 2" region by using drupal_get_region_content("sidebar_1") to detect if the "Sidebar 1" region is empty of not and add a class to the "Sidebar 2" region based on this will CSS selectors will use. Problem is no mater what I try or what region I try to output drupal_get_region_content always returns NULL.

The basics of what I'm trying to do
I'll try and write here what I'm wanting in a more concise manor, above I've also included how I'm trying to do it.

I have some pages with three regions in the content zone, I want to output a field in all three regions so they can be shown & hidden at different screen sizes with CSS.

The left sidebar might have a menu in which is added programatically. If it does not have this then the second sidebar doesn't need to the field I'm outputting programmatically will just be shown in the first sidebar & main content area.

I realise this is very long, appreciate anyone who's read it and any help you can offer.


texts: Set label of $entity programmatically in a custom form

texts:
I need to change the label of a custom content type programmatically. I've looked around but I couldn't find a solution. This is my custom form:

class GroupContentForm extends ContentEntityForm {

  /**
   * {@inheritdoc}
   */
  public function save(array $form, FormStateInterface $form_state) {
    $entity = $this->entity;

    $entity->set('label', 'kkkkk');
    $status = parent::save($form, $form_state);

    $form_state->setRedirect('entity.group_content.canonical', ['group_content' => $entity->id()]);
  }

}

What do I need to do to change the label? $entity->set('label', 'kkkkk'); causes an error as the field label doesn't exists, the same happens with title and _title


texts: How to redefine / override the default breakpoints in a Bootstrap sub-theme

texts:
I have a Drupal 7 subtheme based on the Drupal Bootstrap theme CDN starterkit. I'm trying to change the default breakpoints, which I thought would be a simple, routine task, but I can't find anything that works.

I've read this issue which shows that the theme supports the Breakpoints module. I've installed the Breakpoints module, followed the steps given, got confirmation in Drush and the Breakpoints module UI that my new breakpoints have been read from my .info file - but the columns in my Bootstrap subtheme ignore these and carry on using the built-in ones. I've cleared all browser and Drupal caches.

I can only assume that the "Breakpoints module support" means that it allows other modules (like Navbar etc) to listen to the custom breakpoints, whereas Bootstrap itself continues getting Bootstrap CSS files according to its built-in defaults.

I've also been through the Drupal Bootstrap documentation and can't find anything about breakpoints at all. I only confirmed what the default Bootstrap breakpoints were through a comment in the above linked issue.

All I can think of is, to compile a version of the Bootstrap CSS with the breakpoints I want, upload it and use it instead of CDN as per "Using own Bootstrap 3 files in Bootstrap Drupal 7 theme". I'm wary of this however because it seems like the theme PHP would expect different breakpoints to those defined in the theme CSS which sounds like a recipe for strange bugs further down the line. I'd prefer to override some setting or, failing that, function in the theme so that it gets the configuration I want from the CDN and isn't expecting a different configuation.

[UPDATE] I've tried this and it does seem to work, although at first I thought it hadn't because I'd misread how the Bootstrap compiler used minimum and maximum values. It feels like a very "against the grain" bodge though, and I won't be surprised if it causes problems later, which is why I'm not posting it as an answer.

How can I customise the pixel values for the xs, sm, md and lg Bootstrap breakpoints in a Drupal 7 Breakpoints based subtheme in a clean way that is consistent between front end and back end?


texts:
I am hoping for some pointers from the community if possible please. We recently rebuilt our website in Drupal 8. Previously it was made in the the old-fashioned way with Dreamweaver. It was quite old!
Now, on the old website we had a fun little tool made with some custom php code. The user answered some questions. In the background, weightings were applied to different attributes based on the answers and the result was some page recommendations for the user displayed on-screen.
The topic of the website is scuba diving and marine life, and in our case this recommended scuba diving destinations. It is not commercial, just a bit of fun. A simplified example would be:
Q1: How many dives do you have?
a) Under 25
b) Under 50
c) More than 50
Q2: What type of diving do you like?
a) Coral reefs
b) Ship wrecks
c) Underwater photography
etc..
We then have a list of dive destinations, which would gain a score based on the answers.
So, if Destination 1 was good for beginners and coral reefs, and the user answered a) to Q1 and Q2, Destination 1 might get a score of 3 for each answer, and a total score of 6. Destination 2 might be good for experienced divers who like underwater photography, so would score well if someone answered c) to both questions.
Of course, there are some more questions and more possible destinations. The end result was a list of 6 destinations (the top scoring ones) that we thought they should check out, with links to those pages on the website.
I'd love to recreate it on the new website in Drupal 8. I have been looking at the Webform module. Certainly I could use this to ask questions and collate results. I am not so confident if it (or any module) could be used to process the answers and create the recommendations?
I am ok with coding, but not at the level of creating my own module in Drupal, nor do I really have the time for that at present.
Can I seek some expert opinions please on if Webform or another module could help me achieve this, or if it is a little too bespoke.
Thank you in advance. I am of course happy to provide some more context if I have missed out anything crucial.
Phil


texts: Get a list of nodes/blocks that use a certain module?

texts:
Complete drupal noob just got hired by a company, my first task is to update/upgrade. Not being familiar with their site, I don't know what nodes/blocks the modules hook into. I want to get the latest versions of core and all of their modules, but I don't want to break anything, and I don't want to have to crawl the whole site to check if anything is broken. Advice? Is there a way to list the nodes and blocks that use a given module?

TLDR; Is there a way to get a list of pages given the module name and providing a list of nodes/blocks/other that use that module?


texts: How to access from node template a field added by module

texts:
I have a content type that has a custom template. My content type is article and I have a node--article.tpl.php that displays the following.

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

I have a module that adds a featured image to each node if it is made a featured node in its options. I believe this is the code in the module that is causing it but I'm not positive.

function featured_nodes_field_extra_fields() {
  $extra = array();
  // Get feature types from the database.
  $featured_node_types = db_select('featured_nodes_types', 't')
    ->fields('t')
    ->execute()
    ->fetchAllAssoc('machine_name');

  foreach($featured_node_types as $type => $feature) {
    foreach (node_type_get_names() as $name => $value) {
      $extra['node'][$name] = array(
        'display' => array(
          'featured_nodes_' . $type => array(
            'label' => $feature->label . ' - featured image',
            'description' => t('If this node is featured, display the associated image.'),
            'weight' => -10,
          )
        ),
      );
    }
  }
  return $extra;
}

function featured_nodes_node_view($node, $view_mode, $langcode) {
  if (!empty($node->featured_node)) {
    foreach ($node->featured_node as $delta => $values) {
      $node->content['featured_nodes_' . $values['feature_type']] = array(
        '#theme' => 'featured_node_image',
        '#node' => $node,
        '#view_mode' => $view_mode,
        '#db_values' => $values,
      );
    }
  }
}

Despite my attempts I have not been able to print the featured image from node--article.tpl.php but I believe I got close. When I added

print render($featured_node[0]['image']);

It displayed 10080. And a unique number on each featured node. Possibly the field's id. But I was still unable to produce the image. Any ideas?


texts: Remove all markup from user registration field

texts:
I have been searching in vain for days trying to find the right hook or theme override to basically change a few fields I have defined in a custom registration form.

The default markup generated by Drupal is too verbose and the designer has requested that I not change the CSS -- I need to bend the markup to meet the CSS not the CSS to play nice with Drupal.

I have tried hook_field_widget_form_alter and have managed to wrap the existing markup in div's but I need to remove the default:

function tweakform_field_widget_form_alter(&$element, &$form_state, $context) {
  //$element['#prefix'] = '<dir style="background-color: red">';
  //$element['#suffix'] = '</div>';

}

Can someone please show me how this is done? I don't want to re-write the entire form.tpl.php as I only need to override a few fields markup -- then again it may be handy to override the whole thing. These fields are dynamic and controlled by designer and more may be added later or possibly removed.

Alex


texts:
Goal: Using webform (and it's hooks) in drupal 7 I need to, under certain conditions, avoid saving the form submission (i.e. under those conditions I need to discard the submission instead of saving it to submissions models or, if that's not possible, correctly reference the submission and delete it).

Question: How is that done? Either of the solutions would be fine for me. I didn't try anything yet, since I have no clue at all about how to do any of them. I can just barely imagine it should be done on _alter or _presave hooks, but I'm not sure, and can't find about.

Current state: Totally n00b and clueless about.

Notes: Assume hooks as:

function mymodule_form_alter(&$form, &$form_state, $form_id)
{
    //validations occur here to test whether the current form is a webform node.
}

EDIT - Additional IMPORTANT notes I forgot: Depending on the value of some fields, I have two possible scenarios:

Avoid saving, then redirect (to external URLs, i.e., urls not belonging to my Drupal install. The redirection url must be the result of an evaluated expression, and not just a single url which I could specify in the webform settings).
Save, then redirect (to internal URLs, i.e., urls belonging to my Drupal install. The redirection url must be the result of an evaluated expression, and not just a single url which I could specify in the webform settings).


texts: how to use hook_views_query_alter() to modify where condition?

texts:
I'm trying to modify the where condition of a views query. till now I was successful with altering "order by", but I have no idea how to alter the where condition. I want to check the search_term and if it was in uppercase, transform it to lowercase so the query can find it. also there are some special characters in my language (persian) that I need to replace them before the query runs. anyone can help me where to start or what hooks or views_handlers to use?

<?php
/**
 * Implementation of hook_views_query_alter
 * @param type $view
 * @param type $query
 */
function nashreneydev_views_query_alter(&$view, &$query) {
  //krumo($query);
  //krumo($view);
  if ($view->name == 'custom_search') {
    $search_term = $view->exposed_raw_input['combine'];

    **//$query->where[0]['conditions'][0]['field']= "?????";**
    $view->query->orderby[1]['field'] = "CASE node_type WHEN 'product_display' THEN 1 ELSE 2 END";
    $view->query->orderby[1]['direction'] = "ASC";
    $view->query->orderby[0]['field'] = "CASE node_title WHEN '".$search_term."' THEN 1 ELSE 2 END";
    $view->query->orderby[0]['direction'] = "ASC";
    //krumo($view->query->orderby);
  }
}
?>

the devel result for where condition is as follow right now. :views_combine is equal to %s%.

  CONCAT_WS(' ', node.title, ' ', field_data_body.body_value, ' ',
  field_data_field_author.field_author_target_id, ' ',
  field_data_field_translator.field_translator_target_id, ' ',
  field_data_field_book_tags.field_book_tags_tid) LIKE :views_combine


texts: Get taxonomy name in cycle (performance)

texts:
I have a subset of data ($query->execute) where 1 column is an ID of taxonomy.

I need to replace 'term id' on 'term name'. Right now I just make 'lookup' for each id and replace it with name:

foreach ($entries as $entry) {
  $row = array_map('check_plain', (array) $entry);

  // --> HERE I WANT TO AVOID LOOKUP FOR SAME ID
  $location = taxonomy_term_load($row['term']);
  $row['term']=$location->name;
}

However I'm not sure if it is a proper way to do that, since I have many similar ID and I want to avoid useless lookups (so I do lookup only for 'unknown' ID)

Should I build my own cache variable-list for every new ID or there is already an efficient way to do it?


texts: Take field with a string of values and extract it to 1-1 value / column

texts:
I have a Drupal 8 view with a field, favorite pets, which allows multiple values rendered as a CSV string (e.g. cat, dog, snake).  What I would like is having the following output.

+ id  + cat  + dog + snake +
============================
|  1  |  1   | 1   | 1     |
|  2  |      | 1   |       |
|  3  |      |     |       |

I was looking for a way to solve this, but I hit a wall trying to determine if this is a theming or possibly a back-end (e.g. hook_views_data()) issue.


texts: Drupal7 multistep module - how to skip validation on previous

texts:
I created a multistep node form in Drupal7 using the multistep module (http://drupal.org/project/multistep)

I patched the module so it would work (previously Drupal complained about required fields that weren't on the current step). The module is working fine now, the only thing is that if I press the previous button, it still validates the current step. I want to skip this validation, so the current step is only validated if I press the next or done button.

I digged into the module code, but really cannot figure out what to search for.

Can anyone help me on this?

Edit: Here's my form_alter function for multistep:

function multistep_form_alter(&$form, &$form_state) {
if (isset($form['#multistep'])) {
  $excluded_children = _multistep_gather_excluded_fieldgroup_children($form, $form['#multistep']['current']);
  $current_children = _multistep_gather_current_children($form, $excluded_children);

  $prev_excluded_children = _multistep_gather_excluded_fieldgroup_children($form, $form['#multistep']['previous']);
  $prev_current_children = _multistep_gather_current_children($form, $prev_excluded_children);

  // Apply limit validations to all submit fields.
  foreach (element_children($form['actions']) as $key) {
    if ($key == 'previous') {
        if (isset($form['actions'][$key]['#type']) && $form['actions'][$key]['#type'] == 'submit') {
          $form['actions'][$key]['#limit_validation_errors'] = $prev_current_children;
        }
    }
    else {
      if (isset($form['actions'][$key]['#type']) && $form['actions'][$key]['#type'] == 'submit') {
          $form['actions'][$key]['#limit_validation_errors'] = $current_children;
      }
    }
  }
}

}


texts: Different Status Message templates for different pages

texts:
I have been trying to use different status message templates. But I do not know if we can use different status message templates for different pages.  Is it possible?

Right now, I am using

status-messages.html.twig

Any help would highly be appreciated. Thanks!


texts: How to prepopulate a term reference field with multiple values on a new form?

texts:
I seem to struggle with a problem which has already been answered. I have a 'review' form on which there is a field that I want to prepopulate. It is a term reference field and I want it to be prepopulated with taxonomy values from another node. I have looked at this issue without success. Any help would be greatly appreciated.

function my_module_form_alter(&$form, &$form_state, $form_id) {
      $nodeid=$_GET['id'];
      $node=node_load($nodeid);
      if ($form_id == 'review_node_form') {
        $form['field_revactivities']['und'][0]['value']['#default_value'] = $node->field_ad_tags['und'][0]['tid'];
      }
}

I know that '$node->field_ad_tags['und'][0]['tid']' returns the number of the term, but I am not sure how to get the value into the new field.

Also, if there are multiple terms for the field, should I populate the field for each term by incrementing [0], then ['1'], etc...?


texts: Node reference + i18n - How to display only referenced nodes for the current language?

texts:
I have two content types with multilingual content (French/English), Publications and Profils.

I have set up a node reference on Publication content type to link any Publication with the concerned Profil.

Unfortunately all Profils appear in listing, which is very confusing for the user. I would like to only display french Profiles when editing/creating a french Publication (and same for english content).

I just discovered the module i18n node reference synch (https://www.drupal.org/project/i18n_node_reference), but unfortunately this module doens't provide this kind of feature.


texts: Modules that will allow search for external data using either Apache Solr or Elastic Search

texts:
I have data within a Teamsite application which we will be indexing within either Apache Solr or Elastic Search (have not decided yet).  I plan on creating search pages within Drupal 7 that will allow the user to search against the external indexed data mentioned above and list the search within a Drupal results page.

Are there any Drupal 7 module that will allow this to done for external data using either Apache Solr or Elastic Search similar to what can be done with Drupal 7 modules that connect to Solr or Elastic Search for Drupal indexed data?


texts:
If I have the id of an existing piece of media content, what can I do to update it (modify it)?

I know how to create a new piece of media , (with Media::create) , but not sure of the code to load and then updated an existing piece of Media.

thanks


texts: How does one add revision information to custom built entities?

texts:
I'm looking for help in gentle/simple terms for how to add revision information to my custom entities. This is maybe my fifth or sixth attempt to do this and every time I get lost and overwhelmed by all the info in the various online knowledgebases about the various ways of doing things for various iterations of Drupal.

I've used the EntityAPIController (sites/all/modules/entity/includes/entity.controller.inc) from the Entity API module and seen that this has the following method:

  /**
   * Saves an entity revision.
   *
   * @param Entity $entity
   *   Entity revision to save.
   */
  protected function saveRevision($entity) {
    // Convert the entity into an array as it might not have the same properties
    // as the entity, it is just a raw structure.
    $record = (array) $entity;
    // File fields assumes we are using $entity->revision instead of
    // $entity->is_new_revision, so we also support it and make sure it's set to
    // the same value.
    $entity->is_new_revision = !empty($entity->is_new_revision) || !empty($entity->revision) || $entity->is_new;
    $entity->revision = &$entity->is_new_revision;
    $entity->{$this->defaultRevisionKey} = !empty($entity->{$this->defaultRevisionKey}) || $entity->is_new;

    // When saving a new revision, set any existing revision ID to NULL so as to
    // ensure that a new revision will actually be created.
    if ($entity->is_new_revision && isset($record[$this->revisionKey])) {
      $record[$this->revisionKey] = NULL;
    }

    if ($entity->is_new_revision) {
      drupal_write_record($this->revisionTable, $record);
      $update_default_revision = $entity->{$this->defaultRevisionKey};
    }
    else {
      drupal_write_record($this->revisionTable, $record, $this->revisionKey);
      // @todo: Fix original entity to be of the same revision and check whether
      // the default revision key has been set.
      $update_default_revision = $entity->{$this->defaultRevisionKey} && $entity->{$this->revisionKey} != $entity->original->{$this->revisionKey};
    }
    // Make sure to update the new revision key for the entity.
    $entity->{$this->revisionKey} = $record[$this->revisionKey];

    // Mark this revision as the default one.
    if ($update_default_revision) {
      db_update($this->entityInfo['base table'])
        ->fields(array($this->revisionKey => $record[$this->revisionKey]))
        ->condition($this->idKey, $entity->{$this->idKey})
        ->execute();
    }
    return $entity->is_new_revision ? SAVED_NEW : SAVED_UPDATED;
  }

But with all the various sources of information out there on developing for Drupal I'm in a total tangle with my understanding. Am I just supposed to say "is revisionable" this link and others kind of gloss over it as though all one needs to do is set the "revision table" and "entity keys" "revision" element in the hook_entity_info implementation

This is where I'm unstuck - just as with node and node_revision in the db, can't entity and entity revision tables be different? Surely we need to overwrite something in one of the entity/controller/wrapper classes because it's not as simple as just copying all fields from one db table to another and auto incrementing a version id?

This post has lots of info, but I started reading through the links under "documentation" and I'm worried that I might be looking at some module which has hijacked the term revision in some higher layer.


texts:
I'm creating a custom twig for my node 1, as node--1.twig.html.

In this I'm showing the image uploaded in the node as

<div class="diversity-image">
    {{ set image = content.field_main_image|merge({'#style_name': 'header_image'}) }}
    {{ image }}
</div>

But it is not giving me the image of that image style, header_image.

How do I do that in twig?


texts: How do I grab the current product SKU in code, as early as possible?

texts:
In Drupal Commerce, using programming, what is the way to grab the product SKU of the product entity that is about to fire off and display on the page in a product display node, as early as possible?  I'm looking for something that is before panes and views are executed and drawn.

I know the SKU lives in $form_state['default_product']->sku within a hook_form_alter, but that is too late.

In panels, I know there is a time in hook_panels_pane_content_alter where I can scrape the SKU out of $content->content['#markup'].  That doesn't seem to update though as I change the selectors that affect which product is currently displaying.  So that's no good.

I need it as early as possible, because I want to pass that value into a view during hook_views_pre_view, which is executed very early.


texts: Get term ID of a field vocabulary in for templating

texts:
I have a node template with various taxonomy fields and I'm trying to get the term ID of a specific vocabulary field to pass it through an url.
I have tried many function but I can't seem to find the proper one.
Can anyone help me on this ?


texts: nodes in views and views in search results

texts:
I'm building a website, where I don't want to display nodes directly.
All nodes are presented using Views. The idea is that i've got 10 basic pages without content. On each of these page I've got one or more Views as blocks. In these Views i show my nodes.

THE PROBLEM:
When I use drupal search I get results with direct links to nodes. Instead I would like get links to pages where the View is located, containing that node. I can easily achieve that by changing alias to page with that View. For example: I've changed alias content/function-one to /functions (page with View which presents functions) and it works, but there are another problems there.

First, I can still access nodes directly by url /node/%nid.
Second, I can have links only to pages with Views, but I still want to navigate to the nodes. I thought I can achieve it using anchors. I modified my alias to /functions#functionOne. But my href looks like /functions%23;functionOne and the anchor doesn't work.

So my goal is to disable access to nodes by /node/%nid and make my search results to give me link to the page that contains View with that node and navigate user to that node.

Any ideas how I can achieve that? Alternative approaches?

Thanks in advance


texts: How do I add attributes to an entity reference field?

texts:
Let's say we have a RECIPE content type that has a multi-value entity reference field to a FOOD content type, so as to represent the ingredients.

Each ingredient on a recipe needs to hold a quantity (eg: '1 cup') in addition to the reference itself.  How can we add that attribute?

We'd like to avoid having an additional entity to hold the relationship for performance reasons.  Also, sticking to core's entity reference field seems a good idea so the rest of the ecosystem can recognize the relationship.


texts: Associate Every Displayed User Name With Corresponding users.data Table Row

texts:
Updated:

I would like data from the users.data table displayed with every "User Name" however it is displayed.

As an example, I have this in hook_preprocess_page_title():

function hook_preprocess_page_title(&$variables) {

  if (\Drupal::routeMatch()->getRouteName() == 'entity.user.canonical') {

    $gUD = \Drupal::service('user.data');
    $routeUID = \Drupal::routeMatch()->getRawParameter('user');
    $gudValue = $gUD->get('module', $routeUID, 'name');

    if ($gudValue = $moduleValue)) {
      kpr('Success!');
    }

  }

}

The route entity.user.canonical allows me to reference the viewed user, and so I can use \Drupal::routeMatch()->getRawParameter('user') to get the non-current user ID. (it's not the route that counts, but my ability to reference the users.data table for the displayed user)

And this in hook_preprocess_username():

function hook_preprocess_username(&$variables) {
  $gUD = getUsersData();
  $gudValue = $gUD->get('module', $variables['uid'], 'name');
}

So what I am looking for is something like:

hook_preprocess_HOOK() {
  $UID = // From displayed user name.
  \Drupal::service('user.data')->get('module', $UID, 'name');
}

for each displayed user name.

The problem here: get user id from username or email without logging in, is that I don't know, and cannot manually enter the username value.

A couple of examples where the username is displayed on a page without using the username field:

Views field Name (not linked to user, uses views field base)
User type entity reference field (format display label, uses field base)

hook_preprocess_page_title() and hook_preprocess_username() are pretty straight-forward. And I believe I know where/when this template/hook will be used, but I am still having trouble defining a couple of other instances, and determining the best hook to alter the output as needed.


texts: Apachesolr searching is not working with cck field

texts:
I am working in Drupal 6 website with apachesolr. I have added a cck field (text field) in a content type.

When I am searching the value of textfield, apachesolr showing empty result.

The field is indexed properly into apachesolr index.

How can I implement apachesolr searching for cck text field?


texts:
For some reason Drupal is parsing my landing pages address with both alias and clean url. Meaning that the landing page for new users becomes /dashboard&destination=node/30 instead of ?q=dashboard or ?q=node/30.

I have tried disabling clean url by unchecking use clean urls (?q=admin/config/search/clean-urls) and clearing the cache, but it still uses them (e.g problem continues). So I was hoping somebody might enlighten me how to force Drupal not to use clean url:s?

Thanks


texts: *Some* Users Experiencing Login Failures

texts:
A significant minority of our users repeatedly experience login failures and have to reset their passwords every time. Can anyone suggest possible solutions please? Details as follows.

Apparently, the behaviour is as follows:

User opens login page, enters valid username and password.
Login fails, repeatedly!
User requests password reset. Then, using link from e-mail able to: reset password, login and access their account
Next login, user has to repeat process.

Unfortunately, we can't duplicate the issue ourselves. But we have looked through Drupal logs and Apache access logs and observed the following:

The problem is not confined to a specific browser (seen on IE, Safari, Firefox) nor a specific OS (seen on Windows, Mac, iPad)
The users do generally have cookies turned on. We have inserted some custom code to warn users with cookies turned off and write "cookies disabled" to Drupal logs.
Clearing all caches in Drupal doesn't fix issue.
Clearing cookies in browser doesn't fix issue either, one of our users has tried.

We are running Apache on an Ubuntu server.

In settings.php, $base_url is commented out; $cookie_domain is also commented out. It was set, but we decided it was safer to remove it although, I'm not sure that made any difference.

We are using "Profile2" and "Profile2 Registration Path" modules. However, I doubt those modules are the source of our problems as I cannot find any record of anyone else having login problems with those modules.

Do you have any suggestion?

I should have mentioned, the site is running Drupal 7.13.

When the user clicks on the password reset link they are currently prompted to change their password.

We have also asked one user to try another browser but sadly, that didn't fix their problem. Also we have noticed that the problem on IE, Firefox & Safari so, we don't think it's browser specific


texts: How do I include a CSS library in my custom module?

texts:
I want to include the YAMM!3 CSS library in my Drupal 8 site. To that end, I wrote a custom module following the instructions in this answer. Although that answer is in regards to a php library, I thought it would also work for a CSS library.

This is the composer.json from my custom module:

{
  "name": "drupal/my_yamm3",
  "type": "drupal-module",
  "require": {
    "geedmo/yamm3": "*"
  }
}

In the composer.json in the root of my Drupal codebase, I have this:

"extra": {
    ...
    "merge-plugin": {
        "include": [
            "core/composer.json",
            "modules/custom/my_yamm3/composer.json"
        ],
    ...

I updated my codebase with this commands:

$ composer update
$ composer dumpauto

And I noticed this line in composer's output:

> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Installing geedmo/yamm3 (1.1.0): Loading from cache

Which is confirmed by an examination of the filesystem:

$ ls vendor/geedmo/yamm3/
bower.json  composer.json  demo/  gulpfile.js  index.html  LICENSE.txt  package.json  README.md  yamm/

I've enabled the my_yamm3 module on my site, and under admin/config/development/performance, I've disabled css aggregation.

However, when I load the page, I do not see the yamm libraries being loaded in the network tab in my browser.

Am I using the correct method to load a third-party css library? What am I doing wrong?

EDIT osman asked for some confirmation of the state of my environment. In my drupal project root, while I do have /composer.json and the directories /drush/ and /vendor/, I don't have /scripts/ nor /web/. I guess that means I am not using the drupal-composer/drupal-project project.

Regarding his recommended additions to composer.json, this is what I had:

"extra": {
    "installer-paths": {
        "core": ["type:drupal-core"],
        "modules/contrib/{$name}": ["type:drupal-module"],
        "profiles/contrib/{$name}": ["type:drupal-profile"],
        "themes/contrib/{$name}": ["type:drupal-theme"],
        "drush/contrib/{$name}": ["type:drupal-drush"],
        "modules/custom/{$name}": ["type:drupal-custom-module"],
        "themes/custom/{$name}": ["type:drupal-custom-theme"]
    }
},

So again it looks like I don't have the composer project?


texts: display all products in a single page (without using pager) ubercart

texts:
I'm trying to display all products on a single page without a pager. Some sites have this functionality where you can click from page to page, or you can choose 'show all'. Or there is a drop down box where you can select how many products you want to view like this: http://www.newegg.com/Store/SubCategory.aspx?SubCategory=32&name=Laptops-Notebooks&Pagesize=100

Does ubercart have anything like this out of the box? I'm using the taxonomy_term views to display my categorized products right now. So for example, for a category:show, you can get there by going to: taxonomy/term/12 which I override to be category/shoe (with pathauto aliases).


texts: Creating a fake JavaScript exposed filter in Drupal 7 Views module

texts:
In this website I'm building there's a page with a Views list of people, divided into categories.
I've exposed a category filter and a name filter to visitors.

Since the list isn't long, I would like to show all the items on page load and use the exposed filters as "fake" filters. Those will not actually make a request to the database, but call a JavaScript function that will go through the list and hide the unwanted items using CSS.

I can create my own filters, but then the category filter will not auto update when a new category is created.
I've seen that I can use MYTHEME_preprocess_views_exposed_form hook to change it to how I want, but then the page will still download and run auto-submit.js, which is the CTools JS file that Views module uses for auto submitting. I can remove it with MYTHEME_js_alter, but it seems like a lot of effort - and mostly wasted computational time slowing the page load - for a simple task.

Does anyone know a better way to accomplish this? Am I just overreacting over a few lines of code?

Thanks guys, hope everything is clear.

EDIT:

About 5 seconds after posting I've realized that I could use auto-submit.js with the JavaScript too. So all I need to do is remove the action of the form and add onSubmit that'll point to my script.


texts: How to Embed Views Exposed Filter for only one field

texts:
i have a view and many fields are exposed in it. I need to embed (render) a specific exposed filter in my template.

i have came across this article. But it shows all exposed filters of a view.

any idea how this can be done?
thanks


texts: How do I properly remove "Powered By Drupal"?

texts:
How do I remove the "Powered By Drupal" string that is displayed on the site footer?

Does it involve PHP coding?


texts:
I have a content type of band. I have a view filtering by user id to see my bands.

What I'm trying to accomplish is allowing users to create a band and have a management dashboard. This dashboard would be separate from their public facing page.

I would like the dashboard to have the ability to add shows, members, photos etc all on the same screen.

My guess would be to create a page with multiple views filtered based on some type of criteria either a reference field to members or the single node author.

Is there a better approach to handling this type of functionality?


texts: Why are image styles only being generated during a cron run?

texts:
I've got a weird thing going where image styles are not being generated after uploading images (as media entities)

Image styles are generated during a cron run.

Is there a setting for this that I have unintentionally enabled somewhere? What else could be causing this?


texts: I know that there is a hook to programmatically define image styles in code but I can't find anyway to export ones that already exist in the database to code?


texts: How to add a profile cover with a user field image in a view?

texts:
I am trying to add a cover image to user profiles in a block view, the image comes from a user profile field.

The problem is that I need the path to that image because my neede code is like this:

<div class="profile-background"  style="background-image: url('/sites/all/themes/pingu/img/Circles.jpg');">


texts: How do you configure a Drupal linux dev system for sending email?

texts:
My current dev system is a multi-site dual-boot windows/linux box with Apache 2.4/PHP 5.4.

In windows mode with a fresh install of D6 or D7, a verification email is properly sent when registering a new user. No contributed modules are required.

In linux mode (Ubuntu 12.04 LTS) the email does not work. I have tried using the ubuntu default (sendmail dummy?), sendmail, ssmtp, and postfix email packages with assorted configuration settings.

Most of the email packages seemed to have work from the command line.

With default or sendmail, a Create new account request causes the "wait" mouse-pointer to appear and remain like that for 30 secs or longer. The "email has been sent" message eventually appears but no email is ever received. With the postfix or ssmtp package installed, the same message appears within a second or two but no email is received.

I have searched for an answer on how to configure a Drupal linux system for email without much success.

The D6/D7 SMPT Authentication Support module solves this problem but it is a dependency that should not be necessary.

I don't have these problems running in Windows mode; never have in 3 years. I now have a shared NTFS partition so both modes use exactly the same code base.


texts: Views: no results text not showing when contextual filter is set & no results returned

texts:
I have the following setup:

Block view
Contextual filter: Author UID -> Provide default value -> User ID from logged in user.
Fields: various
Filters: various
No results behaviour: text

I want the user to see a list of nodes that they have created. If no nodes are found, I want the No results text to show. Currently, it's all working fine if nodes are found. However, if no results are found, the entire view is hidden. Is this standard behaviour? How do I make it display the No results text?


texts: Vocabulary terms deleted but still visible

texts:
I work on a D7 website where some taxonomy terms were created and then deleted.

I’ve build a search form with views based on taxonomy terms (filter criterion: Content: Term name (field_term_name)) and i see some "deleted" terms in filter exposed to visitor.

I’ve check directly in DB and it appears that these datas (which should be completely deleted) are still in taxonomy_term_data.

I do not see these terms in the Drupal admin but I can however still see them in the database, and I can open them directly using the tid in the Drupal interface.

My experience with Drupal let me think that is not a good idea to delete them directly in DB. So how can I proceed ?


texts: List all groups where the profile owner is a member?

texts:
I need to put a block inside the profile page, that shows all the information of the profile owner, regardless of the logged in user. (There are some information out there in the forums about how to catch the logged in user´s information).

I need to list all groups where that user is a member of. And I can´t. I´ve tried a lot of combinations, and the last one seemed correct, why isn´t working? What am I missing?:

This is my current configuration:

Contextual filters
(author) Usuario: Uid
Provide default value (User UID from URL)

Relationships
Content: Author
(author) OG membership: OG membership from User

Filter criteria
Content: Type (= Group)

What am I missing?
Thanks for your help!!!


texts:
I would like to use PHP code in nodes of a specific content type. I can check the user's permission with the global $user if the user can access the node.

Is there any module to set view for created page content?
Is it secure to check page access with this code?

global $user;

// Check to see if $user has the administrator role.
if (in_array('administrator', array_values($user->roles))) {
  // Do something.
}


texts: System settings form data access validation

texts:
I have created system settings form for an image using managed_file.

$form['my_image'] = array(
  '#type' => 'managed_file',
  '#name' => 'Upload Image',
  '#title' => t('Upload Image'),
  '#default_value' => variable_get('my_image', ''),
  '#description' => t("Here you can upload setting image!"),
  '#upload_location' => 'public://my_image/',
  '#upload_validators' => array(
  'file_validate_extensions' => array('jpeg png svg jpg'),
  ),
  '#required' => TRUE,
);

How can I add the file view/download access on this file based on role?


texts:
I am attempting to figure out how to write a simple migration from an XML source that is located on a separate URL.

I have tried a number of different configurations for the selector and so far nothing has worked. The migration and source example are below.

migration:

id: xml_test
label: xml test importer
migration_group: p_migrate
dependencies:
  enforced:
    # List here the name of the module that provided this migration if you want
    # this config to be removed when that module is uninstalled.
    module:
      - p_migrate
source:
  plugin: url
  data_fetcher_plugin: http
  data_parser_plugin: simple_xml
  urls:
    - 'http://localhost:8888/test/source.xml'
  item_selector: /root/row
  fields:
    -
      name: title
      label: title
      selector: root/row/title
process:
  #  nid and vid commented out will allow them to autoincrement. Safe as long
  #    as nothing else is referencing them.
  #  nid: nid
  #  vid: vid
  #  type: type
  title: title

destination:
  plugin: 'entity:node'
  default_bundle: article

Source:

<?xml version="1.0" encoding="UTF-8" ?>
<root>
  <row>
    <title>Lorem ipsum</title>
  </row>
  <row>
    <title>Feeds Migrate is awesome!</title>
  </row>
</root>

This is the error I am currently getting:
Invalid argument supplied for foreach() SimpleXml.php:79
Invalid argument supplied for foreach() SimpleXml.php:79


texts: When using rules to set an entity reference, do I use node or node:nid?

texts: I am using rules to create nodes.  Whenever a specific field on my target node-type is changed, a new new will be created and linked to the target node via entity reference field.  I would like to know, when setting an entity reference field using rules, should I use the data selector 'node' or the data selector 'node:nid'?


texts: Infinite scroll is firing multiple times

texts:
I have looked for other answers on the same topic but still cannot find a solution why the event is firing more times in my code:

  (function($, Drupal, drupalSettings) {
    Drupal.behaviors.news = {
        'attach': function(context) {

            $(".loader").hide();
            var loadIndex = 0;
            var isLoading = false;

            $(window).scroll(function(){
                if (!isLoading) {
                    var footerHight = $(document).height() - $(window).height() - $("#myFooter").height();
                    if($(window).scrollTop() > footerHight){

                        isLoading = true;
                        loadIndex = loadIndex + 1;

                        $(".loader").show();
                        $.ajax({
                            method: "GET",
                            url: '/load-news?startIndex=' + loadIndex,
                            success: function (result) {
                                console.log("More loaded");
                                setTimeout(function(){
                                    $(".loader").hide();
                                    onSuccess(result);
                                    isLoading = false;
                                }, 1000);

                            }
                        });
                    }
                }
            })
        }
    };

    var onSuccess = function(data) {
        console.log('SUCCESS');
        $(".news-list-wrapper").append(data);
    };

})(jQuery, Drupal, drupalSettings);


texts: Services 3.x json cache for anonymous user

texts:
Does the services module always invoke php to return data in json format? Is there anyway to cache the json output to be served for anonymous users (i.e. retrieve json data without invoking php)? First request will hit php and all subsequent hits should hit the cache.

My endpoint looks like this api/anon and it does not have any session authentication.

My request looks like this http://localhost/api/anon/node/[nid]

Thanks


texts:
I'm using MAMP on os x 10.6.

Until this morning clean URLs where working on about 20 different D6 and D7 installations without problems.

All of a sudden clean URLs are broken on all installations. I'm not aware of having changed something in the MAMP or apache configuration.

Things I already checked:

phpinfo() tells me that mod_rewrite is loaded.
I did not change any .htaccess files

Do you have any idea on where to look at?

Update: I think the .htaccess files are not loaded at all. I can write gibberish into the file and there are no error messages at all.


texts: How do I redirect in a class sub-classing the EventSubscriber class?

texts:
I want to redirect to a specific URL in an EventSubscriber class instead of showing the Page not found page. I followed Symfony2 redirect for event listener? but the redirect goes to the home.

This is the code I am using.

use Drupal\Core\Url;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;

class PageNotFound implements EventSubscriberInterface {
  public function pageNotFound(GetResponseEvent $event) {
    $request = $event->getRequest();
    $id = '1234';
    $scheme_and_http_host = $request->getSchemeAndHttpHost();
    $url = Url::fromRoute('myroute', ['id' => $id])->toString(); // this url exist (checked)

    $response = new RedirectResponse($scheme_and_http_host . $url, Response::HTTP_MOVED_PERMANENTLY);
    $event->setResponse($response);
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[KernelEvents::REQUEST][] = ['pageNotFound'];
    return $events;
  }
}

mymodule.services.yml

services:
  mymodule.page_not_found:
    class: Drupal\mymodule\EventListener\PageNotFound
    tags:
      - {name: event_subscriber}

How do I redirect users from an EventSubscriber class?


texts: how to set the source connection in drupal d2d migrate

texts:
I am migrating my taxonomy and users from d6 site to d7 site. How can I set the legacy connection of source db of d6 site.

The user is root and password id empty with source database name as d6 for the Drupal 6 site.

  hook_flush_caches().

 $common_arguments = array(
        'source_connection' => 'd6_migration',
        'source_version' => 6,
      );

will it migrate data from d6 to d7 when I install the custom migrate_d6 module in Drupal 7 site?

My Settings file of Destination project is

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'd7',
      'username' => 'root',
      'password' => '',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
  'd6_migration' =>
  array (
    'default' =>
    array (
      'database' => 'd6',
      'username' => 'root',
      'password' => '',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);


texts: Creating a field that has node values using FAPI

texts: I would like to use the Form API to create a form that uses a textfield that references all the current nodes as an autocomplete. Is there a way to added field using the FAPI that allows a user to type the node's title or ID and the field is validated by whether the node exists.


texts: Webform onchange added with hook_form_id_alter()

texts:
I have a webform on a Drupal 7 site I am working on whose form ID is 144. I have a module that alters this form to add default values to the webform fields. This works fine. I now have to add an onchange event to one of the text-fields.
This is the code I am trying in the module to add the event.
$form['submitted']['postal_code']['#attributes']['onchange'] = 'getaddress(this)';

I have the webform-form-144.tpl.php template in the theme directory.
At the bottom of this template, I have the following the following line, to add the file containing the event handler.
drupal_add_js(path_to_theme() . '/js/webform144.js');

At the moment all I have in the file is the following code.
function getaddress(code) {
    alert(code);
}

The textfield rendering output is the following.
<input type="text" maxlength="128" size="64" value="408600" name="submitted[postal_code]" id="edit-submitted-postal-code" class="form-control form-text required" onchange="getaddress(this)" required="required">

To me, this means getaddress() should be called with the current field value, when the onchange event is fired.
I cleared the cache. When I try to change anything in the postal_code field, nothing is happening; it looks like the onchange event is not fired. I am using the Firefox console and I am seeing no evidence of the onchange event being fired. I am also not seeing the output of alert().
Am I missing something obvious?
This is the first time I tried to add an event to a webform field. I didn't find any example or tutorial.


texts: User edit form same as registration form

texts:
The title says it all: I want the page at /user/ID/edit to look exactly the same as /user/register form. Of course, the submit-button-action would have to be a little bit different, but the form elements shall stay the same and inherit their default values from $user.

Does anyone have some sort of snippets that do this job? Or are there any best practices around without using additional modules e.g. panels, profile2, etc.?!


texts: Nodes created on 1st date of the month are not showing up on Calendar

texts:
I am using the following modules

Calendar
Date

There is an attendance content type with a field of type date.
The nodes of this content type get pulled in a Calendar.

But, nodes which are created on the 1st date of the month are not showing up in the calendar.


texts: menu items saved with menu_link_save() don't have the delete button, and I can't edit the menu path

texts:
When I add menu items manually, they work fine.  When I try this I get no delete link in the admin, and I can't edit the menu items.

$link = array();
$link['link_title'] = "text";
$link['link_path'] = 'node';
$link['menu_name'] = $menu;
$link['expanded'] = 1;
$link['module'] = "dl_migration";
$link['weight'] = $i;
menu_link_save( $link );
menu_cache_clear_all();


texts:
I've got a Views table with a column displaying links to files (images, pdf's etc.). I've got a button below the table that exports the entire table. I need another button that should start a .zip download of all images currently shown in the table. The table has a filter on it, so it's important that only the files from the filtered results are downloaded.

I haven't been able to find a module or similar use case, so I hope there's someone here that can point me in the right direction.

Cheers,


texts: drupal_process_states function doesn't work for managed_file

texts:
The following code is working for text field, but it's not working for image field.

function THEMENAME_form_system_theme_settings_alter(&$form, FormStateInterface &$form_state, $form_id = NULL) {
  $form['check'] = array(
    '#title' => t("Show Image file"),
    '#type' => 'checkbox',
  );

  $form['banner_image'] = array(
    '#title' => t('User Image'),
    '#type' => 'managed_file',
    '#default_value' => theme_get_setting('banner_image'),
    '#upload_location' => 'public://',
    '#upload_validators' => array(
      'file_validate_extensions' => array('gif png jpg jpeg'),
      'file_validate_size' => array(1048576),
    ),
    '#states' => array(
      "visible" => array(
        "input[name='check']" => array("checked" => TRUE)),
    ),
  );
}

Can any one suggest how to implement this?


texts: I am using webform2pdf. I'm having an issue with the download PDF button; it goes to a blank page when it goes to a path like /node/3/webform-results/downloadpdf. Does anyone have a fix for this?


texts: How do i set '#cache' attribute value in a renderable array in drupal 8?

texts:
I need to render an image from my custom block. So i have to return an renderable array of an image object from my block.

I have written code like this(snippet), and its working fine.

$logo_build = [
       '#theme' => 'image',
       '#width' => $width,
       '#height' => $height,
       '#uri' => $uri,
     ];

     $renderer = \Drupal::service('renderer');
     $renderer->addCacheableDependency($logo_build, $file);

     return [
       'logo' => $logo_build,
     ];

but now, how to set '#cache' value here ? If it return array like below then i can use '#cache'. But in the above code how to set '#cache' value ?

return array(
     '#cache' => ,
);


texts: Create a primary link for the user edit page

texts: What is the proper way to create a link under "Primary Links" that will take the logged in user to their own user edit page?


texts: Jqgrid table format not showing in user pages in drupal7

texts:
I tried to create a table inside a view in jqgrid format. But when tried to display it in a view in user page (user-profile.tpl.php) the table is not showing. Is any coding needed for that?, it showing perfectly when I change the format to simple table in view.

Thanks in advance


texts: Allow a user to upload a PDF file to a specific block within a page

texts:
Wondering if anyone can help with a problem:

I have created a content type called 'Brochures' and added a 'file' field with a pdf format. I want the user to be able to upload pdf file(s) then select a particular page for the pdf to populate having them display in a block-view on that specific page.
So the user process would be:

-add content
-select 'Brochure' content type
-browse/upload PDF
-select a page for the PDF to populate <-----This is the part that is giving me grey hair. ;)
-save

Hope I am making sense.

Always, Jason


texts: How to display only "after now" dates (of multiple) of a date-field in a node?

texts:
I have an 'event' node-type with just a body and a date-field. For that date-field, multiple dates are allowed.

I'm listing event-nodes in a view and already use filters to only display nodes when the latest date is after 'now', so that completely outdated events do not get listed automatically. However, when I have multiple dates and at least one of those is still in the future, the node gets displayed.

In the latter case, how can hide all dates that are in the past, and only display the ones that are still in the future? I didn't find an option for that for the date-field in the node-type display settings.

I guess I could override my node.tpl.php with a custom node--event.tpl.php, but how do I parse out single dates of my date-field then, check if they are in the past and hide those that are? I'm totally lost when it comes to PHP and Drupal content-arrays.. I'd appreciate any help with that!


texts: Altering display mode for authoring information

texts:
I'm trying to deal with authoring info for articles in Drupal 7. I've found the way to hide or unhide it, and that's all I can do. But what I'd need is find a way to display on certainly tagged articles, but hide when that specific tag is not added. Is there any solution for this without coding? CSS is okay, but I know no PHP.

Thank,
cs.


texts: Ckeditor and IMCE not working with Plupload

texts:
When I use IMCE with CKeditor as a WYSIWYG for my website it works fine:

However when I add the Plupload module which would allow me multiple files selection it breaks!

If this can't be fixed, is there any other alternatives similar to Plupload that I can use with CKeditor?


texts: Show metatags on node add/edit pages on custom theme

texts:
I have a user role which can add/edit metatags (Metatag module) and when I allow overlay and admin theme access for that user role - everything is OK. But if they are editing/adding node from my custom theme for some reason they cannot see fields for metatags, only tab with the label "Meta tags". Same thing is with the URL alias, only tab. I'm not sure what can be the cause or am I missing something.
Thanks


texts: Showing "Explanation or submission guidlines"

texts: How can I get the Explanation or submission guidelines (one of the boxes when you edit/create a new content type) when the form is displayed? It obviously works fine in the default themes, but I can't figure out how/where to put the info to get those guidelines to be displayed. I'm not even sure which template it belongs in (node, page, region, etc).


texts: displaying fields of selected taxonomy term

texts:
I'm trying to create a minimalistic ordering system. No need for a full fledged solution like Commerce or UC in this case.

Orders are represented as nodes (or maybe as custom entities using ECK, have yet to decide). Products are organized into a taxonomy tree. Hierarchy_select module gives the user a super convenient way of selecting the product.

But there is a problem. I need to display some fields of a product term selected by user. Is there a way to tackle it without writing much of custom code?


texts:
I have a rule which is activated with the following url

redirect/startcoursewithpage?course=502&page=1&module=471

The condition of the rule is:
- Check if URL argument exist for course
- Check if URL argument exist for page
- Check if URL argument exist for module.

The parameter values of course and module will never be 0. The page can be of a value of zero.

If the parameter page=0 is given in the url the condition is not true and the redirect is not done. If I remove the condition Check if URL argument exist for page it is working.

The value zero is directly from the database from another view. I think I should uuencode this zero value but I do’n know how. Other suggestions?


texts: Drush 10, Drupal 9, views-bulk-operations:execute using entity:delete_action:node seems to work but won't save its changes

texts:
I'm trying a command:
drush -vvv views-bulk-operations:execute -d deleteme_content entity:delete_action:node
where deleteme_content is a View with translations of entities that I want to delete.  The command appears to work and prints a success message but the content is not actually deleted.
I've traced all the way into drupal/core/lib/Drupal/Core/Action/Plugin/Action/DeleteAction.php where I added some temporary logging messages and see in executeMultiple() that the desired entities are being changed in $this->tempStore.
So it looks to me like the changes are being made in tempStore but then not being "committed" to the permanent storage.  I have looked for a "commit" type option in both drush and the vbo-execute command for drush and don't see anything.
Can anyone provide a clue?


texts: Uploading an image from a form in my custom module

texts:
I am creating a custom module where the user uploads and image to the Drupal DB using a form.  All the data except for the file is being put into the DB though.  The only thing that shows in the 'image' field is "[BLOB - 0 B]"  The only instructions/tutorials that I can find are for uploading files to a directory, not a table in the db.

function new_floor_map_form($form, &$form_state) {
    $form['new'] = array(
        '#type'     => 'markup',
        '#markup'   => '<h2>'.t('Start a new floor map:').'</h2>',
    );
    $form['#attributes']['enctype'] = 'multipart/form-data';
    $form['file'] = array(
        '#type'     => 'file',
        '#title'        => t('Choose a file'),
    );
    $form ['name'] =array(
        '#type'     => 'textfield',
        '#title'        => t('Name:'),
    );
    $form['active'] = array(
        '#type'     => 'checkbox',
        '#title'        => t('Set as current floor map?'),
    );
    $form['submit'] = array(
        '#type'     => 'submit',
        '#value'    => t('Submit'),
    );

    return $form;
}
function new_floor_map_form_submit($form,&$form_state) {
    if(isset($form['file']) && (!empty($form['name']))){
        $insert = db_insert('floor_map_images')
            ->fields(array (
            'image' => $form_state['values']['file'],
            'name'      => $form_state['values']['name'],
            'active'        => $form_state['values']['active'],
            ))
            ->execute();
    }

 }


texts: Tags won't show on Advanced Forum Module

texts:
I am using Drupal 7. I'm struggling to get the tags to show on my forums within the Advanced Forum module.

I have configured them within the manage fields settings

but they will not show anywhere else on my forum pages.
I have checked the Drupal listing here and tested both suggestions, still no change (even after clearing cache.)

What am I doing wrong or missing?

FYI: Please before suggesting any other tag modules, please help me with my current setup and Advanced Forum module. Thank you.


texts: How to Render / Print Values correctly from Custom Blocks using Paragraphs via Entity Reference?

texts:
I've been trying to render/print the data from my custom blocks using paragraphs via entity reference to my twig template. So far I've managed to test and successfully print the data to my twig using the code below

{% for item in node.field_sidebar_area %}

{{node.field_sidebar_area[loop.index0].entity.field_block_query.entity.body.value | raw }}

    {% for item in node.field_sidebar_area[loop.index0].entity.field_block_query %}

    {{ item.entity.body.value | raw }}

    {% endfor %}

{% endfor %}

If I tried using only this code below in printing the values from my custom block, it doesn't work

{% for item in node.field_sidebar_area[loop.index0].entity.field_block_query %}

{{ item.entity.body.value | raw }}

{% endfor %}

I have to set this code first before adding the for loop in order to fetch the data from the custom block

{{node.field_sidebar_area[loop.index0].entity.field_block_query.entity.body.value | raw }}


texts: I am trying to change output of some of the fields used inside my panelizer content, i.e node pages, but hook_preprocess_page( &$vars) is showing the output as rendered #markup and i just cant get hold of the render-able array for my content?any help please?


texts: Page always takes at least 30 seconds to load

texts:
I have a site set up on Godaddy and a constant frustration is that it always takes at least 30 seconds to load. Total time for queries was under 200ms. I decided to write the following script:

function getmillisecs() {
   list($usec, $sec) = explode (' ', microtime());
   return (double) $sec + $usec;
}

$start = getmillisecs();

define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$end = getmillisecs();

$result = $end - $start;

echo round($result * 1000, 3);

All it does is output how much time passes between the start and end of the script. The time I got was 30521.649ms. Taking out everything related to Drupal dropped the time to 0.089ms. What is causing the huge delay? Thanks.


texts: Search engine for Drupal site, Apache Solr or ElasticSearch?

texts:
Hello Drupal community,

I'm facing a issue for a new site that i'm developping. I need to implement a search engine and don't know which search engine to use between Apache Solr and ElasticSearch. It's the first time I do such work and I am desperatly in need of feedbacks from people who used it in there website and who can tell me the difference it makes in a Drupal site.

Edit : I want a new one to display a search bar in the front office to index all the content of the site in a special way. I also want the results to be displayed right away.

Thanks in advance.


texts:
Everytime I log in into the Drupal site there is a resume of the posts that I have written. I would like to modify it and show all the accumulated views of each user post.

I plan to use the Views UI to make the query but I am not sure which file modify to change the admin site.

Thanks.


texts:
I need to search by taxonomy terms. This is pretty straight forward, but my case is somewhat special. I need to see results that contain only all tags.

for instance I would like to be able to search for a recipe that contains beef, carrots, and onions only. Recipes containing just beef and carrots, or beef and onions, would be fine too, but something that has all tags and something else would be unacceptable.

Drupal and views seem to be completely incapable of handling this scenario.
Any advice?

Thanks,


texts: making a views grid go from right to left?

texts: I have views, that I need placed differently. normally the images in a grid view show from left to right, but I need them the other way. How can i set a grid to show starting from right to left instead of left to right?


texts: How to link to Entityform submissions page?

texts:
I am using an Entityform in a block to enable site users to submit enquiries to owners of holiday cottages. I need to be able to allow owners to view those enquiries.

Each holiday cottage has its own page and the Entityform appears on each of those pages.

I have created a submission reports view that will list the enquiries for a specific property.

I have also used Views to create a block to appear on the page of each holiday cottage, visible only to the logged-in owner of that cottage, containing a link for the owner to click on to “View enquiries”.

My problem is what link should I use to display the submissions? I have tried the link "entityform_types/manage/accommodation_contact/submissions” to be found under the ‘FORM SUBMISSIONS’ tab, but without success.

I have also read through all the documentation for Entityform that I can find as well as all issues relating to submissions here.

Any help or guidance would be much appreciated.


texts:
Drupal 6 and LDAP Integration the configuration was easy: Check "Groups exist as LDAP entries where a multivalued attribute contains the members' CNs" + set groups DN to "ou=Groups,dc=htrueta,dc=intranet" and "Attribute holding group members:" to "memberUid".

but in Drual 7, if I need do the similar configuration,  do not know what I need pick for each selections such as  name of group object class, attribute in user entry containing groups, ldap group entry attribute holding user's DN, CN, etc,  user attribute held in "LDAP Group entry attribute holding..." and so on

thanks,


texts: List items of a certain content type in another content type

texts:
For college we have to create a website with drupal. This website has to be for a travel agency that does surf vacations. We already have the  basic website up and running but are kinda stuck with the destinations.

I will quickly explain how the website should be set up and our problem.

So bassicly a customer should be able to go to the page called "Destinations" and have a list of the 4 available countries where they could book a vacation. Like for example you have Australia and Costa Rica. However when a user clicks on for example Australia he should get a new list of possible locations within this country where he wants to go surf.

We have tried with many different ways to get this to work the problem however is that both the countries and local destinations should have a picture and a short description. Also the user should be able to select their "level" on the specific location.

What we have tried:

Taxonomy: We have tried using taxonomy but it doesn't allow us to give the right design to the website. It will list the countries but without any description or picture.

Ubercart: I wish this would have worked but somehow you can't create subclasses in ubercart or just only show a list of classes with views.

Thank you for taking your time and we hope to find a solution soon.

Kind regards.


texts: Only one of my site node's doesn't print it's alias

texts:
I use the latest version of the famous Pathauto module and my site pages have Automatic alias that are shown well in the URL navigation bar of the browser... All of these pages are in Hebrew, But one of the pages which is in English, doesn't show it's alias and only node/20 is being printed...

For example you could go on all main-menu links and see it, instead of that one...

Here is a live example in my site.

What can cause it? Thanks!


texts: Copy filefield image to different filefield field

texts:
I am upgrading an older D6 site to D7. Way back we made the mistake of creating separate image fields for different content types. So instead of just creating a field field-image and reusing it, we have a field-event-image, a field-testimonial-image and so on (and a field-image). Well, besides the excess clutter, we need to create a view that shows a flexslide that sources nodes from multiple content types and it only allows one image field. So I would like to move all the images into the field-image field. I have seen a number of potential ways to achieve this result but no luck so far. Using migrate module is probably the most elegant, but seems over my head. VBO with Rules seems good and I have seen some examples but I get stuck creating the rule.

Any suggestions to my dilemma? Thanks


texts: Check access to entity for logged in user in Drupal 8

texts:
I have added private message module for one of my project which has it's own entity. I need to check whether the user is having access to that entity content or not. The module has it's menu item defined in the module's routing.yml

e.g.:

entity.private_message_thread.canonical:
  path: '/private_messages/{private_message_thread}'
  defaults:
    _entity_view: 'private_message_thread'
    _title: 'Private Messages'
  requirements:
    _entity_access: 'private_message_thread.view'

How could I check whether the user has view access to the above menu path?


texts:
Suppose we have 20 webforms A user which has Admin role as well User1 role should  only view its corresponding webform (eg: weform1 and webform2)rest webform should not display at(admin/content,/admin/content/webform) when he logged in as a user which is having User1+Admin role.

How to achieve this?


texts: facets not showing all the options drupal commerce

texts:
Go to this page if you take a look to the facets at the sidebar you will notice that they are not displaying all the available options.

When I search 1 word at the search bar for example "tract" then the facets work as expected, but when I use 1 or more words the facets does not display all the options... Does any body have had this issue before with Facets of Drupal commerce?

Any suggestions?


texts:
I am trying to make a block visible only to pages whose URL matches user/[current-user:uid]/downloads, but I don't get anywhere.

Do you have any idea on how to achieve this?


texts: How do I merge changes from a development copy of the site to the live site without losing new content?

texts: What is the best procedure for merging work done on a development copy of a site to the live production copy? Often times there has been a lot of new content added to the site since development started on the newest features. And most additions to a site will involve database changes. So copying any new files is easy, but what about the database? How do you merge your changes with the existing production database without losing new content that was added since the last time you updated the production site? Are there any modules that help with this?


texts: What is the best way to tell anonymous users apart?

texts:
My company wishes to split their website so that anonymous users are given slightly different sites based on a question when they first visit.

I intend to use a cookie to store the answer to the question between sessions, but I'm wondering what the best way is to use that answer once the user is browsing the site?  I intend to use page manager to handle the context but I'm still trying to determine where it should be stored:

Cookies can be turned off by the user, or the IT department, much of our target audience have policies restricting or outright banning cookies
Session variables seem to be the way to go, unless:
Does the Global $user variable store different information for each anonymous visitor?

Are there downfalls in either of the latter two options?  Have I missed any options?


texts:
What is the best protocol for uploading images in batch via FTP?

Let's say my website has 3 images.

Original size is 1000x1000

I upload all images via backend as "image upload".

Later on, I want to substitute all 1000x1000 images with identical images with same name but at size 400x400.

Curious as to what is the best workflow for Drupal for this scenario.


texts:
I have a multilanguage site. Now i'm running in the issue that some pages don't have translations. So i would like to hide that from the navigation.

I already tried to manipulate it with that hook:

mytheme_preprocess_menu_local_task

But it seems that it does not have an affect. I also don't find any other hook which i could use for that.

Any suggestion?


texts: How to do integrate javascript in drupal way

texts:
I want to integrate this Flex Slider code to drupal but without success. Please help.
here is the code

if($('#homeSlider').length > 0) {

    var hIndex = 0;
    var $hCap = $('#homeSlider').find('.captions').children('li'), $hSlides, $hPrev, $hNext;

    $('#homeSlider').flexslider({
        animation: 'slide',
        animationLoop: true,
        slideshow: true,
        slideshowSpeed: 7000,
        smoothHeight: false,

        controlsContainer: $('#homeSlider').find('.thumbs'),
        keyboard: true,
        controlNav: false,
        start: function(e){

            $hPrev = $('#homeSlider').find('.flex-prev');
            $hNext = $('#homeSlider').find('.flex-next');
            $hSlides = $('#homeSlider').find('.slides').children('li');

            $hPrev.append('');
            $hNext.append('');

            $hPrev = $hPrev.find('img');
            $hNext = $hNext.find('img');

        },
        before: function(e){

            $hCap.eq(hIndex).fadeOut(200);

            var prev = hIndex - 1 < 0 ? e.count-1 : hIndex - 1;
            var next = hIndex + 1 > e.count-1 ? 0 : hIndex + 1;

            hIndex = e.data('flexslider').animatingTo;
            $hCap.eq(hIndex).fadeIn(500);

            changeThumbs(prev, next);

        }
    });

    function changeThumbs(prev, next){
        $hPrev.prop('src', $hSlides.eq(prev).data('thumb'));
        $hNext.prop('src', $hSlides.eq(next+2).data('thumb'));
    }

}


texts:
I have a task to build a series of websites all related to the same core business.

Initially, I was going to build each one as a separate website.
Later however, I was told the sites have to be able to share content which changed my plans.

Going by the logic that the easiest way to build multiple Drupal websites which share content is to build one site and make it work and appear as many.

So, I decided to build the site in Organic Groups but I have the following functionality challenges.

How can I direct unique URLs to individual Groups on my site. I:E configuring www.mysite.co.uk to visit Group#1 and www.mysite.com to visit Group#2 etc
Is there a way to create content on the Drupal site which can optionally be shared/posted to one or more of my Groups? The idea is to create content on the primary 'website' and the same content displays in the Groups/'sub-sites'.

I would appreciate any suggestions.

Thanks.


texts: Meta tags don't work for "custom content type"

texts:
The keywords and descriptions I type show up on all standard pages (articles, basic pages, etc), but they do not show up on any custom content types. All I see are the default meta-tags without the keywords and description that I type. My website contains several custom content types and all have the same behavior. I tried a few different themes and they are still missing.

Someone suggested to add render($content['metatags']); to see the meta-tags.

Can anybody suggest to which file I need to add that line? I am creating the custom content type using the admin panel in Drupal 7.


texts:
In Drupal 7, in the body tag of my English home page, I see the following CSS classes (among others): html, front.

I added a French translation for this home page by clicking on the "translate" link. The body tag of my French home page has the following CSS classes (among others): html, not-front.

For the French version, how do I substitute the CSS class "not-front" with "front"?


texts:
I have a site (Drupal 8.4.2) that has Bootstrap and a subtheme located in:

/sites/themes/

With the upgrade from 8.3 to 8.4, I have started using Composer, and subsequently used Composer to upgrade Bootstrap. This added it to my composer.json (I'd previously installed Boostrap using drush), but also put the updated version of Bootstrap here (without touching my existing Bootstrap folder):

/sites/themes/contrib/

I removed my existing Bootstrap folder and cleared the cache. However, I can no longer manage the Boostrap theme or my subtheme - I get a 500 error like this:

  PHP Fatal error:  require(): Failed opening required '/var/www/html/drupal/mysite/themes/bootstrap/src/Bootstrap.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/drupal/mysite/vendor/symfony/class-loader/ApcClassLoader.php on line 110

The issue, clearly, is that it's looking for Bootstrap in the old location. The question is - what do I need to do to ensure my site finds Bootstrap in the correct folder? Moving the updated version of Bootstrap from contrib/ to where the original version was located fixes the problem for now, but I'd like to fix it permanently.

I assume there is a config value somewhere that isn't being touched by clearing the cache.


texts: How to add css immediately (display:none) to a block created through hook?

texts:
I created a block through drupal hook_block_info (and hook_block_view, but this doesn't really matter)

function mymodule_block_info() {
  $blocks['menu_mobile'] = array(
    'info' => t('Mobile Menu'),
    );
  return $blocks;
}

I need it to be hidden initially and then to show on webpage resize/mobile.
I did this by applying a display:none to css and the media rule

@media screen and (max-width: 768px)

It works. Almost Perfectly. The problem is that, at the very beginning of webpage loading, the block is visible and, for maybe a second, it shows on its webpage, then the display:none does its work hiding it. It is annoying. I saw here some properties of the array to be returned by the hook, but none really fits my case. For example, enabling/disabling hides the block, but i don't really know how or when to show it again.

https://api.drupal.org/api/drupal/modules%21block%21block.api.php/function/hook_block_info/7

So, how i can have the block initially hidden, or fasten the display:none (that is contained in the style.css of my custom theme)?


texts: Where can I see screenshots of various themes?

texts: On Drupal.org, there are literally hundreds (perhaps thousands) of themes. As far as I can tell, the only way to actually see what a theme looks like is to install it. (Some of them have screenshots of the actual theme, but many just have what the creators apparently believe to be a cool logo, which really doesn't help much in determining what the theme itself looks like.) Is there a gallery somewhere that contains screenshots of all the themes?


texts: Form selection with radios, ajax and taxonomy terms

texts:
In my form i get the message: "An illegal choice has been detected. Please contact the site administrator." after i didn't select a radio box in the 2nd form. How can i avoid this? NULL doesn´t work and key($type_2) works only for the first call. If I changed the selection in the first form I must select a radio box in the 2nd form. If I don't do this, the message comes and I can`t change the selection of the 1st form ... hope I could it little bit explain.

  $default = isset($input) ? $input : NULL;
  $form['step_2']['options']['type'] = array (
    '#title' => t('Types 1'),
    '#type' => 'radios',
    '#options' => $type, //get the array from a Taxonomy
    '#default_value' => $default,
    '#required' => TRUE,
    '#attributes' => array(
      'class' => array('clearfix'),
      'onkeypress' => array(
        'if(event.keyCode==13){this.form.submit();}'
      ),
    ),
    '#ajax' =>  array(
    'callback' => '_type_ajax_callback',
    ),
  );

  $default_2 = isset($input_2) ? $input_2 : key($type_2);
  $form['step_2']['options']['type_2'] = array (
    '#title' => t('Types 2'),
    '#type' => 'radios',
    '#options' => $type_2, //get the array of the Taxonomy which is referenced in the 1st Taxonomy
    '#default_value' => $default_2,
    '#attributes' => array(
      'class' => array('clearfix')
    ),
    '#ajax' => array(
      'event' => 'change',
      'wrapper' => 'calc-wrapper',
      'callback' => '_type_2_ajax_callback',
      'method' => 'replace',
      'keypress' => TRUE,
    ),
  );

  function _type_ajax_callback(&$form, $form_state) {
    return array(
      '#type' => 'ajax',
      '#commands' => array(
        ajax_command_replace("#floor-options", render($form['step_2']['options'])),
      )
    );
  }

Maybe i need to recreate the $type_2 array, but I didn`k know how i could do this. Need I an extra value recall in the ajax callback?


texts: Hide a block depending on the value of a field?

texts:
I have put a block in the taxonomy pages.
I have added a new field to the vocabulary with two states: shown, hidden.
I want that when in taxonomy term I select hidden, the block to be hidden.

So I can display or not a block depending on the categories.

I've tried with this code in the block visibility options,  but it does not works:

global $field_show_block;
return ($field_show_block == "show");

Any ideas?
Can it be done with Views?

Thank You


texts:
I'm trying to implement a full screen bootstrap carousel base on this tutorial. He mention to use the jQuery version 1.11.1. And I was wondering what is the best way to upgrade to this version. I'm currently using the jquery_update module but this module does not have the ability to upgrade to jQuery version 1.11.1.

I believe that I can use the CDN by pasting the below code in the my page template.

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

But I'm looking for the best practice to insert this jQuery version 1.11.1 on my Drupal site ?

In 2012 a similar question was ask "How do I update jQuery to the latest version I can download?" and one of the solution was to use the module [jQuery Multi] to have different version of jQuery.4

Anyway what it the best method to update jQuery v1.11.1 ?


texts: 8 - Manually adding a user field will delete all programmatically added user fields

texts:
In my module i programmatically add user fields for the website owner instead of instructing them to do so. Here's an example of the code i used which runs in mymodule.install:

function openid_connect_entity_base_field_info(EntityTypeInterface $entity_type) {

if ($entity_type->id() === 'user') {
    $fields['field_birthdate'] = BaseFieldDefinition::create('string')
      ->setLabel(t('Birthdate'))
      ->setDescription(t('Add a description'))
      ->setRevisionable(TRUE)
      ->setTranslatable(TRUE)
      ->setDisplayOptions('form', array(
        'type' => 'string_text_field',
        'weight' => 30,
        'default_value' => 0,
      ))
      ->setDisplayConfigurable('form', TRUE);
  }

return fields;
}

but if you add a field manually all the programmatically added fields will be deleted as shown:

programmatically added fields before adding one manually

Adding a field manually

And boom all the programmatically fields are gone!

If this is a bug in the drupal 8 framework where do i report this?


texts: Need to hide a field for the node author

texts:
For a particular content type education i need a field to be hidden for the node author. It works in the template file but not with preprocess. This is my code

 function aapka_preprocess_node(&$variables){
     $node = $variables['node'];
     if ($node->type == 'education'){
     if ($node->uid == $user->uid && $user->uid != 1) {
 unset($variables['content']['field_college']);}
  }

What am i doing wrong??


texts: SimpleOAuth unable to find Client Id when attempting to Authorize

texts:
I'm trying to use SimpleOAuth to allow another service to login using my drupal user. I went ahead and created a client and all that fun stuff, but when the other site tries to authorize the current drupal user at the url: https://mysite.org/oauth/authorize?client_id=.... and the site is just redirected to an error page with an error saying the client_id was not found.
I double checked and all the credentials are correct. Am I navigating to the wrong authorize url, what's wrong here?


texts: Add validation on views bulk operations form

texts:
I have a content type on which I added a custom validation that there can't be more than 7 items of that content type that is marked as 'sticky'.  That validation was added on the add and edit pages through omhm_mod_form_blog_node_form_alter(&$form, &$form_state, $form_id) with the line $form['#validate'][] = 'omhm_mod_form_nouvelle_node_form_validate'; and my custom validation omhm_mod_form_nouvelle_node_form_validate.

Now I have to make a page with views bulk operations with the same custom validation in place ... how can I do that ?

I'm trying to add the custom vbo validation views_bulk_operations_form_validate($form, &$form_state) to my omhm_mod_views_bulk_operations_form_alter($form, &$form_state, $form_id) hook with the line $form['select']['submit']['#validate'][] = 'omhm_mod_carrousel_views_bulk_operations_form_validate'; but nothing happens.


texts: reset existing content type settings to default settings

texts:
In my Drupal 7 Site, I have a couple of Nodes of the same content type. On some of them, the settings( Menu, Sitemap) have been changed.
How can I reset all of them to the default settings for that content type?
thanks in advance


texts:
I have a webform with a popop date the problem is the date in the textbox is shown in the format

2014-7-30

it need it to be

30/7/2014

how can I change this?


texts: Set value of file field using entity_metadata_wrapper non working

texts:
I have a custom entity with a file field accepting multiple values.
I would like to set file values according to
https://www.drupal.org/docs/7/api/entity-api/entity-metadata-wrappers#example-value-set-save but none of the two methods are working here.
I always get this error

error  php  Error: Call to a member function set() on null in include().

I am running Drupal 7, file_entity module enabled. Here follows the code:

$file = file_load(8172);
$wrapper = entity_metadata_wrapper('sys_ind', 13718);
$wrapper->field_allegati->file->set( $file );
$wrapper->save();


texts:
How can I alter services views result. Using services view I can easily produce Json data.
I have tried function hook_views_post_execute. This hook is working for simple views but not with services Views(Json data).


texts:
I am trying to use the Date module in a module I am writing, but I get the following errors:

  Warning: Missing argument 1 for myform_data_entry_form() in myform_data_entry_form() (line 28 of D:\wamp\www\drupal\sites\all\modules\myform\myform.module).
  Warning: Missing argument 2 for myform_data_entry_form() in myform_data_entry_form() (line 28 of D:\wamp\www\drupal\sites\all\modules\myform\myform.module).

This is the code I am using in my module.

function myform_help($path, $arg) {
switch ($path) {
      case "admin/help#myform":
        return '<p>'.  t("Displays links to nodes created on this date") .'</p>';
        break;
    }
 }

function myform_menu() {
  $items['myform/data_entry_form'] = array(
    'type' => MENU_CALLBACK,
    'access arguments' => array('access content'),
    'page callback' => 'myform_data_entry_form'
  );
  return $items;
}

function myform_permission(){
  return array(
    'access myform content' => array(
      'title' => t('Access content for the myform module')
    )
  );
}

function myform_data_entry_form($form,&$form_submit) {
  $form['curdate'] = array('#type' => 'date_popup', '#title' => 'Date', '#date_format' => 'd/m/Y');

  return $form;
}


texts: No menu link is working after the website is deployed on hosting server

texts:
I developed a website in the drupal and I have been accessing it in the development environment using the url like this "http://localhost/foldername"...

Now I have deployed the website (the folder "foldername" and database) to my Linux based hosting server.

I have to access it for testing using a URL like this "http://HostingServerIpAddress/~HostingServerUserName/foldername".

To my surprise, no menu link is working over there :( the paths are correct. The menu links which were opening in my local environment, are giving 404 error when opened using hosting urls... :(

Please guide me at your earliest.


texts:
I have the following index and paragraph fields checked off as my paragraph field is called field_content. However when I do a search for something inside these paragraph fields. I'm not getting any results.

Is there a way to debug if it indeed is crawling my paragraph fields? Or is there another setting that I might be missing since I'm attaching the paragraph entity to the Basic Page content type. Does Search API even go into the sub-entity and crawl that aswell?