texts:
I have a Drupal 7 view page where I want to change the behaviour of the submit button by using the jQuery code below. How do I do this in Drupal 7?

$('#reset-button').click(function() {
  $('#views-exposed-form').each(function() {
    this.reset();
  });
  $('#submit-button').click();

  return false;
});


texts: How to disable creation of node revisions on programmatic node update?

texts:
I added a field of type computed field to existing nodes. It's required to re-save the nodes to set/update computed field values. As I do not want to update the changed timestamp I decided to not use the views bulk update to resave content. The easiest way would be a drush script, that way I can re-save content whenever it is necessary.

My first problem was that I was not able to leave the changed time unchanged on update ($node->save()). But I found that it could be re-set on a second node save.

My problem is that on each node save a new revision gets created. The node type is revision-able and beside the core module content moderation is enabled. I would appreciate any help on how to prevent the creation of revisions.

This is my current drush script in custom_helper.drush.inc:

<?php
/**
 * @file
 * Provides drush command to update all articles.
 */

use Drupal\node\Entity\Node;

/**
 * Implements hook_drush_command().
 */
function custom_helper_drush_command() {
  $items = array();
  $items['custom-resave-content'] = array(
    'description' => dt('Resaves all article entities.'),
    'options' => [
      'types' => dt('Coma separated list of content type to be resaved.'),
      'nids' => dt('Coma separated list if node ids.'),
      'field' => dt('Machine name of computed field to be updated.')
    ],
    'aliases' => array('custom-rc'),
  );
  return $items;
}

/**
 * Moves paragraphs into one paragraph reference field.
 */
function drush_custom_helper_custom_resave_content() {
  $nids = _convert_csv_to_array(drush_get_option('nids', []));
  $types = _convert_csv_to_array(drush_get_option('types', []));

  if (!$nids || $types) {
    // Get an array of node IDs.
    $query = \Drupal::entityQuery('node');
    if ($types) {
      $query->condition('type', $types, 'IN');
    }
    if ($nids) {
      $query->condition('nid', $nids, 'IN');
    }
    $nids = $query->execute();
  }

  // Load all the nodes.
  if ($nids) {
    $field_name = drush_get_option('field', '');

    $nodes = Node::loadMultiple($nids);
    foreach ($nodes as $node) {
      $entity_type = $node->getEntityType();
      $original_changed = $node->getChangedTime();
      if ($entity_type->isRevisionable()) {
        $node->setNewRevision(FALSE);
      }

      // Force update of computed field.
      if ($field_name) {
        /** @var \Drupal\Core\Field\FieldItemListInterface $items */
        $items = $node->get($field_name);
        if (empty($items[0])) {
          $items->appendItem();
        }
        $items->preSave();
      }

      // Save the updated computed field value.
      $node->setChangedTime($original_changed);
      if ($entity_type->isRevisionable()) {
        $node->setNewRevision(FALSE);
      }
      $node->save();

      // Reset changed time to original value.
      $node->setChangedTime($original_changed);
      if ($entity_type->isRevisionable()) {
        $node->setNewRevision(FALSE);
      }
      $node->save();

      $changed_after = $node->getChangedTime();
      drush_print('node:' . $node->id() . ':' . $original_changed . ':' . $changed_after);
    }
  }

  drush_log(dt('Resave finished.'), 'ok');
}


texts: Library not being attached to the field form

texts:
So I have a module that defines a custom field which I need to style.

It seems the right way to accomplish is to define a library in my module and then refer to it through the '#attached' property.

Which I did, but the css file is not being loaded (I've cleared the cache, reinstall the module, no avail.) No network error, or other error of any kind. The file just isn't loaded.

Here's the relevant parts of my code:

swan_fields_pt_zipcode.libraries.yml

zipcode_widget:
  css:
    component:
      'css/zipcodewidget.layout.css': {}

swan_fields_pt_zipcode.info.yml

name: Swan Fields PT ZipCode
type: module
core: 8.x
libraries:
  - 'swan_fields_pt_zipcode/zipcode_widget'

WidgetInterface implementation:

public function formElement(
  FieldItemListInterface $items,
  $delta,
  array $element,
  array &$form,
  FormStateInterface $form_state
) {
  // ...
  // ...form definition and stuff

  $element['insidecontainer']['#attached']['library'][] = 'swan_fields_pt_zipcode/zipcode_widget';
}

What am I missing?


texts: How do I find out which base fields are available for an entity type?

texts:
If I have an entity type id as a string, how I can tell which base fields are defined for that entity type?

For example, how do I programatically check that an entity type has the "changed" field?


texts: How to target the "site name" within a css file

texts:
How does one target the site name (the one that appears immediately below the site logo) within a css file? I would like to both change the color of the site name text in addition to centering the site name (for some reason it's by default confined to about a third of the header space on the left). Essentially, how can I style the space above the menu region if it is not part of the header region?

Any help would be much appreciated. If you find what I've written to be vague I can certainly try to clarify.


texts: How can I use $_SESSION in form handler drupal 8?

texts:
I create a module that has form . I want send data from other form to this form and show them . How can I save previous data in my form and show new data ?

For example I send number 1 to my form and form show 1 , then send number 2 and form show 1 and 2 , and then send number 3 and my form show 1 and 2 and 3 .

Then I want send this data ( 1 and 2 and 3 and ... ) to other page with my form . how can I do this ?

My sender form :

<form action="/form" method="post">
   <input type="text" name="number" />
   <input type="submit" value="GO" />
</form>


texts: Drupal7 creating breadcrumb from url of custom page template

texts:
I have a template file: called: page--movies--movie-details.tpl.php

which make my url: http://mydomain.com/movie/movie-details/

question is: How can i make my own breadcrumb using that url:
My breadcrumb should like this:

ex: Home > movie > movie details

how can i do that in drupal7?

thank you.


texts:
I would like to assign some content from a node, lets say the body field, into a region. so I cannot theme this content in my node.tpl.php

In the template_process_page(&$vars) i can easily set $page['my_region'] = HTML.

with $vars['node']->body i can access to my body field dada. from there I would like to use the regular theme function to render the body field. to use theme('field',$variables) or render($variables) I need to bring the body-array from:

Array
(
    [und] => Array
        (
            [0] => Array
                (
                    [value] => TEXT
                    [summary] =>
                    [format] => full_html
                    [safe_value] =>  TEXT
                    [safe_summary] =>
                )

        )

)

to sth like:

Array
(
    [#theme] => field
    [#weight] => 1
    [#title] => Body
    [#access] => 1
    [#label_display] => hidden
    [#view_mode] => full
    [#language] => und
    [#field_name] => body
    [#field_type] => text_with_summary
    [#field_translatable] => 0
    [#entity_type] => node
    [#bundle] => article
    [#object] => stdClass Object
        (...)
    [#items] => Array
        (
            [0] => Array
                (
                    [value] => TEXT
                    [summary] =>
                    [format] => full_html
                    [safe_value] => TEXT
                    [safe_summary] =>
                )
        )
    [#formatter] => text_default
    [0] => Array
        (
            [#markup] => TEXT
        )
)

But I don't know how exactly.  how can a generate my field with the second array-achitecture. if possible without more db-queries.

thank you for help!


texts: For an event node type, should I use Datetime or Datestamp?

texts: I'm about to create a node type event and have to choose between three different date formats, Date, Datestamp and Datetime. I've read how they are stored differently in the database, but that doesn't explain to me which is best for an event node type. Well, not exactly, from what I understand the Date format doesn't store time so that can't be used. I'll be using views to sort events if the make a difference. Which format would you use and why?


texts: How replace a node term programmatically?

texts:
I have a vocabulary (this is a workflow vocabulary) and another vocabulary attach to a node.

How can I replace workflow term by single another workflow term without change some other vocabulary ?

Something like this ?

$old_terms = taxonomy_node_get_terms_by_vocabulary($node, 23);
foreach($old_terms as $tid => $old_term){
  unset($node->taxonomy[$tid]);
}
$new_term = taxonomy_get_term(30);
$node->taxonomy[$new_term->tid] = $new_term;
node_save($node);


texts: Attaching CKEditor to E-mails subject and body?

texts:
I have installed Mime Mail and am looking at formatting my emails (at admin/config/people/accounts) before sending them to users. How do I attach CKEditor to the E-mail subject and body sections?

Cheers


texts:
i searched for long time for a solution to make a chat room per node, i want to display a chat room as a field in my content type.

Is there a module for that?
Is there is not there is a php code or java script that can added in a field to display it?
thanks.


texts: How can I create a custom html tag in the CKeditor wysiwyg editor?

texts:
I've created a custom HTML tag that pulls information from my database and displays it. Basically it uses preg_match_all to parse the body of articles for <profiletag>Person Name</profiletag> and replaces this tag with html of the person's profile.

Now what I want is to allow my writers to insert this HTML (<profiletag>Person Name</profiletag>) from the WYSIWYG editor rather than having to go into the source and insert a tag into the html. When they write <profiletag> etc. in the WYSIWYG editor obviously it gets all messed up. I'm looking for something like [profile]Person Name[/profile] markup for them to include these tags in the WYSIWYG side.

Is this possible, and if so how can I implement this functionality?


texts: Using existing term reference field vs. creating new ones

texts:
I have 3 content types (blogs, photos, videos) that all reference the same "topic" vocabulary.

When I add the term reference field to each content type I can either create a new field "field_blog_topic", "field_photo_topic" and "field_video_topic" for each of the types.

Or I could create a "field_topic" field for blogs and then use that existing field for the photo and video content types.

Would it make any practical difference?


texts: How can an author mark the update date of a node to be visible or hidden for visitors?

texts:
I want to let the author to specify whether node update date should be visible to visitors or not, per node (not node types) with a checkbox at node insert/edit form?

Update:
I know how to use fields but I considered using something other than a new field. Something like variables.

Because I just want to save a simple Boolean value and I think fields will push an unreasonable overhead to Drupal for such a simple task.


texts: How to grant user User Points after publishing content, while content's default is unpublished?

texts:
I'd like to grant users User Points when their added content of the content type 'Content', which is unpublished by default, is published. I tried this with the Rules module:
- Event: After saving new content
- Elements:
  * Content is of type: Content
  * Content is published
- Actions: Grant points to a user

So, when a user adds 'Content' content, they don't get any User Points and their content is unpublished. My idea was that they'd be granted the points after I - as moderator - had published their content. But apparently, they don't get points after I've done that with the rule I set up. What did I do wrong and how can I solve this?


texts: How to change a grouping field in a view programmatically?

texts:
I've added a custom field to a view and want to display results as a grid grouped by this field. How do I set that "Grouping field Nr.1" option in my code? I tried the following but it doesn't work (probably I'm doing it in the wrong place or change wrong setting...)

function MYMODULE_views_query_alter(&$view, &$query)
{
    $view_name = 'MYVIEW';
    $display_name = 'MYDISPLAY';
    if ($view->name == $view_name && $view->current_display == $display_name)
    {
        $custom_field = 'field_MYFIELD_value';

        //code piece adding this field to a view's SELECT statement, sorting by it etc

        $style_options = $view->display['default']->handler->options['style_options'];
        $style_options['grouping'][0]['field'] = $custom_field;
    }
}


texts: Have a child node inherit taxonomy from a parent during /node/add?

texts:
In Drupal 7, I have two content types:

Parent Events with tags (like "outdoors" or "popular" or "suitable for kids"). "Tags" are taxonomy terms in a vocabulary, connected via an Entity Reference field field_parent_tags (using the Checkboxes widget).

Child Events with the same tags & reference in field_child_tags. Each Child also has a mandatory Entity Reference to a Parent Event, field_parent_event (using the Autocomplete widget).

I'm trying to have new Child Events automatically inherit their parent's tags when they're first created. For example:

There is a Parent Event called "Weddings", which has the tags "suitable for kids" and "popular".
When I make a new Child Event called "Joe & Sarah's Beach Wedding", I'd like it to automatically inherit the tags "suitable for kids" and "popular". Then I'd add the "outdoors" tag to this specific child event, which would apply only to this child and not the parent.
(Another child event might be someone else's wedding, and not suitable for kids, so I'd uncheck that in the child event).

How would I go about doing that? So far, I think I need to implement some variation of hook_form_alter(), possibly overriding its #ajax call so that as soon as the child event's form_parent_event is filled out, its field_child_tags will copy the values from field_parent_tags.
Am I going down the right path? I can't figure out where to put that code, if so. I tried overriding /node/add/childevent using a page--node--add-child-event.tpl.php file, but it seems to have no effect. A little lost :(
Any help would be very much appreciated. Thank you!


texts: Adsense tokens "[adsense:XxY:SlotID]" in node content aren't being replaced by ads

texts:
I've added adsense tags in my node body/content and I'm using Full HTML as text format.

For this Full HTML ipnut format I've enabled "replace adsense tags".
I've also given it the highest "Priority" so that it is done before anything else related to formatting node content.

In the end, adsense tokens are printed as is "[adsense:XxY:SlotID]" and no ads. From developer console I can see one error that states:

TagError: adsbygoogle.push() error: All ins elements in the DOM with class=adsbygoogle already have ads in them.

I'm quite sure that if these tokens were replaced by ad markup that error wouldn't show up in the developer console.

And to be honest, I'm not sure which modules is responisble for formatting adsense tokens into adsense markup i.e. which modules provides.


texts: Webform dynamic select options based upon another element's state

texts:
Say there are two select elements with dynamic options (via an options alter hook, sourced from an external resource): A and B.  There is also a datasource that provides a relationship that determines the options in B that should shown when a particular selection in A is chosen.

The source data for each element in addition to the relationship data source is not able to be predicted or controlled by Drupal.

For example:

A Options at a particular instant

| name | code |
| Group 1 | 1 |
| Group 2 | 2 |
| Group 3 | 3 |

B options at a particular instant

| name | code |
| Thing 1 |  1 |
| Thing 2 | 2 |
| Thing 3 | 3 |

The relationships at any given time.

| group | thing |
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 2 | 1 |
| 2 | 2 |
| 3 | 3 |

So if group 1 is selected for A, then things 1, 2, and 3 should be options for B

If group 2 is selected for A, then things 1 and 2 should be options for B

If group 3 is selected, then only thing 3 should be an option for 3.

We are currently implementing this requirement through the core FAPI and ajax callbacks, but would like to covert it to use Webforms.

What would be the recommended approach to take in order to solve this with Webforms?  Please bear in mind that modifying the source data is not an option, as it is not able to be predicted nor controlled by our unit and adjustments must be reflected in realtime.


texts: #default_value Not Working In Select Field

texts:
First off, I have tried to do my homework before coming here. I have referenced this, and this and I still cannot get my code to work.

I am simply trying to set a default value in a select form field on a Drupal 8 block configuration form. Here are the relevant parts of my code:

$options = array(
  'test' => 'value',
  'random' => 'string',
  'kiwi' => 'pear',
);

$form['menu_selected'] = array(
  '#type' => 'select',
  '#title' => 'Test Title',
  '#description' => 'Test Description',
  '#options' => $options,
  '#default_value' => 'random',
);

The $form then gets returned as per usual in a block build. Everything else works in the form; The options populate, the description and title display. The only thing that doesn't work is the default value. I have tried using keys and values. I even saw a comment that said to use '#value' instead of '#default_value' and still it didn't work. Can someone please tell me what I'm doing wrong? I can provide more code if needed.


texts:
Is it possible to make a node reservable (for users that do not have rights to edit/add content, or even anonymous users)? The node in this case is a "timeslot" for a service.

So there would be lots of nodes and each node could only be reserved once. At reservation time the person making the reservation should give his/her contact details. No payment or anything like that is made at this point.

I found the tutorial about Using webfom 3.x to reserve items/nodes in Drupal 7 (using the Webform module to "reserve a node"), but not sure if it is the best way (I am looking into it).

Or if anyone can just point me into the right direction, would be appreciated.


texts: How do I implement hook_page_alter() in a module?

texts:
I'm trying to add a piece on content to the $page['content'] variable, but it's just not working and the examples are not helping me. My code is the following:

function my_modulename_page_alter(&$page) {
    $page['content'] = $extracontent . $page['content'];
}

dpm() doesn't allow me to see the available variables. What am I doing wrong?


texts: How to create user profile preferences for fields visibility?

texts:
In my case every registered user should have possibility to change his profile fields visibility settings.

Selected field can be visible by all user, visible by friends or visible to no one.

I think Field Permissions module won't help me much in this scenario.
Maybe OG? I've never used it so I have no knowledge.

There is always coding way: hook_field_access() but I want to avoid it if possible.

Looks like I've found one: https://www.drupal.org/project/user_field_privacy

but this not support Profile2: https://www.drupal.org/node/1398586

Integration with Profile2:

https://www.drupal.org/sandbox/miki/1601986

Other module:

https://www.drupal.org/project/profile2_privacy


texts: Why do all my field IDs have "--2" as a suffix?

texts:
On my registration form, the field IDs used to be edit-field-first-name, etc. Now all of a sudden they are edit-field-first-name--2.

Every single field has the --2 suffix.

I updated all my styles to reflect the new IDs, but then I noticed that if I submit the form with an error, the repopulated form now has no such suffix, and all of the styles are broken.

What can i do to get rid of this suffix permanently?


texts: How to decode Chinese characters in while exporting to CSV from views data export module?

texts: I have used Views Data Export module for CSV exporting in views. It works fine but its not able to decode non-latin languages. I didn't find any configuration also in views data export settings. Only it has pre-selected UTF-8 configuration. Can anyone faced this issue? Any help will be appreciated.


texts:
I have a content type "abc". I have a field "listing id". I want this field to be prepopulate starting from  1 and autoincrement" on every "abc" node creation.

How can I do this.


texts: How can I fix requirements could not be resolved to an installable set of packages?

texts:
I had a development site still on 8.8.0. I updated it using composer require 'drupal/core-recommended:^8.9' --update-with-all-dependencies, as per instructions; it worked, but it only went to 8.9.0-beta2.
This is what I got:
$ COMPOSER_MEMORY_LIMIT=-1 composer require 'drupal/core-recommended:8.9.0' --update-with-all-dependencies
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: symfony/polyfill-php72[v1.17.0, v1.14.0].
    - Can only install one of: symfony/polyfill-php72[v1.17.0, v1.14.0].
    - Can only install one of: symfony/polyfill-php72[v1.17.0, v1.14.0].
    - drupal/core-recommended 8.9.0 requires symfony/polyfill-php72 v1.17.0 -> satisfiable by symfony/polyfill-php72[v1.17.0].
    - Installation request for drupal/core-recommended 8.9.0 -> satisfiable by drupal/core-recommended[8.9.0].
    - Installation request for symfony/polyfill-php72 (locked at v1.14.0) -> satisfiable by symfony/polyfill-php72[v1.14.0].

Installation failed, reverting ./composer.json to its original content.

So, there is a conflict between three packages with exactly the same name and version? How is this possible and how can I fix it?


texts: Migrate module handling of join table data

texts:
I'm working with the Migrate module and I need to migrate data related by a join table. From what I can tell, Migrate module doesn't support migrating data connected by join tables, and if it does it's not at all obvious how to build migrations handling this use case.

I have a content type Person, and a content type Program. The Program content type has a multivalue entity reference field to content of type Person.

There are three source tables:

program
persons
program_persons

The table program_persons indicates the relationships between a person and a program.

I am not sure how to handle this scenario with the Migrate module. How would you go about setting up Migration classes and dependent migrations? I'll keep hammering on this but I'm stumped right now. Admittedly I don't have much experience with the Migrate module but it seems like it's worth learning.


texts: How to migrate drupal6 ubercart to D7 commerce

texts: I have a website in D6, and ubercart is used now i want to upgrade the site to D7 but with commerce. How can it be done?


texts: How to Update Commerce Product Programatically

texts:
$product_load = commerce_product_load(456);

 $product_load->uid = $GLOBALS['user']->uid;

 $product_load->example[LANGUAGE_NONE][0]['tid'] = 123;

 commerce_product_save($product_load);

As I am doing this it is not updating commerce product and takes lot of time to load the page.


texts:
I am inserting users from drupal6 to drupal7 using a custom script. I am using db_insert function.
In one of the D6 entry I am getting ® mark in a field and because  of this that particular value become blank in D7 database.
D6:  imatter®    ->   D7:

Anyone has any idea about how to insert this value in database?

Collation is same in both database: utf8_general_ci
And in phpmyadmin its look like same as above, means no html code for ®


texts:
I'd like to theme a contact form in Drupal 8.
I'd like to put divs around form elements (using bootstrap).

I also want to put some classes on certain elements (submit button, the form itself).


texts:
I am trying to have my module alter menu_ui functions. Changing my module's weight didnt help and I read that hook_module_implements_alter is the way to go. So, as described here I am appending my module to the end of the implementations:

/**
 * Implements hook_module_implements_alter.
 */
function mymodule_module_implements_alter(&$implementations, $hook) {
  if ('form_alter' == $hook) {
    $group = $implementations['mecca_hierarchy_access'];
    unset($implementations['mecca_hierarchy_access']);
    $implementations['mecca_hierarchy_access'] = $group;
  }
}

But this just throws:

  Uncaught PHP Exception RuntimeException: "An invalid implementation
  mymodule_form_alter was added by hook_module_implements_alter()" at
  /path/to/core/lib/Drupal/Core/Extension/ModuleHandler.php line 591

My form alter looks like this:

function mymodule_form_node_form_alter(&$form, FormStateInterface $form_state) {
  // commented code
}

What do I do wrong?


texts: Sanitize URLS along with the get parameter in Drupal 6

texts:
There exists an URL https://example.com/en/recent?page=4", which displays the Drupal page correctly.

And then an end user appends onload="prompt('XSS')"name=" to the URL.
The URL now becomes https://example.com/en/recent?page=4"onload="prompt('XSS')"name="

This URL now executes the javascript and displays the prompt.

How to avoid this.Does there exist any configuration or a module or a patch?
Are there any server specific (Apache) configurations?
Need a solution that will be applicable to all the Drupal pages.


texts: View Module : How to display list of Taxonomy terms with record count

texts:
I cloned the default Glossary view and changed it a bit to look like something as following:

A (3)
C (7)
D (10)
E (12)
...

But instead of Alphabets, how do I make it show taxonomy terms, for example:

General Knowledge (24)
Inspirational Stories (20)
Current Issues (10)

Appreciated...


texts:
I'm trying to set up responsive menu module (https://drupal.org/project/responsive_menus) and add an advanced search inside of it. I've been unable to get the advanced search to show up in the responsive menu. I am using the codrops' Google Nexus* theme and Drupal 7.

If its not possible to add search inside Responsive Menu, or if there is an alternative module or solution I am open to that as well. Any help would be appreciated. Thank you!


texts: How do I use a template file for preparing HTML message body for emails?

texts:
I want to use a template file for preparing the email message body using the table tag, and putting the submitted form data by user in table rows. I have implemented hook_mail() with the following code.

function get_price_mail($key, &$message, $params) {
  switch ($key) {
    case 'mail_to_eberhard':
      $message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed; delsp=yes';
      $message['subject'] = t('Factory Purchase - ').\Drupal::config('system.site')->get('name');;
      $message['body'][] = $params['message'];
      break;
   }
}

I created a template file (get_price/templates/mail-to-eberhard.html.twig), but the message body is not using my template file.

How do I make Drupal 8 use my template file?


texts: How do I print core block or views block in node.html.twig?

texts:
I'm pretty new to D8, so this might be basic stuff, but I can't find any tutorial how to do it.

In Drupal 7 this is the code that outputs core block in node.tpl.php:

<?php $block = module_invoke('block', 'block_view', '10'); print render($block['content']); ?>

This works for Views:

<?php print views_embed_view('viewname','block_10'); ?>

How do I achieve this in Drupal 8?


texts: what is "field_create_field" and "hook_field_info"? is there difference motive

texts:
I want to create a field, i searched on drupal and find field_create_field can create a field but I also find that hook_field_info is also to create to field.

My question is what is basic difference between both of them?
Are they use for same purpose?

I need the difference and where both are used?


texts: How do i set limit query into url from views output

texts:
In drupal i need to output json fields. So i used views_datasource. In my situation, i need to call same api source to multiple section, but i don't want to create multiple view only for 5 items or 10 items or all items for same content types data. So in views_datasource i need to use limit filter from all of views results like "http://example.com/serve/all-articles?limit=10".

Can anybody help me to do it?


texts: Panels page - node template - comments won't appear

texts:
I'm using Drupal 7. I've got a Panel page set up that comprises a content type, followed by up to two page views based on taxonomy terms. The content type is set to allow comments, and when I use it alone (ie. not as part of the node template) the comments works fine. But when I have it as part of the panel page, no comments appear.

Can anyone think of what I'm doing wrong? I've asked this question on the Drupal forums but haven't received an answer.

Thanks


texts: How to find which pages use a certain view?

texts:
I am working on a site that has a lot of views with multiple displays, and to make life easier for our team we are trying to document where views are in use; including view blocks.

In other words, I want a simple way to know which pages use a certain view for each view.  The site also has views that are enabled but not in use on any page, so it would be nice to be able to find out which ones may be candidates for deletion to make administration easier.


texts: Any way to set up triggers for items in their cart  to remind buyer to check them out after 30 days?


texts: Why this code cannot delete the rows that i want?

texts:
i want keep the 100 rows that has the biggest timestamp and delete all the other rows... Here follow the code that i have create :

$values_to_delete = db_delete('table1', 't');
  $values_to_delete->orderBy('t.timestamp');
  $values_to_delete->range(101, 99999999);
  $values_to_delete->execute();


texts: I migrated a site from windows xampp to ubuntu. It was working fine. But once I cleared the cache, the browser is showing blank screen.I tried going to different urls . I also tried clean urls but nothing is coming. All I can see is a white/blank browser.


texts: Drupal 6 custom theme development using Zen starter kit

texts: I am trying to develop a custom drupal 6 theme with zen starter kit. I installed and configured Zen starter theme kit. My objective is to develop a liquid layout theme from this starter kit. Anybody please tell me how to give layout widths for particular elements and if you have any useful tutorials, please share it.


texts: Drupal always creates its own URL aliases, even when I tell it not to

texts:
I don't know if this is a bug in Drupal, or if there's a configuration somewhere that is causing the problem, but when I create a new page or edit an existing page, Drupal (always? often? sometimes?) generates its own URL alias, even though I've very clearly specified that it should NOT do this, and I've provided one.  The one I provide does get created, but the Drupal-generated URL alias, which is always ugly, gets used instead.  I have to manually delete the Drupal-generated alias in order for the site to work.

For instance, I just added 2 pages, "Privacy Policy" and "Terms of Use".  Even though I specified /terms and /privacy as the URLs (and yes: of course I gave them to Drupal without the initial slashes), I got stuck with /content/privacy-policy and /content/terms-of-use as the URLs for these pages.


texts:
Is it possible on store/orders page to use different colors for different order statuses?
This feature can be handy. Or doe's someone know how to implement it?
thank you


texts: How to implement user enrollment or subscription?

texts:
I want to create a website with few courses in it. Each course will have a node of content type Course. I want users to be able to enter the course.

So this is sort of a "many-to-many" relationship question for Drupal, as for each subscription I will need to keep details on the progress, e.g. "last completed lesson", "total score", etc.

Is there a module that will have Enrollment/Subscription as a separate Entity/Content or Relation module will do it?

What is the best approach?

UPDATE 1:

This should allow to show all students subscribed to a course on a course page;
Show all current subscriptions with their details (fields) to student on my_courses page.

UPDATE 2: Can I use Open Group module for that?


texts: How to change the value of a commerce token?

texts:
When an order is submitted on our D7 site an email is sent to us with all the details of the order, including the payment method.

I use the token [commerce-order:payment-method] in the commerce email configuration page , which works fine, but I would like to change the value of that token to something that is more readable, like "This order is paid".

This is what I have so far in a custom module:

    function mymodule_tokens_alter(array &$replacements, array $context) {

  if ($context['type'] == 'commerce-order') {
    // Find token starting with commerce-order:payment-method.
    if ($value_tokens = token_find_with_prefix($context['tokens'], 'payment-method')) {
      if (!empty($value_tokens['payment-method']) && $value_tokens['payment-method'] === 'card_payment') {
        $replacements[$value_tokens['payment-method']] = 'This order is paid';
      }
    }
  }
}

The token's value still is card_payment, when the email arrives, so I have probably misunderstood something. Anyone?


texts: Drupal Leaflet View loading view block through Ajax

texts:
I created a view block for displaying geocodeed nodes on a View Leaflet map.
Everything working, the map displays the markers as I want.
Now, I would like to load this map throught drupal ajax

I attached the leaflet libraries to the page.
Then I load the view with:

$view = Views::getView('map');

$view->setArguments($args);
$view->setDisplay('block');
$view->preExecute();
$view->execute();
$content = $this->renderer->render($view->render());

$response->addCommand(
    new HtmlCommand('.result__map', $content)
 ));

The $content contain only an empty div generatated from the view and when the response is instered in the Dom nothing happen.
I suspesct that the map is missing some JS trigger to instanciante the map and maybe some JS settings.

Could someone send me an example or point me in the right direction.


texts: Will manually setting the expire timestamp in the boost_cache table actually expire the cache for a node?

texts:
I am trying to get myself acquainted with Boost running on my Drupal 6 website. I know that boost has a boost_cache table where it stores the expires value for each node.

Now I want to know whether that if I set the value in the expire column manually to a preferred value, Boost will recognize it and expire the cached version of the node on the date in the timestamp and there is no other table related to Boost caching where I should make the changes.


texts: rewriting results in view: trim from the back

texts:
I am working on Drupal 7 Omega Subtheme, Panels Views.
In one of my views I have a path field which displays the whole url and I need only the last 6 characters (6 digits, to be precise. Also, if it helps - part of the URL I want to get rid of is fixed.)
Under REWRITE options there is 'Trim this field to a maximum length' but I need to trim it from the end (i.e. from the right).
Do I have to use php? Do I require views_php module?
Thanks.


texts: Why file field button disappeared while uploading file?

texts:
I have installed fresh drupal-7 and create file upload field with manage field with 8M Maximum upload size. when i upload a file 25MB then it is showing error message and file field missing.
Before upload:

After Upload:

After long search i got some links
"exceeded the maximum file size" error even when uploading small files
File upload error "Files must be less than x MB" despite file being smaller than x
By these link my problem sorted out but my question. why the file upload field button  disappeared?.
My php.ini settings are

post_max_size = 24M
upload_max_filesize = 512M


texts: Jump to a heading in a view from outside the view on the same page

texts:
I have a page with an introductory area and then a view that contains a large number of items grouped by a series of known headings. Kind of like this:

_________________________________
Welcome Message and list of headings:
  - Heading 1
  - Heading 2
  - Heading 3
_________________________________
View:
Heading 1:
   - item 1
   - item 2
   ...
Heading 2:
   - item 3
Heading 3:
   - item 4
   - item 5
   - ....

and etc.

The page is put together using Panels; there is a custom content pane with the welcome message and list of links and the lower content is a view inside a pane.

I want the user to be able to click on a link in the top panel and be taken to a particular heading in the view below. I can't seem to think of a sensible way to do this without reworking how I do the entire view/page.

Any suggestions?


texts: I am working on Drupal 7 and the requirement is I need to crop the image before it gets stored or uploaded to the location. I tried with Imagefield Crop , Manual Crop , Smart Crop and Image javascript crop modules. What it does it, at first we need to upload the image and the image will be stored in the location/physical location then only the crop button will be enabled and we can manipulate the image. I dont want to upload the original image instead i want to upload only the cropped image. Is it possible to do like this? Have any one tried something like this?


texts: How to print field type image in views-view-fields--xyz--block.tpl.php

texts:
How to print field type image in this page?

I'm using this code:

print $fields['field_xyz']->content;"

Is it wrong?


texts: How to modify auto populate field value?

texts:
I m Stuck in two situation where I have to modify value of one field depending on another field selection.

First situation is like I have two field

Region (Node reference) - the widget type is autocomplete
Subregion (Node reference) - the widget type is autocomplete

On select of region, subregion value should be populate.
Behavior should be same like country and state.

Second situation is like in same form I have another two field

Date field
Event - widget type is auto complete

On select of date, events on that date should be populate.

Both are almost similar situation. I haven't found any solution for both above situation. How can I do this. Please anyone help me on this. Thanks


texts: Create a custom template for displaying a custom content type - and Views in Drupal 7

texts:
I'm creating custom templates for my Drupal 7 site. There is a custom content type called flowers.

Which template file (.tpl.php) should I put under templates directory of my theme's folder for displaying a single flower-type node?
Can I use the Views module to create different views (i.e displaying picture of a flower in a view & displaying species of the flower in another view) for displaying only a single flower-type node? So far I can create pages that displays list of flower-type nodes. I want to display just a single (perhaps providing it's node-id) flower-type node. How do I do that?

2.1. For displaying different types of views to display a single flower-type node, which template files (.tpl.php) should I edit?

Thanks in advance for caring :)


texts: Contextual Filter not getting the correct NID from URL

texts:
I THINK my Contextual Filter from my view is not getting the correct NID from my URL.

I have a view page with a path of "node/%/agenda".

The link on my menu is "node/[node:nid]/agenda".

The view page will get the nid from a content type "Venue".
Example:
Venue: Rave = NID: 101
View page will be = "node/101/agenda"

I have a working block of "Upcoming Events" and this works perfectly fine on my venue content type. But when I use it on a view page it's not working anymore. Basically this block shows the "Upcoming Events" from "Event" content type that is related to the "Venue" content type.

BLOCK:
Setting:

How it works on content type venue:
This is the wrong part:

As you can see it does not get the same result on the view page, it does not even show the "No Result". I am calling the correct block.

Am I missing something big? I hope someone can help!

THANK YOU VERY MUCH!! ^_^


texts: after updating 7.12 to 7.14 can't update modules

texts: I guess I should have updated the CKEditor (currently 7.x-1.8), Date (7.x-2.3) & Webform (7.x-3.17) modules before updating Drupal 7 core. Now, I am unable to update the three modules. When I go to Home » Administration » Reports » Available updates, and then check any one or all three modules, I click Download the Update. Then, I see "Ready to update" and then after clicking "Continue", the site goes directly back to the home page. Any suggestions of how I might be able to update my three modules?


texts: Changing the format of drupal pagers numbers

texts: Currently the dupal pager displays numbers normally as 0 1 2 3 4, how do i change this format to something like 01 02 03 04


texts: Upload Data From Excel Sheet to taxonomy

texts:
I have 4 Excel sheets like:

First (35) Records:
State Code | State Name

Second (650) Records:
State Code | District Code | District Name

Third (6500) Records:
State Code | District Code | Block Code | Block Name

Fourth (650000) Records:
State Code | District Code | Block Code | Village Code | Village Name

I want to upload from Excel sheet based on State Code or sequence hierarchical records to taxonomy.

Adding them one by one is very difficult task.

I have a module for Excel import, but matching of record of parent is necessary like : State -> District -> Block -> Village in taxonomy

So how to upload these records to taxonomy (with no headache)?


texts: Do Drupal 8 / backbone.js have conflict when using AngularJS on top?

texts:
I've just pulled D8 HEAD for my website and I want to use AngularJS instead of backbone.js to create a web app but realized D8 have already embedded backbone.js on every page.

I can disable modules that depends on it like edit or ckeditor if needed.

Even if I could disable it on a specific custom path I create with my module is still a good alternative for now.

There is also a conflict with Twig and AngularJS double curly braces in Drupal 8.


texts: Moving to PHP 7 require any system change with Drush or in Drupal GUI?

texts:
I am using Drupal 8.2.3 and this is my question:

After moving a Drupal site from PHP 5.6 to 7.13, is it a best practice to changed something in the Drupal GUI or from Drush? It's a long story why I ask, but it is very important for me to know if any such action is needed.


texts:
I need to use memcache only for sessions.
We have PHP 7.1, php-memcached, and Drupal 8 with the Memcache module.
In session.php we put:
$settings['memcache']['servers'] = ['192.168.177.112:11211' => 'session_instance'];
$settings['memcache']['bins'] = [
    'session' => 'session_instance',
    'users' => 'session_instance',
];
$settings['memcache']['key_prefix'] = '';
$settings['memcache']['options'] = [
    Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT,
];
$settings['cache']['bins']['session'] = 'cache.backend.memcache';
$settings['cache']['bins']['users'] = 'cache.backend.memcache';

but the bins are wrong.
This code work only if we put:
$settings['cache']['default'] = 'cache.backend.memcache'

or
$settings['cache']['bins']['render'] = 'cache.backend.memcache';

Any solution?
thanks


texts: How to Include custom tokens in the user register welcome mail

texts: Is it possible to use custom tokens in the default user regitration welcome mail? I need to pass variables from a custom module. Is the solution to create a token in the custom module and include it into the mail?


texts:
I have a form inserting into a database in Drupal 8. I would like to insert the user id. I have the following code:

$userCurrent = \Drupal::currentUser();
$uname = (int)User::load($userCurrent->id());

Without the (int) Drupal throws an error saying it cannot be converted into a string. With the (int) Drupal always returns 1. What am I doing wrong?

UPDATE: As stated I would like the user ID not the user name. Sorry if it doesn't make sense, I am very new to Drupal and there is not a lot of documentation for 8 yet.


texts:
I use custom display output views template to add markup to view. Somehow it seems that whatever the template output is filtered through, it strips script tags. Anybody know what function and where does the stripping occur? Btw adding script tags works when using views field templates without problem.
Thank you


texts: Missing icons with CKEditor for Drupal 7

texts:
I've recently installed CKEditor 4 for Drupal 7 module and some of the toolbar's icons don't seem to show up.

They are:
Add Media
Media
Teaser Break
and
YouTube (to name a few).

I've cleared the Drupal and Browser cache, but that hasn't helped. I've also ensured that I've got the right skins (reuploaded just in case). I tried multiple skins and these same buttons don't seem to want to appear.

Does anyone have any ideas for how to resolve this issue? Test thread is here.
http://iloveqatar.net/forum/content/test-0#comment-36224

(Note, I installed CKEditor because I needed an easy solution for users to upload multiple images when created a post so I'm not really attached to CKEditor if someone has a better idea. I was using TinyMCE with the WYSIWYG module)


texts: Documentation or Tutorial on using Batch or Queue Services API Programmatically

texts:
I am working on importing content into my drupal 8 website from an external API that returns XML data. The calls to the API take a long time to process. When I make too many queries at once it takes that much longer and it causes my site to timeout.

I have been trying to find online some direction on how to use the Batch API Service or the Queue Service programmatically in D8 but haven't as of yet found any good tutorials or documentation on this. Anyone have any good suggestions on where I can look or direction on where to start to use batch or queue services in D8? I have found many tutorials for D7 but haven't been successful in getting those two work with my D8 code.

Any suggestions would be greatly appreciated!


texts: How to display only the status message to anonymous users in page.tpl.php

texts:
I want to display the status messages to all of the users but the error and warnings to the administrator.I am using this code

<?php if($is_admin): ?>
      <?php print $messages; ?>
<?php endif; ?>

But I have no idea how to distinguish the message type.


texts: Converting a form field to multiple submit buttons?

texts:
I'm not sure how to explain this well in text, but I want to change this:

Into something like this:

In Drupal 8, I have an entity for which the only user-editable field is Score, which is a List (integer) with six possible scores, 0 to 5.
On the edit page, I want users to be able to press a button to assign the score.  There should be one button for each score.
How can I implement something like this?


texts: Creating a content type in the CCK with several categories and multiple options

texts:
I have to create a content type with multiple options divided into categories.

For example, imagine that you want to create a content type about cars and each car has multiple categories (engine, dimensions, serial items ...), and for each category, you have multiple options. For example for dimensions: weight, large, height, volumen ...

It would represent something like this:

Category 1

Option1
Option2
...

Category 2

Option1
Option2
...

...

There would be in total about 8 categories and 10 options for each category, so about 80 options in total.

All the options would be booleans (either it has the option, or it hasn't).

The options that must be supported are defined and not variable, meaning, I know which options will be required before hand.

My question is how would be the best way to manage this in Drupal.

My first reaction would be to use fields of integer type and with a widget type Single on/off checkbox.

The problem I see with this is that it would create a field into the content_type table for each one of the options, meaning there would be about 50 fields in that table.

Another option it occurs to me would be to create a text field for each category, and that the content creator inserts the options available for that category in that specific item, separated by commas.

Which would be the best approach about this?


texts: SMTP Authentication Support + Unable to send e-mail

texts:
I'm working on my localhost with a drupal project. I'd like to be able to send emails so I installed the SMTP Authentication Support module. Now I'm configuring it to send it with my gmail address but the test mail can't be send. I always get this error:

Unable to send e-mail. Contact the site administrator if the problem persists.

My Settings:

SMTP Server: smtp.gmail.com
SMTP Port: 465
Use encrypted protocol: no
Username: myusername@gmail.com (yes, this is correct in my settings)
Password: mypassword (yes, this is correct in my settings)
E-mail from address: myusername@gmail.com
E-mail from name: my username
E-mail address to send a test e-mail to: myotheremailaddress@hotmail.com

When I check the Enable Debugging checkbox I get this after trying:

SMTP -> FROM SERVER:
SMTP -> FROM SERVER:
SMTP -> ERROR: EHLO not accepted from server:
SMTP -> FROM SERVER:
SMTP -> ERROR: HELO not accepted from server:
SMTP -> ERROR: AUTH not accepted from server:
SMTP -> NOTICE: EOF caught while checking if connectedSMTP Error: Could not authenticate.

Am I doing something wrong?

I've also tried it with PHPMailer module with the same settings, same result ..


texts: Target Bundle with hook_element_info_alter

texts:
Using the following hook you can alter form elements

function EXAMPLE_element_info_alter(&$type){
  // Increase the default weight range
  if (isset($type['weight']['#delta'])) {
    $type['weight']['#delta'] = 120;
  }
}

How can I target a bundle  with this hook?


texts: How do I output a file from outside public://

texts:
I'm outputting an image at urls starting with image-for, e.g. image-for/example/path would choose an appropriate image for example/path. Basically this looks up the first image from a field for the given node, and defaults to a site logo.

My code therefore looks like

<?php
// ...
$file = mymod_get_appropriate_file_uri();
if (!$file) $file = "/sites/all/modules/mymod/standard-file.png";

// the headers are generated, code omitted as it works correctly!
$headers = array();

file_transfer($file, $headers);
drupal_exit();

This works fine for files in public://.

The problem seems to be that file_transfer() can't handle files that don't have a schema. The file I want to transfer is not in public://, so prepending that won't work. How can I get it to output the file?

Nb. as a work-around I'm currently redirecting to the URL, but I don't like this.


texts: rules condition to check whether user has flagged another

texts:
Hi I have two user roles, client and consultant. Currently a client is able to flag a consultant as their selected consultant.

Now here is where im stuck. I am looking to use rules to display a message to clients whom have not flagged a consultant yet. How would i go about setting up this condition within a rule?


texts:
I have a small app I'm working on and after I created a new build I'm unable to login or logout. This seems to happen because drupal thinks I'm logged in but my app doesn't have the user details in local storage. So I don't know the logout_token needed to logout from app.

Is there a way I can fix this?


texts:
I'm creating a custom theme in Drupal 7 but I'm having trouble getting it to render the menu

I'm using the following code in page-front.tpl.php

<?php if ($page['main_menu']): ?>

<?php print render($page['main_menu']); ?>

But it does not render anything. I have double checked that a menu exists.


texts: Allow another role to edit only parts of any node

texts:
I have nodes with a "topic" field that is a taxonomy reference. Nodes are submitted by users and users can only edit their own nodes.

How can I allow a "moderator" role to be able to edit the topic fields for any nodes but not any other fields on those nodes?


texts: How to add an html element (BODY) class based on taxonomy from logged in user?

texts: I'm building a website on Drupal 7 which will be accessible only to registered users. A taxonomy term is referenced to the user account. I need to add a body class based on that taxonomy term so I can personalize the theme's look depending on the logged in user.


texts:
I have a user "manager". This user has the manager role but not the administrative role. Is it possible to allow this user to manage users and their roles? For example, if someone creates an account I want this user to be able to activate the account like an administrator can? And then to give a role to that user?

Or even change roles of existing user?

I have searched. But no luck.

Thanks in advance :)


texts:
Is there a way for drush to print out what module version for a module that is currently enabled?

I'm not looking for trying to find what version of drush is.

I end up doing it the janky way:

drush dl mymodule --select and then seeing which version is installed.

Or drush pm-list | grep mymodule


texts: Site building process: what is the relationship between CCK, Views, Panels, Blocks and Taxonomy?

texts:
A beginner question. I need to understand the relationship between the top Drupal structure modules: CCK, Views, Panels, Blocks and Taxonomy, i.e., when building a website, what is the general steps that the site builder should consider regarding using those modules? What comes first? What's next?.

Let's consider a site that categorizes IDEs (integrated development environments) and provides detailed informations about each IDE. How would be the mentioned modules implemented with this use case? What would be this websites building process?

Thanks.


texts: Automatically set date field end time to +2 hours

texts:
I am allowing users to pick a start date and time. From that start date and time, I would like to programatically set the end date and time to "start time + 2 hours".

The issues that I'm running into are:

How do I collect an end date without showing the user the "end date" field?
How do I automatically force the end date to be 2 hours later than the start date?


texts: FillPDF Generating PDFs of 0 bytes when using local PDFtk

texts:
We just moved from Scientific Linux to Ubuntu, and as a result have moved from FillPDF Local Server to locally installed PDFtk.

All PDFs that are generated are now 0 bytes. There are no related errors showing up in the Drupal logs, and in fact I see a notice from the FillPDF module that

  the PDF was created (User generated form "nbca_archival_reproduction_agreement.pdf" for node "NBCA Reproduction Form".).

I'm also not seeing any errors in the server logs either.

Has anyone else encountered this problem? Any advice would be greatly appreciated.

Thanks,
Pablo


texts: What methods are available to assign a TPL to a specific url for Drupal 7 theming?

texts:
Currently I have a custom javascript libary that is being loaded on all pages of the site as i hardcoded it into the html.tpl.php file. I konw you can target specific nodes or node types via the tpl filename format, but what if I wanted more control of where this tpl is activated? Is there some type of regex formating that I can use for html.tpl.php?

What I want to be able to do is load my custom js library on all pages except for a specific content type and a few views urls. How can this be done the most efficient way?


texts: Alternative to Google Adsense content injector module

texts:
I want to "float" ads in the top right of my nodes for which Content Injector was nice enough in D6 moreover such ads convert well in my experience.

But for D7 is there any easy alternative? I know I can sub-theme and place the ads in appropriate positions.


texts: How to update from Drupal core 8.5.0 to 8.5.5?

texts:
In the past (Drupal 7), security-only update via drush was simple as:

drush up --security-only

now, Drush 9.3 returns:

  Command "up" is ambiguous.
  Did you mean one of these?
  ...

composer does not help either:

composer outdated drupal/*

returns nothing.

In fact, my Drupal is outdated:

How can I update Drupal security updates via command line?

UPDATE (composer prohibits):

$ composer prohibits drupal/core:8.5.5
There is no installed package depending on "drupal/core" in versions not matching 8.5.5


texts:
I'm using Drupal 7.43 version. I have two types of content.

  The content type No. 1 - to create Professional Profiles &

  The content type no. 2 - to create Departaments.

First step: I created some nodes using "Departaments": UX, IT, HR, etc.
Second step: I created an Entity Reference to show these Departaments as a list inside "Professional Profiles".
Third step: I created a node named "Joe" using "Professional Types". Inside that form I’m able to assign "Joe" in some Departaments. For instance, "IT".

What I would like to achieve is reciprocity in addition. That is, if I go to the form of node "IT", I should see that Joe Doe is marked. But if from "IT" node I uncheck "Joe", this Departament should be unmarked in professional profile of Joe.

I try to achieve it by using two modules: Entity Reference Backreference and Corresponding Entity References but I have not been able to get it.

Anybody knows how to achieve it?

Thanx in advance.


texts: How to implement Likert Scale with EntityForm?

texts:
I was using Webform, but I need to provide an autocomplete field to reference a node of a particular type. I see many recommendations to dump Webform and use EntityForm, but the first question type I need to reproduce is a Likert scale. I don't see any discussion of how to create this fundamental question type with EntityForm. Do I really need to build each Likert scale question by typing option names/ids into a select field? Would there then be a way to report on the sum of a set of items in my form?

A Likert Item is a question like "What do you think of this module? Answer 1 (strongly disagree) to 5 (strongly agree)." A Likert Scale is the sum of responses to a series of Likert Items.

Webform has a very nice implementation.


texts: Adding content to Paragraph Date Field Drupal 8

texts:
I'm programmatically creating paragraphs using the following code, but I'm unable to get the date value to store correctly within the date field. It seems to store within the database, yet on the edit page/form for the node, it remains as a blank field.

Any suggestions or insight would be appreciated.

//SET THE DATE
$date = new DrupalDateTime('2017-10-24 13:30:00');

//CREATE THE NEW PARAGRAPH
$paragraph = Paragraph::create([
    'type' => 'event_venue',
    'field_tickets' => [
        ["value"  =>  'Adult Update 1|£30'],
        ["value"  =>  'Adult Update 2|£130']
        ],
    'field_date' => array($date->format('Y-m-d H:i:s')),

]);

//SAVE THE PARAGRAPH SO WE CAN ADD THE ENTITY ID TO THE NODE
$paragraph->save();

//LOAD THE NODE
$node = entity_load('node', $nid);

//ADD PARAGRAPH TO THE NODE
$node->field_dates = array(
    array(
      'target_id' => $venue_information->id(),
      'target_revision_id' => $venue_information->getRevisionId(),
    )
);

//SAVE THE NODE
$nid = $node->save();


texts:
I have read and tried https://www.drupal.org/docs/8/modules/search-api/developer-documentation/executing-a-search-in-code

I am using drupal 8 and using the default content index for testing. I am able to run the following code and I get a result count, but not result items.

$index = \Drupal\search_api\Entity\Index::load('default_index');
$query = $index->query();

// Change the parse mode for the search.
$parse_mode = \Drupal::service('plugin.manager.search_api.parse_mode')
  ->createInstance('direct');
$parse_mode->setConjunction('OR');
$query->setParseMode($parse_mode);

// Set fulltext search keywords and fields.
$query->keys('');
$query->setFulltextFields(['title', 'name', 'body']);

// Do paging.
$query->range(20, 10);

// Set one or more tags for the query.
// @see hook_search_api_query_TAG_alter()
// @see hook_search_api_results_TAG_alter()
$query->addTag('custom_search');

// Execute the search.
$results = $query->execute();

echo "Result count: {$results->getResultCount()}\n";
$ids = implode(', ', array_keys($results->getResultItems()));
echo "Returned IDs: $ids.\n";

Count shows a value but I can't get any result items.
I tried with $query->keys(''); $query->keys('*'); and some value $query->keys('some value');
In all cases the count seems to be correct. The search therefore seems to be executed correctly, but how can I retrieve the items?


texts: How do I add a meta tag in inside the  tag?

texts:
How can I add the following meta tag inside the <head> tag?
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

I am trying to add it to a Drupal 8 site.


texts: Retrieve node information in VIEWS template(s)

texts:
I have figured out I need to override two templates:

views-view-fields.tpl.php
views-view-unformatted.tpl.php

Basically my node has an "align" property which I need to access in both templates to properly generate the expected markup.

<?php echo '<pre>'; print_r(get_defined_vars()); exit; ?>

Using this I can see I have a monster of a structure at my disposal but the I am nervous about traversing such a structure as the slightest change to it's arrangment means my template(s) would break!!!

Ideally I would like to implement a preprocessor such as:

How can I add variables from a preprocessor function to be used in an unformatted view template?

Basically add the "align" value from the node to a simple variable which I can then access and check inside both templates listed above...

Suggestions???


texts: Views URL GET Query exceeding apache2 maximum limit

texts:
I am building a views based report that allows selection of fields using views dynamic fields [https://www.drupal.org/project/views_dynamic_fields]. The view also has more than 15 filters for generating all possible reports.

The purpose is mostly administrative for generating variety of reports saving those reports [URL based specific report - selecting fields and filters].

The problem is that I am getting apache2 maximum URL Length issue. I have followed the apache2 documentation for increasing LimitRequestFieldSize and LimitRequestLine but it is not working for the hosted Ubuntu 14.04 server. Specifically I modified the apache2.conf and set a high limit for them, restarted apache2 but didn't work..

I used the views post form [https://www.drupal.org/project/views_expost], which sends the query via POST method instead of GET method. The problem is that:

Pager is not working [Items per page]. Setting it via UI does not alter it.
I cannot save the Views query url for specific searches (no URL query due to POST method).

I would want to achieve the following:

Generate variety of report by selecting different fields and filters.
Save those searches(URL Query) and name them as different report.

Kindly suggest if there is an alternative to whether I can decrease the URL size via code, or achieve the required result differently. Thanks.


texts:
I'm working on a Drupal 7 site with the Nodequeue module installed. I have a content type named Real Estate Listing, and I need to display a nodequeue for this content type inside the royalslider slider on its main page.
This is the Real Estate Nodequeue.

This is the view for this nodequeue.

When I have added a node to this nodequeue, it appears twice on the slider:
In the first slide, it displays correctly; in the second slide, only the title and other fields appear, without CSS applied.
This is the screenshot of the first slide.

This is the second slide.

I added this node only once in the queue. Why does it appear in two slides? What can be wrong?

Updated:


texts:
I need to add a <div> wrapper with a specific ID to a DFP AD tag within the block.

The DFP Module appears to create AD tags as entities. I cannot determine where the AD tags are stored or how to create another field to the AD tag entity that I can pull out in a preprocess function to send to my template.

I am hacking the DFP module.

Does anyone have a pointer on where to start?


texts: Upload multiple Standolane Media Entities (Images) without Reference Field

texts:
I'd like to Upload Images as Media Entities without referencing them in another Entity. In media/add/image I can upload a single Image. That's fine.
What I'd like to achieve is a Multiple Upload Widget where I can Upload multiple Images and provide default values for all Images (Taxonomy Reference). After creation these Media Entities can be edited further or assigned to other content Entities or just be viewed in Galleries according to their Taxonomy Term.


texts: Get nodes of specified content type with REST

texts:
I want to retrieve all nodes of specified content type (as example'news') with GET method with REST,
How can I achieve it?
(first I want try it with firefox RESTClient and if it work implement it in my application)


texts:
Im using Domains Access to create a subdomain and already created all the virtualhosts, so that one is working.

Is it possible to show a user based on domain name?

Im creating a view, and i need to show for example:

lucas.site.com and show user lucas.

I have tried by adding contextual filter: User ID context on route.
But it doesn't take effect, it looks in lucas.site.com/lucas maybe im missing something?


texts: Drupal installed as composer package, Custom themes/modules folder

texts:
I want a folder structure similar to:

-web
--app
---themes
---modules
--core

In composer I can specify installer paths to put required modules in the /web/app/modules directory and install drupal core in the /web/core.

Can I get Drupal to look for themes and modules in the /web/app/themes and /web/apps/modules directories so I don't have to put anything custom inside the core directory (so Drupal core can be installed as a package and not stored in my git repo).

I've seen similar set ups with Wordpress allowing you to specify a 'CONTENT_DIR' constant that means Wordpress will look for wp-content in a different directory. Is there a similar way for Drupal?

I found this on git which achieves something but it requires a custom script https://github.com/davidbarratt/drupal-structure


texts: How to override the ['search_distance'] in Location: Distance / Proximity Views in a custom module

texts:
After looking at the location module. I couldn't find any way to override the 'search_distance' parameter by creating a custom Form.

dose anyone know how to override this variable by using a custom module? .

I do have a map that is already searching proximity by zip code. it uses php code to determine the  latitude, longitude.

I want to add the 'distance' selectbox next to the zipcode and filter it by (25 miles, 50 miles, 100 miles) like that.

Please note: the below Form for filtering is written in a custom module. so I'm looking for php code.


texts:
Does anyone know how to use the OG-Theme module to set unique themes for groups?

I can't find a relevant user interface.


texts: How do I debug incorrect favicon showing on the front page in a custom theme?

texts:
I'm working on a Drupal 8 site with a custom theme that I didn't code. The site is using the metatag: favicons module to control the favicons. The favicon seem to work correct on all except the home page, which has the default Drupal "Drop" icon. You can see the site here [Site no fav][1]. I am not sure how to begin debugging this since the behavior is not causing an error and the favicons work on the rest of the pages. I assume this has to be some sort of misconfiguration, somewhere, but I'm not sure if I should be looking in template files, something in the admin UI, or where exactly. Any help/guidance appreciated.

Update:
The issue is not a local cache issue, as it was brought to our attention by an external user and happens in Firefox and Chrome.

Update2: Closer inspection of the page source shows that the links for the favicons are indeed not loaded onto the homepage. Specifying a favicon in the Metatag UI for the front page loads one of the favicons. However, the favicons do not have global settings and are still loaded into every other page. The fix of course, is to specify all the icons I want, but this is tedious and doesn't answer why it works on the non-homepage pages.


texts: How do I change the image style for avatars displayed in comments

texts:
I'd like to use a custom image style for the comment avatars, but I don't know where the setting in Drupal is to change it.

I thought if I changed the user image style at admin/config/people/accounts/display that might work, but it doesn't. There's no image field at admin/structure/comment/manage/comment/display, so I can't change the style there.

I did this on a site a couple weeks ago on another site, but I can't remember for the life of me how I did it. I don't think I needed to make code modifications. Help?


texts: Sub-themes .tpl file is not overwriting parents

texts:
In my sub-theme, I needed to adjust the HTML of a component that was part of the parent theme. To that effect I copied that components .tpl into my sub-theme's directory and made the alterations.

I then renamed it in accordance to theme debugs file name suggestions. I've done this many time before with no problem.

However, the alterations are not appearing on my site. I've run drush cc all and drush rr of course, but to not affect.

Would anyone know what's happening here?


texts: Why do all my products (in Ubercart) get taxes applied after upgrading my Rules module?

texts:
I am using Drupal 7 and Ubercart (version 3). I try to add TAX to only certain items which has a particular Taxonomy Term Selected.

This functionality worked fine in previous version of Rules 7-2.8  But now for some reason all rules conditions come back as true and VAT is applied on all products.

I have tried downloading the older version same issue.

How to Replicate:

Configuration > Tax > Editing Condition Set VAT
Entity has field (Parameter order:product:0:node) has Field Product_Type
Data Comparison (Parameter order:product:0:node:Product_Type) one of Books, Hardware

So my real problem is that somehow all the products which do not have these terms selected are getting Taxes.

Any suggestions?


texts:
I am working on a multilingual Drupal 7 site. I've been asked to set up an automatic redirect based on the user's location. I've tried the geo_redirect module but it does not work with internal URLs because it creates a redirect loop.

My site uses paths to switch languages. For example the German homepage is example.com/de.

It seems like there are various modules that say they can do this but some are just dev versions, some require a subscription to a geo-location service, and some like to populate the Drupal database with 200MB of geoIP data (huhhh???).

Here is an example of what I need...

User located in Germany goes to example.com
Website detects that they are located in Germany
User gets redirected to example.com/de (the German homepage)
If user in Germany goes to any URL with /de in it then no redirect occurs

Just wondering if anyone has any experience with this and how they went about doing it.

Thanks!


texts: Update image tags using entity metadata wrapper

texts:
I'm trying to bulk update image tags using entity_metadata_wrapper.

I'm unable to see the image field when I use $emw->getPropertyInfo().

The bundle is called hub_page.

The code I'm using is:

$wrapper = entity_metadata_wrapper('node', $node_id, array('bundle' => 'hub_page'));
var_dump($wrapper->getPropertyInfo());

Is this the correct way?


texts: How to display a computed field in an automatic node title?

texts:
I am trying to display something like "Field A - Field B" as a title for each content created on a Drupal 7 website.

The Field A is entered manually through Drupal standard form.

The Field B is computed with the module Computed Field and it depends on Field A value (this part works fine).

Now I would like to create automatically the node title on saving with Automatic Entity Label, using Token. (This is the new Automatic Nodetitles).

Unfortunately, using [node:field_a] - [node:field_b], the computed field B value is invisible. More, if you edit the node and save it a second time, the title is OK...

It seems like the field value calculation is made simultaneously with the title generation and thus this value can not be used to generate the title. Of course, I can not tell my client to save twice, we can not say it is user-friendly...

Is there another way to build this automatic title based on a computed field?

Related questions :

How to Compute fields on the fly

What's wrong in my code for setting up entity title in a Computed Field?

On the same subject on Drupal.org :

https://www.drupal.org/node/370850


texts: Print Webform reference in custom view display

texts:
On our D8 site we have a content type with a webform reference field field_reference_webform.
We then created a view with a custom views display style plugin for above content type that uses the webform reference field field_reference_webform.

What we want to achieve is to print the webform field in our custom view display style directly via views-view-our-display-plugin.html.twig.

The contents of our Webform reference field, however, wouldn't print. We tried to print it with below code:

{% if rows|length %}
{% for row in rows %}
{{ row._entity.field_reference_webform }}
{% endfor %}
{% endif %}

Instead we get the following error:

Object of type Drupal\webform\Plugin\Field\FieldType\WebformEntityReferenceFieldItemList cannot be printed

We cannot figure out what we got wrong.

We are on Drupal 8.6.2 using Webform 8.x-5.0-rc22


texts: How to display number of pageviews on articles and pages

texts:
I am looking to display the number of pageviews for articles and pages next to where it has tags for example.

Are there any modules that do this?


texts: Cannot set default value to simple hierarchical views exposed filter field

texts:
I have a views block displayed on a page. It has simple hierarchical select exposed filter field to which i want to set default value when the page loads. I have written below code in hook_form_alter but it does not work.

$form_state->setUserInput(['tid' => '47']);

When i check in preview section of views my taxonomy is selected and works perfectly but on page it does not work.

Thank's in advance


texts: how to extract values of field collection using Entityfieldquery?

texts:
I have created a content type 'customer' in which I have a field collection named 'field_group'. The field collection has 2 fields namely:

  Title
  Name

The Customer content type and group field collection are of entity type 'node' and the 2 fields in the group are of entity type 'field_collection_item'. I want to query the database to get the values of the fields in the group for this particular content type. I used to following query to get the field values of the group.

    $query = new EntityFieldQuery();

    $query->entityCondition('entity_type', 'field_collection_item')
          ->entityCondition('bundle', 'field_group');

    $result = $query->execute();

$nodes = entity_load('field_collection_item', array_keys($result['field_collection_item']));

But the above entityfieldquery retrieves all the values of entity type field_collection_item. But I want only the values of content type 'customers'. Can anyone tell me what's wrong with the above query?


texts: How to refresh block view of flags when the flag list is empty? Link operations issue

texts:
I'm trying to have a simple block of flags for my site. I created a block view of content of my custom product type with a relationship to Flags: my_product (by any user).

The issue is have is that the block is only refreshed if I used the confirmation form link type. Is there a way to get the list to refresh (and the block to be updated) with using the other link types?

thanks in advance.


texts:
I'm currently building a module that has a popup page in it. The popup page is very simple and no real header/footer so I don't want to use the standard html.tpl.php page.tpl.php

How can I override the master templates with my own much simpler ones?


texts: Chosen module/jquery plugin not accessible on mobile devices?

texts:
I have installed the Chosen Module and was surprised to find out when viewing the page on an actual mobile device or on a desktop mobile device simulator that the Chosen menu is totally missing from the html markup and the menu items are not being displayed on the device.

Anyone know by any chance what I may be missing here? Is it possible the module only works for desktop or tablet devices?


texts: set #empty_option of billing address select list

texts:
I'm using Drupal 7 with Commerce (7.1) Commerce Address Book 7.x-2.0

I'm simply trying to change the #empty_option value of the "Addresses on file" select boxes that appear on the checkout page from "-- Choose --" to "Add new address"  I'm using hook form alter and then:

if ($form['#id'] == 'commerce-checkout-form-checkout'){
    $form['customer_profile_shipping']['addressbook']['#empty_option'] = (t -'- Add a new billing address -');
}

But when the page loads, it still shows "--Choose --"

I'm pretty sure this should be easy !


texts:
I'm attempting to figure out a way to add

<meta http-equiv="X-UA-Compatible" content="IE=edge">

to the header of my pages. I've heard that you could add it in your theme settings but I could not find where that would be located. I also heard you can resolve the issue using template.php in your theme. I've added

<?php
function retheme_alpha_0_2_preprocess_html(&$head_elements) {
    $element = array(
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#attributes' => array('http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge,chrome=1'),
        );
    drupal_add_html_head($element, 'chrome_frame');
}

to mytheme/templates/template.php

However it seems to have no effect.


texts: How to alter a link of the language switcher?

texts:
I would like to alter the link displayed on the language switcher for the second language of my site, for a certain node. Essentially when you viewing a certain node in the main language, and then use the language switcher to view the secondary language, I want the language switcher to serve a different link from the one that links to the translation of the node on the main language. (The design of this node is different from the one on the main language, so just translating the node won't help in this case)

I've tried both
MYTHEME_preprocess_links__language_block(&$variables) and
MYMODULE_language_switch_links_alter(array &$links, $type, \Drupal\Core\Url $url) but in both cases either the variable I was interested was protected or private or I couldn't get any interesting variables to work with.

Is it allowed to use these hooks above for what I'm after, or it needs to be a more hacky way?


texts: OR condition in Views Contextual Filters

texts:
I have a Content Type named "Match" which has a local and visitor. Both are node references to a Content Type named "Team".

In Views I need to ask for matches of a specific team, no matter if that team is the local or the visitor. In contextual filters I can set a value for "local" and for the "visitor" each one in particular. So I guess I need an OR condition in this case.

Does anyone know how to solve that problem?

Edit: I found Views Contextual Filters OR module already but that's the problem, my website is too big and currently in production so we don't want to have problems because of bugs or something.


texts: Set user role after user registration (not via hook_user_presave)

texts:
I want to assign roles to a user after the user registers, or when a user is created by another user. Normally this can be done with hook_user_presave() but the problem I am running into now is that there is some other logic in the platform that is synchronizing users from a third system. While creating those users hook_user_presave() is also called and the roles are assigned as well. But that should NOT happen in this case but only when a user register himself or another admin user is doing that. The new role should only be assigned after submitting the user_register_form.

My idea now is to add a custom submit handler to the user_register_form and set the user role there. The code is simple:

function mymod_form_alter(&$form, &$form_state, $form_id) {
    if($form_id == 'user_register_form') {
        $form['#submit'][] = 'mymod_register_submit';
    }
}

And for the custom submit handler:

function mymod_register_submit($form, &$form_state) {
    $account = user_load($form_state['values']['uid']);

    $account->roles[123] = true;

    user_save($account);
}

I could not find a problem while testing that but I am afraid that this is not the way it should be solved since I am actually saving a user account while saving a user account.

The question now: Can I solve the problem like this or is there a better way?

Cheers,
J


texts:
I have a Drupal 8.6.7 site with Commerce 8.x-2.11 installed. I would like to include slightly more information in the emails sent out when customers complete the checkout process. I would like to reference both the equipment category field and a more general category field present in both the product and product variations.

At the moment I just see the Title, Unit Price and Quantity if I look at the list of orders (all tests right now) at /Administration/Commerce/Orders.

Is there a way of adding these fields through the web admin GUI so that they end up in an order receipt email? I also have 'MIME Mail' and 'Mail System' modules installed if that helps.


texts: Where should I install the LESSPHP compiler?

texts:
Hello I just bought a premium theme for Drupal. This theme works with the Less css preprocessor module, and I've installed and enabled this module:

The problem is, the site still doesn't look designed, and I get Drupal errors printed to the screen indicating on problems with Less. Thus I went to the themes' suport forum, ran a search and understood I need to download something called "LESSPHP" (A PHP based LESS-CSS comipler I guess) and install it somewhere in my Drupal installment, but I just don't know where and if it even a right step. Moreover, my site also indicated I miss this "LESSPHP" preprocessor at admin/config/development/less:

Where should I install this "LESSPHP" compiler and what else do you think I missed given the errors I see above?


texts: Undoing Content Changes Made with Admin Panel

texts: I administer an existing site, and accidentally changed some of the formatting on our homepage.  In the past, I have been able to press "back" on my browser to undo changes, but for some reason it's not working this time.  Does anyone know of a way I can "undo" changes I made to the website under the admin panel?


texts:
I'm looking for a module to allow myself or other moderators to set credits/points for each site member. The site members can use the credits to purchase items in the store.  I don't want to use any real world currency for the transactions, just virtual points.

This site is for an online guild. My hope is to set up a reward system and give each member points for being active in the guild, they can turn around and use the points to get content for their characters in game.

Is there any module that would help me achieve this?


texts: How can I get bundle of an entity from type and id?

texts:
I need to identify bundle of an entity from its type and id.

For example, if the type is 'node' and id is 7, I may get 'page' as bundle.

Thanks


texts: csv file imports only the last row when imported in drupal 8 webform

texts:
I have a csv file which contains the entries from drupal 7 webform. I uploaded the csv file in drupal 8 webform. It imports the data, but only the last entry is shown in the drupal 8 webform's results.

This is the csv file:
columns A-D : IP Add, UUID, Phone Number, Email.  (dummy entries).

When importing the mapping from the csv file, it shows me the below options:

I select the matching columns on the destination(submission) and then click import.
After importing this is what drupal displays:

Only the last row from the csv file is updated in the webform.


texts:
I'm trying to get my blog onto Google Feed Burner. I've read all about this, but there doesn't seem to be a clear answer. I just get this error.

Received HTTP error code 400 while fetching source feed.

I then validate my blog feed through feedvalidator.org. It says it's validated, but it shows the following message.

This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.
line 38, column 0: Missing atom:link with rel="self" [help]

The help link seems useless, and I don't think this "recommendation" from the feed validator is my issue. Nonetheless, I've installed
http://drupal.org/project/views_rss  as well as http://drupal.org/project/feedburner.
I've tried burning my feed through the Feed Burner module, but nothing seems to be validated. It looks like there's a lot of Drupal folks having similar problems without a clear answer/tutorial.
Here's what I have:

Drupal6 site. A blog page with numerous blog posts, each with a teaser. URL example.com/blog

What appears like a valid RSS feed when I type in example.com/blog/feed. This spits out some text which looks like.
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="https://example.com"
xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>Example blogs</title>
<link>https://example.com/blog</link>
<description></description>
<language>en</language>
<item>

I've set up a google Feed Burner account.

I installed the RSS Views and the Feed Burner modules.

I don't know what else to do. I keep getting that awful error.
Hopefully someone out there can help.


texts:
In Drupal 7, using Flags (and possibly Rules or another contrib module) how can I force a flag to be unique for a specific content type.  I do not want to force users to manually 'unflag' content before 'flagging' a new node.  I would like reviously flagged nodes to be automatically unflagged once a new flag has been set.

The goal is to allow users to select a 'default node' by use of flags.  Only one default node should be allowed.

How can I force and automate flag uniqueness?


texts:
I'm trying to migrate user's content profiles (Drupal 6) to Profile2's profiles (Drupal 7) using the example from http://grasmash.com/article/migrate-classes-content-profile-profile2. When I try importing, I get the following error:

  Migration failed with source plugin exception: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ctp.field_titul_pred_jmenem' in 'field list'

This is the migration class.

class SkipProfile2Migration extends Migration {
  public function __construct() {
    parent::__construct();
    $this->description = t('Migration of content profile into profile2 entities');

    $this->map = new MigrateSQLMap($this->machineName,
      array(
        'nid' => array(
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'description' => 'D6 Unique Node ID',
          'alias' => 'n',
        )
      ),
      MigrateDestinationNode::getKeySchema(),
        'default'
    );
    $query = Database::getConnection('default', 'legacy')
      ->select('node', 'n')
      ->fields('n', array('nid', 'vid', 'type', 'language', 'title', 'uid', 'status', 'created', 'changed', 'comment', 'promote', 'moderate', 'sticky', 'tnid', 'translate'))
      ->condition('n.type', 'profile', '=');
    $query->join('skip' . '.node_revisions', 'nr', 'n.vid = nr.vid');
    $query->addField('nr', 'body');
    $query->addField('nr', 'teaser');
    $query->addField('nr', 'format');
    $query->join('skip' . '.users', 'u', 'n.uid = u.uid');
    $query->addField('u', 'name');
    $query->leftJoin('skip' . '.content_type_clovek', 'ctp', 'n.nid = ctp.nid AND n.vid = ctp.vid');
    $query->addField('ctp','field_titul_pred_jmenem');
    $query->addField('ctp','field_krestni_jmeno');
    $query->addField('ctp','field_prijmeni');
    $query->addField('ctp','field_titul_za_jmenem');
    $query->addField('ctp','field_telefon');
    $query->addField('ctp','field_email_source');
    $query->addField('ctp','field_ulice');
    $query->addField('ctp','field_cislo_popisne');
    $query->addField('ctp','field_sidlo');
    $query->addField('ctp','field_smerovaci_cislo');
    $query->addField('ctp','field_funkce_cloveka');
    $query->addField('ctp','field_pracoviste');
    $query->addField('ctp','field_stat_iso');
    $query->orderBy('n.nid', 'ASC');

    $source_fields = array(
      'nid' => t('The node ID of the page'),
      'uid' => t('The user ID of a user'),
      'lid' => t('The location ID of a location instance'),
    );

    // Create a MigrateSource object, which manages retrieving the input data.
    $this->source = new MigrateSourceSQL($query, $source_fields);
    $this->destination = new MigrateDestinationProfile2('clovek');

// FIELD MAPPINGS    ...

Can anybody help me, please?


texts: How can I achieve this functionality to allow url prefixes without hacking the core?

texts:
Lets say I have a site example.com with the following urls:

example.com
example.com/page1
example.com/about

This is an American site, but I also want an Australian version.

The urls for the Australian site will be:

example.com/au
example.com/au/page1
example.com/au/about

The homepage and page1 are identical on both sites so the same content is served. However there is an Australian specific version of about so different content is served.

How can I map all of the /au pages to the ones without /au and somehow pass the fact that it is an AU page so I can determine what content to serve?

Update:

To clarify I want every single page that exists to be accessible via it's normal path alias, or the normal path alias prefixed with "au/".

I have managed to achieve this by editing bootstrap.inc in the following way:

A. Alter request_path(). After the line:

$path = substr(urldecode($request_path), $base_path_len + 1);

I added:

if(substr($path, 0, 3) == 'au/') {
  $path = substr($path, 3);
  $_SESSION['au'] = TRUE;
} else {
  $_SESSION['au'] = FALSE;
}

B. Alter drupal_settings_initialize(). After the $base_path has been set add:

if(isset($_SESSION['au']) && $_SESSION['au']) {
  $base_path = '/au/';
}

This means both /page and /au/page are treated in exactly the same way and I can use $_SESSION['au'] in a node preprocessor hook to determine which content to serve.

Now my question is how can I achieve this behaviour without hacking the core?


texts: How does Drupal display the correct time for a specific time zone?

texts:
I have a custom module that displays today's date and time:

t('Today: ') . date('d F - H:i')

When I change a user's time zone on their account page the time is 'magically' outputted correctly.

How does Drupal do this?


texts: Control where a new field is stored in the database D7

texts: I am interested in adding a field to the 'Product' content type in Ubercart 3 / Drupal 7.  I have read up on topics like field_create_field() and db_add_field() but I want my field to be stored as an additional column in the uc_products table in my database.  In addition, I want my new field (qid) to be called whenever I call up the $node value.  How would I go about doing this?


texts: How to implement validation of field values?

texts:
I'll soon be involved in a project that requires this, I haven't started yet. I have some experience with Drupal but I'm not that much of a programmer.

Here's how it goes:

Create a content type with field 1,2,3.
The user A adds a new node, filling those fields.
The user B can go through those fields and do some kind of "OK" in each one. This OK will only trigger something else that will show a cross or a check mark instead, it won't have any interference with the field, which will not be changed.
The user A1 adds a new node, and the user B has to go all the way again.

I'm asking your opinion on possible options to accomplish this.
I understand that maybe I'll have to write some code...

Here's the draw that illustrates this:


texts: Views/Content - list all values of a field, even if not chosen in the node

texts:
I have a content type for products. This has a (dropdown) field with values for each product. They choose a product and then enter the price for it.

If I want a view showing products that have been entered and their prices it works fine.

However, I want the view to show all products and their prices (if they have been entered).

e.g. I have available products: foo, bar, baz. There is a node for foo with a price of $10. No nodes for bar and baz yet.

My view shows:
foo, $10.

What I want is for it to show

foo, $10
bar
baz

There isn't, by default, a relationship I can add (e.g. Content: Products).

What's my best bet?


texts: How to add a block to the main page region?

texts: I want to add a simple blocks in the main page region. Instead of basic page or article I just want to add 4 blocks on that page. So, it looks like, Home page(Have blocks) >> sub-Home(have blocks) >> All Basic page(content). This looks simple but there is no way in the add block options where we can display as block and have a path.


texts: How can I consolidate the views that are auto generated by nodequeue

texts:
I'm using the nodequeue module to potentially create a large number of queues. With each new queue I create, a view is auto generated for that queue. Ultimately, I want to be able to access each queue as a view, but I'm wondering two things.

Are there performance implications to have in potentially hundreds of views created?
Isn't there a better way to display nodequeues in a view? why does there have to be a different view for each nodequeue ? isn't there a way to pass the relationship in through a contextual filter?


texts: How to create features for site configuration in drupal 7

texts: I have one requirement where all admin configuration need to be converted in to features eg caching must be enable


texts:
How do I set a view filter so that the date of item makes it disappear WHEN the event occurs?

Right now when I edit the filter I have it Operator set to 'is greater than or equal to' and the Value set to 'today', but I want it to disappear at the exact time the event is occurring.

What do I put in 'value' for that to happen?


texts: Drupal shortcuts - link with question mark included

texts:
When I add a link to shortcut set which looks like this:

admin/work?date_filter

shortcut module changes this question mark sign "?" into this "%3F" and this link doesn't work anymore. I believe I can't avoid it - looks like it's a bug, so my question is how to add link as a shortcut programically?


texts: how to publish a node content to the walll of a Facebook account?

texts: Just wondering if is there any module to let publish a node content (title, body and images) to the wall of a Facebook account?


texts: When you add media inside the Ckeditor. The media upload dialog has this checkbox option. Its a field inside the Image/Document Bundle. What does this option do? When uploading images/documents using the ckeditor or using a reference field. If I check this or not, the image is always added and listed in the Media library. Is it safe to hide this field from Editors? It says save to 'MY' media library, so is there a user media library that is different than the media view located at /admin/content/media/. I went to manage fields in both Image and Documents and made sure this field is not on by default. This is related to https://www.drupal.org/node/2757473


texts: How can I convert the code that used drupal_get_http_header() to check if a 403 or 404 error is returned?

texts:
I have a module that in hook_preprocess() checks with drupal_get_http_header() whether Drupal is returning a 403 or 404 error, but in Drupal 8 that function is deprecated, since header handling is being shifted to a Symfony response object.

The used code is similar to the following one.

$header = drupal_get_http_header('Status');

switch ($header) {
  case '403 Forbidden':
    // Add new headers.
    // …
    break;

  case '404 Not Found':
    // Add new headers.
    // …
    break;
}

What code should I use in Drupal 8? If that means to use a different hook, that is fine.

I would also be interested in the case I need to add HTML output to the page. I guess that in this case I should use hook_page_alter(), but I still don't know how to access the response object for the page being served.


texts:
I have to create a custom rule . Basically its a site for faculty.Before a faculty is added to site an authentication is done by there ldap server on first time login.After user is authenticated it redirects to site.Each faulty has there own vsite.So issue is that a faculty who has been removed from ldap then his/her vsite must be disabled.
Now is it possible to do it through Rule ??


texts: where to find the variables that can be changed through drush vset

texts:
There are several variables which we can change through drush vset command like changing the file_temporary_path, maintenance_mode, user_register

I just need to know, how can I know the relevant variable names for which I need to make any changes through drush vset