I think there are several ways to go about this, but with your current field setup and familiarity with template you can use the trans functionality in Twig (see https://www.drupal.org/node/2047135).

{% trans %}
  statistics: {{ node.field_max }}/{{ node.field_min }}/{{
node.field_min }}
{% endtrans %}

Other ways of doing things:

hook_entity_extra_field_info()
Display data via views (see nizz0k's answer)
Translate in PHP in the template preprocess function
Create a new field type that stores, min, max, and computes statistics via a Typed Data method.
Similarly to the above, add a typed data data type plugin to calculate statistics.


Rename a taxonomy vocabulary during migration

This could be achieved by using static_map plugin:

plugin: static_map
  bypass: true
  map:
    staff: departments


Having issues upgrading from Drush 6.3.0 to 8.0.5

It's not clear from your post how you are calling the phar, but you cannot call drush.php directly when using that variant. This technique (php drush.php) was recommended in Drush 3, but has been deprecated since Drush 4.  The script you show above will work for calling cron, but will fail for commands that cause Drush to call itself.

If you want to use the .phar, make sure that the correct version of php is in your $PATH, and then call Drush directly.

Alternately, you could install composer and run composer install in the Drush directory after installing the .tar.gz file, or cloning from git. If you do this, set the DRUSH_PHP environment variable to point at the php executable that you would like to use, and call the drush script (not drush.php).


How to create a rule to compare an order total with a custom field in a content type?

I'm assuming that your field_leveringsprijs (with "levering" = delivery, and "prijs" = price) corresponds to your minimum order price of your Restaurants content type.

If such field is not available as a token to use it in a Rules Condition, then the typical approach/solution is to use the Rules Action (not Rules Condition ...) "Fetch entity by id". So if you do have the id of the Retaurant available, just fetch the Restaurant (=some node of content type Restaurants). That will make all its fields, such as your field_leveringsprijs field, available for subsequent processing.

But, such Fetch entity by id is a Rules Action, so that's like you're too late to use the result of that Rules Action within the typical Rules Conditions (as you are trying to do in the data comparison shown in your question). The way to get around that, is to use either of following approaches:

Use the Conditional Rules module, which basically allows you to add a Rules Condition as part of the Rules Actions you want to perform. So using this module/technique, you'd specify something equivalent to "if order total is below field_leveringsprijs". And then add the actual Rules Actions you want to perform in that case (= perform a redirect, and show some message).
Create a Rules Component in which you execute (as Rules Actions) those actions such as that redirect and display a message). But which also includes a Rules Condition equivalent to "if order total is below field_leveringsprijs". And (this is crucial!) make sure to pass a "parameter" to this Rules Component, which will reprezent your field_leveringsprijs (with same data type). After you QA-tested your Rules Component, go back to your original Rule, and simply execute that Rules Component, by passing the appropriate value of the Rules Component parameter, using ... indeed ... your field_leveringsprijs (which you got via that "Fetch entity by id", remember?).


AJAX / AHAH 'Add More' Button on Unlimited Cardinality Fields Conflicts with Custom Submit Handler

try this:

function formalter_form_alter(&$form, $form_state, $form_id) {
  // override the default submit
  $form['#submit'] = array('inventory_stocking_ticket_form_gaylord_submit');
  // include the default submit and your custom submit
  //$form['#submit'][] = 'inventory_stocking_ticket_form_gaylord_submit';
}

function inventory_stocking_ticket_form_gaylord_submit(&$form, &$form_state) {
  if ($form_state['clicked_button']['#id'] == 'edit-gaylord-submit') {
    node_form_submit($form, $form_state);

    //do custom stuff here

  }
}


Pricing changes based on line item fields in the add to cart form

I think you want to stick with Variations for this.
Otherwise you can use Rules to calculate a price


How to pass parameter to 'options list' attribute in hook_rules_condition_info?

Have a look to the entity condition "entity_is_of_bundle"

In this example there are three parameters and they are displayed through a multistep form. To do this, you will need to alter the form. In this example, it is rules_condition_entity_is_of_bundle_form_alter

You can notice that depending on the form state, some elements are hidden. When you go to the next step, you can access form values. In this example, we can access entity bundles of the entity type as do the function rules_entity_bundle_options. The type of the entity is within $element->settings['type']

I hope it is clear for you.


It sounds that you should be able to implement what you want like so:

Add a custom field to your recipe, assume you use a machine name like "file-containing-recipe" (change this name to whatever fits).
For the file-containing-recipe field, specify a field type "file", and combine it with whatever other configuration options that fit (eg: single value or multiple values, optional or mandatory, etc).

To verify your configuration, create a node of content type recipe, and use the newly defined "file-containing-recipe"-field to actually attach your file(s). After saving the new node, verify if the results are what you're asking for. If (still) not, go back to your "file-containing-recipe"-configuration to further tune any of its settings.

Done.


Strange problem with autocomplete field in forms in Drupal 7

I have finally completely solved the issue. I copy the code which is working and below the code which was giving the error. Please some expert on Drupal to verify if I am right:

Working code:
 $items['especialURL/autocomplete/%'] = array(

'page callback' => '_mymodule_autocomplete' ,
 'page arguments' => array(2,3,4),

Wrong code:

$items['especialURL/autocomplete'] = array(
   'page callback' => '_mymodule_autocomplete' . '/' . arg(2) .'/'.arg(3) . '/' . arg(4),

Explanation: the wrong code worked perfectly but once I cleared cache, it stopt working. Somehow the page callback was registered until the cache was emptied, and from that moment it would stop working. Maybe starting with page callback in the form of _mymodule_autocomplete and later adding the args() would work for a while. Interesting. These have been the worst 5 hours of my life working with Drupal due to using the wrong code while I had got it to work just by chance!!!


Change image style in view depending on node type

Here is a better way to format your image or check out this post http://drupal.org/node/958726

$hero_image = array(
  'style_name' => 'case_study_teaser',
  'path' => $image['uri'],
  'width' => '',
  'height' => '',
  'alt' => $image['alt'],
  'title' => $image['title'],
  );
print theme('image_style',$hero_image);


How to overwrite a view template from within a module?

You can define the views template path directly within your module (following assumes views 2.x):

/**
 * Implementation of hook_views_api().
 */
function mymodule_views_api() {
  $path = drupal_get_path('module', 'mymodule');
  return array(
    'api' => 2.0,
    'path' => $path,
    'template path' => $path . '/templates',
  );
}

Check out the API documentation built into views for adding templates into your module: http:///help/views/api-default-views (<-- requires advanced help module)


Body field doesn't display in any view mode

I deleted the body field and I recreate it again. that's slove my problem, while I have not yet had any contents
I didn't find a second solution


"display" is pretty ambiguous, but you can get the site UUID like so:

$uuid = \Drupal::config('system.site')->get('uuid');

(depending on context, injecting the config.factory service would be preferable)

It's a string so rendering it will be easy.


How to programmatically set custom display settings for an RSS feed?

@JeremyFrench pointed out that the Features Module correctly exports the field settings for the view-mode, which fulfilled the middle step. No extra API calls is necessary.

My problem was with step 1. Though field settings are defined per-content-type and per-view-mode, the actual definition of view modes is independent of content-types. All content types share the same set of view modes, though each can implement their own field settings for that view mode.

This means that in my call to hook_entity_info_alter(), I should not have referenced customtype, I should just reference 'node'. That simple change enables everything to work.


Render arrays can contain render elements or theme templates.

Example for a render element:

'#type' => 'link'

and a theme template:

'#theme' => 'item_list'

Render elements have the parameter #attributes. This is defined in the base class Drupal\Core\Render\Element\RenderElement that all render and form elements are extended from.

That is not the case for templates in general.

The template links for example has #attributes and handles this in template_preprocess_links() in /core/includes/theme.inc.

The example from the question is item-list. This template has a variable #wrapper_attributes. You can see in the first line of the preprocess function how wrapper-attributes is transformed in an attributes object, which is then passed on to the twig template where it is placed in the list wrapper:

/**
 * Prepares variables for item list templates.
 *
 * Default template: item-list.html.twig.
 *
 * @param array $variables
 *   An associative array containing:
 *   - items: An array of items to be displayed in the list. Each item can be
 *     either a string or a render array. If #type, #theme, or #markup
 *     properties are not specified for child render arrays, they will be
 *     inherited from the parent list, allowing callers to specify larger
 *     nested lists without having to explicitly specify and repeat the
 *     render properties for all nested child lists.
 *   - title: A title to be prepended to the list.
 *   - list_type: The type of list to return (e.g. "ul", "ol").
 *   - wrapper_attributes: HTML attributes to be applied to the list wrapper.
 *
 * @see https://www.drupal.org/node/1842756
 */
function template_preprocess_item_list(&$variables) {
  $variables['wrapper_attributes'] = new Attribute($variables['wrapper_attributes']);
    foreach ($variables['items'] as &$item) {
    $attributes = array();
    // If the item value is an array, then it is a render array.
    if (is_array($item)) {
      // List items support attributes via the '#wrapper_attributes' property.
      if (isset($item['#wrapper_attributes'])) {
        $attributes = $item['#wrapper_attributes'];
      }

The template item_list has also the variable attributes, which is passed on to the twig template. Here you can see how this all ends up in the html markup, including the attributes of the items, which are collected for each item from wrapper-attributes in preprocess:

item-list.html.twig

{#
/**
 * @file
 * Theme override for an item list.
 *
 * Available variables:
 * - items: A list of items. Each item contains:
 *   - attributes: HTML attributes to be applied to each list item.
 *   - value: The content of the list element.
 * - title: The title of the list.
 * - list_type: The tag for list element ("ul" or "ol").
 * - wrapper_attributes: HTML attributes to be applied to the list wrapper.
 * - attributes: HTML attributes to be applied to the list.
 * - empty: A message to display when there are no items. Allowed value is a
 *   string or render array.
 * - context: A list of contextual data associated with the list. May contain:
 *   - list_style: The custom list style.
 *
 * @see template_preprocess_item_list()
 */
#}
{% if context.list_style %}
  {%- set wrapper_attributes = wrapper_attributes.addClass('item-list--' ~ context.list_style) %}
  {%- set attributes = attributes.addClass('item-list__' ~ context.list_style) %}
{% endif %}
{% if items or empty -%}

    {%- if title is not empty -%}

{{ title }}

    {%- endif -%}
    {%- if items -%}
      <{{ list_type }}{{ attributes }}>
        {%- for item in items -%}

{{ item.value }}

        {%- endfor -%}
      </{{ list_type }}>
    {%- else -%}
      {{- empty -}}
    {%- endif -%}

{%- endif %}

Btw. the wrapper is only placed in the classy theme, the base theme doesn't use this.

Conclusion:

Templates don't have attributes by default. As the examples show, they can handle them like render elements, under a different variable name or not at all.


Cache max-age doesn't correctly expire at midnight

I believe your flaw is that if there is day where no one views a node of bundle wt_lunch your nodes max age will get out of alignment; thus, your block will also be displaying an outdated node.

For this, don't use preprocess_node, use Job Scheduler or hook_cron instead.

You might also want to utilize the above with Ultimate Cron.


In general, every .tpl.php has what is called a "preprocess" function.  The default one for page.tpl.php is template_preprocess_page().  This sets up the variables that are available in the template.  Other modules and themes can have their own; then don't replace each other, rather, they all run in a defined order.

So, you would add in a preprocess function for your theme's template.php like:

function MYTHEME_preprocess_page(&$variables) {
  if (user_is_logged_in()) {
    $path = drupal_get_path('theme', 'MYTHEME');

    $variables['logo'] = file_create_url($path . '/images/inner_logo.png');
  }
}

This will check to see if the user is logged in using the proper API call (program to the interface not the implementation), and then change the logo variable to a new path from within your theme.  Just make sure you clear the Drupal caches from admin/config/development/performance first so the function gets picked up.


How can I access values of multiple select list in a form?

in case whether the user may select more than one item, size value be written like this way:

'#size' => $multiple ? min(12, count($options)) : 0,

this is how used in (taxonomy.module).


Views: how to add rel attribute to multivalue image thumbnail

You can install Image URL Formatter module. This will give you "Image URL" as a formatter option on Views.

So what to do is:

Add the image field, and Exclude from display. Set the formatter as Image URL
Add the same image field again. This one should be outputted as a thumbnail with Image Styles (perhaps), and have the normal "Image" formatter. Rewrite -> Output this image as a link, put the field added in step 1 to the link path.


what will be the cause of redirection loop while accessing view settings page

Five things I would check:

.htaccess rewrite rule?
Faulty alias? Check the table url_alias for any entry that contains admin/structure/views.
Redirect? If you have any redirect modules installed (globalredirect, redirect), check if there is a redirect set for the path in question.
Otherwise check the table menu_router, look for the path in the path column and see which function is set in the page_callback column. In D7 with Views 3 this should be ctools_export_ui_switcher_page.
Check your servers access and error logs to see if there's anything suspicious.


<?php
/**
 * Implements hook_menu()
 */
function mymodule_menu() {
  $items = array(
      'custom_menu_item' => array(
        'title' => 'Hello world',
        'page callback' => '_page_hello_world',
        'access callback' => TRUE,
      ),
    );
  return $items;
}

/**
 * Implements hook_theme().
 */
function mymodule_theme() {
  $theme = array();
  $theme['mymodule_template'] = array(
    'template' => 'mymodule-template',
  );
  return $theme;
}

/**
 * Preprocessor function for 'mymodule_template'.
 */
function template_preprocess_mymodule_template(&$vars) {
  $vars['hello'] = 'hello!';
}

/**
 * Page callback.
 */
function _page_hello_world() {
  return theme('mymodule_template');

}

A $hello variable is available in your template at path /custom_menu_item


How to insert drupal username and email fields into create booking form?

To create a new booking, the form for that already contains a (required) entity reference field to an existing user (with field_bt_user). Head over of admin/structure/booking/fields in your own site to get more details on that.

If you however want to add another username and email field, just use "Add new field" on admin/structure/booking/fields for both of those fields.

However, as per your "... so that the user is able to register while completing form ..." (as contained in your question), it appears to me that you want an anonymous user to be able to do so. If that's the case, you'll have to decide about how an anonymous user should complete that form, for the required field field_bt_user. You might think "just make that field no longer required", but I doubt that's a good idea to do, since there must be good reason for this module why that field is required.

Because of what is above, I think you should slightly adapt your workflow regarding that  "... so that the user is able to register while completing form ...":

Step 1: use the Rules module to intercept a path equal to /admin/structure/booking/add, if it is entered by an anonymous user, and redirect them to the login page, with an option to register and a Drupal message shown to them like "this path can only be used by authenticated users, try again after login" (piece of cake with Rules).
Step 2: wait for the login to be completed, and have the authenticated user enter the same path (/admin/structure/booking/add) again. When that happens, the Rules Actions in custom rule as in Step 1 will not be executed anymore (since user is authenticated), while the form is not used by an already registered user.

If you can't solve a problem,

then prevent the problem from ever happening again is a typical plan-b ...


How to check if a database is set up in settings.php?

global $databases has been removed in favor of the preexisting static connection info management methods on the Database class.

Drupal 7

global $databases;
// Check whether we have a default connection.
$has_connection = !empty($databases['default']['default']);

Drupal 8

use Drupal\Core\Database\Database;
$has_connection = (bool) Database::getConnectionInfo('default');

More links

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

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


TIP: Conflict when Module with same name as Theme!

Just in case someone else runs into this, if you have a module with the same name as your theme (xxx, for example), the xxx.libraries.yml file in your theme folder is ignored. Instead, Drupal looks at the xxx.libraries.yml file in your modules folder. Any files referred to by it (css, js, etc.) are also loaded from the modules folder and its subfolders, not from the themes folder.


I did some searches but I couldn't find any module that does this. But you can implement the hook_node_view() like this:

function YOUR_MODULE_node_view($node, $view_mode, $langcode) {
    global $user;
    //verify that the user is not loged and the view mode is full view
    if(in_array('anonymous user', $user->roles) && $view_mode == 'full') {
        //denied the access
        drupal_access_denied();
        //avoids other hooks are invoked
        drupal_exit();
    }
}

I tested the above code and it works.


I think the String overrides module would be the quickest way. The module:

  Provides a quick and easy way to replace any text on the site.


How to display background images from CSS included by modules

Basically given:

background: url('images/stadium.jpg') no-repeat left top;

The image will be loaded from the path relative to the CSS file.

e.g:

/styles.css
/images/stadium.jpg

The image is loaded from the relative 'images' subfolder.

Presumably, if the design is all controlled by a module, you could drupal_add_css the css file and have the image files relative to that in the module folder.


Install Image URL Formatter and change the format to its url. To do so create a view of set of nodes, select the image as the field and change its format to URL. You can also change the format to URL in the manage display of the content type.


Try something like this:

/**
 * Implements hook_form_FORM_ID_alter().
 */
function MY_MODULE_form_commerce_cart_add_to_cart_form_alter(&$form, &$form_state, $form_id) {

  //drupal_set_message($form_id);

  $form['submit']['#attributes']['value'] = t('Buy Now');

  /*
  $current_product = $form_state['default_product'];
  if ($current_product->type == 'product') {
    // Make alternations for products...
  }
  */

}

You can use the $form_id and/or $current_product to make custom alterations for a specific product(s) and/or product type(s).

Flush Drupal's caches so your custom form alteration hook will be recognized.

Note, I'd also like to point out that once a user changes a value on the add to cart form, and the form is reloaded via AJAX, MY_MODULE_form_commerce_cart_add_to_cart_form_alter() will be called again, which is good.

However, it appears the $form_state['default_product']->language value may only be present the first time the page is loaded. Once the form is reloaded via AJAX, the language value may be empty in this hook, so watch out if your code is depending on it being there!


Print Title, Header and in Different divs

A simple solution to this would be to create a new view, with a block display, and add a contextual filter to get the current node ID from the url. Then select a field you would like and add it to the view, for example; "Header". Once you've done that then save.

Visit the "Blocks" admin page and add the block to the "Header" region of your page. Your theme should already have these. Restrict the block to display only for that content type, and then repeat this whole process for your footer field.

There are more dynamic solutions, I'm partial to Display Suite these days, something to think about if your looking to make more complex displays.


How do I ouput a node reference field using a node reference template in Drupal 7?

This module has one display formatter named Rendered node, in its setting you can select view mode which referenced node will render in that view mode.

so you can define new view mode and configure referenced node in that view mode

have a look at this post: http://mearra.com/blogs/juha-niemi/drupal-7-custom-node-view-modes


View users contributed content in profile

In the views UI

Your view must be a view of nodes
Then, add a relationship with the node's author (the relation is: Content: Author)
Then, add an other relationship : select user and check profile. Then you can use the profile node in Contextual filters or Filter criteria. The technic part is that it is a relationship of relationship ;)


Reindex Search API indexes for Behat testing

The ultimate solution is $search_api_index->server()->commit() which needed because, there's a commit delay which you can set inside the solrconfig.xml and this delay cause the problem. (Or you can just sleep(1) your code, but that's not flexible at all and ugly...)


Alternatively use hook_node_view_alter() and drupal_add_js()

drupal_add_js('path/to/file.js', 'file');


What is the need to have the Unicode class?

The reasons to have its own replacement of strtoupper and strtolower() is to support multi-bytes string in those sites where the Multibyte String extension is installed, and in those sites where that extension is not installed.

strtoupper() and strtolower() don't support multi-byte strings. Even in the case Drupal would not try to use the Multibyte String extension when installed, Unicode::strtoupper() and Unicode::strtolower() would not be reduced to simply calls to strtoupper() and strtolower(). Their code would probably be the following one.

public static function strtoupper($text) {
  // Use C-locale for ASCII-only uppercase.
  $text = strtoupper($text);
  // Case flip Latin-1 accented letters.
  $text = preg_replace_callback('/\xC3[\xA0-\xB6\xB8-\xBE]/', '\Drupal\Component\Utility\Unicode::caseFlip', $text);
  return $text;
}

public static function strtolower($text) {
  // Use C-locale for ASCII-only lowercase.
  $text = strtolower($text);
  // Case flip Latin-1 accented letters.
  $text = preg_replace_callback('/\xC3[\x80-\x96\x98-\x9E]/', '\Drupal\Component\Utility\Unicode::caseFlip', $text);
  return $text;
}

If Drupal required the Multibyte String extension to be present, then Unicode::strtoupper() and Unicode::strtolower() would not be necessary, since Drupal would use directly mb_strtoupper() and mb_strtolower().

That is not different from what happened in previous versions, except they implemented drupal_strtouppper() and drupal_strtolower(). If you look at the code, it is not much different.

function drupal_strtoupper($text) {
  global $multibyte;
  if ($multibyte == UNICODE_MULTIBYTE) {
    return mb_strtoupper($text);
  }
  else {
    // Use C-locale for ASCII-only uppercase
    $text = strtoupper($text);
    // Case flip Latin-1 accented letters
    $text = preg_replace_callback('/\xC3[\xA0-\xB6\xB8-\xBE]/', '_unicode_caseflip', $text);
    return $text;
  }
}

public static function strtoupper($text) {
  if (static::getStatus() == static::STATUS_MULTIBYTE) {
    return mb_strtoupper($text);
  }
  else {
    // Use C-locale for ASCII-only uppercase.
    $text = strtoupper($text);
    // Case flip Latin-1 accented letters.
    $text = preg_replace_callback('/\xC3[\xA0-\xB6\xB8-\xBE]/', '\Drupal\Component\Utility\Unicode::caseFlip', $text);
    return $text;
  }
}


Admin block listing showing unwanted debug info

That looks like someone put a print_r or similar debugging call into your copy of Seven. If you are using git (which your project should be) you will be able to see the change in that tool and undo it.  The other solution would be to download a fresh copy of Drupal and replace the files in the core directory with the ones in the fresh copy.

If there are multiple people working on the project, ask around about who was testing out ideas and ask them to undo the changes to the admin theme.


Drupal doesn't provide you with an alias for jQuery, because these days it'll inevitably interfere with another library sometime later.

If you want $ as an alias, you'll need to create it yourself:

(function($) {
  // your code...
})(jQuery);


I think your Google-fu has failed you  :)

Commerce price table:

  Drupal Commerce contrib project that allows to have a secondary price field that considers the quantity for displaying and using the prices. It also provides a field formatter to display the price/quantity values as a table.


MailChimp Error: API Key cannot be blank

Mistake: I've not correctly installed the mailchimp php library. Instead of showing this in the status report page the module crashes the website.


update user's profile field from another form

You have to modify your form in a hook_form_alter : and the linked_in url will appear in the event registration form

function mymodule_form_alter(&$form, &$form_state, $form_id){
   if ($form_id == 'eventregistration_node_form'){

      // Find the user obj
      global $user;
      // Load all profile fields
      $account = user_load($user->uid);
      // Add the linked_in url in the event registration form
      // Supposing your field madhine name is ; linkedin_url
      // Supposing you use the link module for this field (if not, change ['url'] to ['value']
      $form['linkedin_url']['und'][0]['url']['#default_value'] = $user->linkedin_url['und'][0]['url'];
   }
}

If you don't want to expose the linked_in field during the form do this :

function mymodule_form_alter(&$form, &$form_state, $form_id){
   if ($form_id == 'eventregistration_node_form'){
     // Hide your field
     $form['linkedin_url'][und]['#access']  = false;
     //Add another submit function
      $form['actions']['submit']['#validate'][] = 'mymodule_eventregistration_validate_form_alter';
   }
}

// Your submit function
function mymodule_eventregistration_validate_form_alter($form, $form_alter){

     // Find the user obj
      global $user;
      // Load all profile fields
      $account = user_load($user->uid);
      // Add the linked_in url in the event registration form
      // Supposing your field madhine name is ; linkedin_url
      // Supposing you use the link module for this field (if not, change ['url'] to ['value']
      $linkedin_url = $user->linkedin_url['und'][0]['url'];

    form_set_value($form['linkedin_url'], array('und' => array(0 => array('url' => $linkedin_url))), $form_state);
}


Generate menu links for a view with contextual filter and parameters in the path

Never mind - solved it. In the view definition, I changed the path from /fruit_view to /fruit_view/%fruittype, and I got the URLs as I wanted them. I also had to remove the menu voice defined in the view, but that's not a problem, since I have to redefine the filtered ones anyway.


How can I let anonymous users view user profiles by role?

You can use Views to achieve this. Under Page Settings change Access to Role & select Anonymous users from the list. Check exported view shown below:

$view = new view();
$view->name = 'user_profiles';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'users';
$view->human_name = 'User Profiles';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'User Profiles';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'role';
$handler->display->display_options['access']['role'] = array(
  1 => '1',
);
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'table';
/* Field: User: Uid */
$handler->display->display_options['fields']['uid']['id'] = 'uid';
$handler->display->display_options['fields']['uid']['table'] = 'users';
$handler->display->display_options['fields']['uid']['field'] = 'uid';
$handler->display->display_options['fields']['uid']['label'] = '';
$handler->display->display_options['fields']['uid']['exclude'] = TRUE;
$handler->display->display_options['fields']['uid']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['uid']['link_to_user'] = FALSE;
/* Field: User: Name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'users';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['alter']['make_link'] = TRUE;
$handler->display->display_options['fields']['name']['alter']['path'] = 'user-profile/[uid]';
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['name']['link_to_user'] = FALSE;
/* Sort criterion: User: Created date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'users';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: User: Active */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'users';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = '1';
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: User: Roles */
$handler->display->display_options['filters']['rid']['id'] = 'rid';
$handler->display->display_options['filters']['rid']['table'] = 'users_roles';
$handler->display->display_options['filters']['rid']['field'] = 'rid';
$handler->display->display_options['filters']['rid']['value'] = array(
  5 => '5',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'user-profiles';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '1';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['defaults']['fields'] = FALSE;
/* Field: User: Rendered User */
$handler->display->display_options['fields']['rendered_entity']['id'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['table'] = 'views_entity_user';
$handler->display->display_options['fields']['rendered_entity']['field'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['label'] = '';
$handler->display->display_options['fields']['rendered_entity']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['rendered_entity']['link_to_entity'] = 1;
$handler->display->display_options['fields']['rendered_entity']['display'] = 'view';
$handler->display->display_options['fields']['rendered_entity']['view_mode'] = 'full';
$handler->display->display_options['fields']['rendered_entity']['bypass_access'] = 1;
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: User: Uid */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'users';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['default_action'] = 'default';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'user';
$handler->display->display_options['arguments']['uid']['default_argument_options']['user'] = FALSE;
$handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['path'] = 'user-profile/%';

In my case, I wanted to list user of role field executive.


Webform : A partially-completed form was found. Please complete the remaining portions

Try this:
Delete the form submission that is having problem(that is the submission id that is partially filled) in the following tables:

webform_submitted_data
webform_submission


_form_comment_form_alter for certain node type

You should use comment form ID for that content type: hook_form_comment_node_xxx_form_alter

which comment_node_xxx_form is comment form id for content type xxx:

function hook_form_comment_node_xxx_form_alter(&$form, &$form_state, $form_id) {
    ...
}


How do programmatically create fields for content types, and ADD them to the the content type form

You're almost there.

From your code:

'bundle' => 'my_content_type',

Replace my_content_type with the name of the content type you want it attached to.

Here's a full example of adding a Alias text field to the Article content type. (from monarchdigital.com)

/**
 * Update hook to add a field to a node.
 */
function my_module_update_7000() {
  $field_name = 'field_alias';
  // Make sure the field doesn't already exist.
  if (!field_info_field($field_name)) {
    // Create the field.
    $field = array(
      'field_name' => $field_name,
      'type' => 'text',
      'settings' => array('max_length' => 64),
    );
    field_create_field($field);

    // Create the instance.
    $instance = array( 'field_name' => $field_name,
      'entity_type' => 'node',
      'bundle' => 'article',
      'label' => 'Alias',
      'description' => 'The article alias.',
      'required' => TRUE,
    );
    field_create_instance($instance);

    watchdog('my_module', t('!field_name was added successfully.', array('!field_name' => $field_name)));
  }
  else {
    watchdog('my_module', t('!field_name already exists.', array('!field_name' => $field_name)));
  }
}


How can I automatically position a block in Drupal 7 (via a script, Drush, etc.)?

Updated answer:

I just committed https://drupal.org/comment/7000524 to support the Drush block commands in Drupal 7.  I also added a shortcut mode, where arguments can be used in place of options in instances where doing so would be unambiguous.  When calling block-configure from a bash script, though, you should always use the options form; otherwise, your script would break if a specification became ambiguous (e.g. if someone added a block whose delta was named the same as some region).

So, from the commandline:

$ drush block-configure switch_user sidebar_second 10

From a bash script:

drush block-configure --module=devel --delta=switch_user --region=sidebar_second --weight=10

The later works just fine from the command line, of course; it's just more typing.


I use this module https://www.drupal.org/project/link_attributes

It allows you to add classes/ids to menu items by editing them through Drupal's core menu admin screens


Assigning entity (node) to group (og) programmatically

According to the API documentation, my code was missing an underscore character, and I should pass in the entity. So instead of

$result = og_group('node', $form_state['values']['group_id'], ['entity type' => 'node', 'entity' => $ewrapper, 'state' => OG_STATE_ACTIVE]);

it should be

$result = og_group('node', $form_state['values']['group_id'], ['entity_type' => 'node', 'entity' => $entity->nid, 'state' => OG_STATE_ACTIVE]);


Drupal 6 - theme the standard nodequeue admin view

You can use views to prepare you listing according to your need. You can add as many CCK fields in column & expose filters too to use it further.

You can add your prepared views block at the dashboard which your admin can use.


How do I get a HTML value from $form_state?

From the HTML you show, I get that the partial content of $dates is the following.

$dates = array(
  0 => '
Aug 13, 2012 - Sep 24, 2012

$350.00 CAD
'
);

What you can do to get the 350.0 value is changing $dates to the following.

$dates = array(
  '350.0' => '
Aug 13, 2012 - Sep 24, 2012

$350.00 CAD
',
  // ...
);

In that way, $form_state['values']['info']['prog_dates'] would contain '350.0', if the users select the radio button I shown.

From the HTML you shown, I get that in the form you set #tree to TRUE. Differently, the HTML name assigned to the radio form field would not be info[prog_dates] as in your case, but prog_dates. If I am wrong about that, it means you need to check the value of $form_state['values']['prog_dates'], instead of $form_state['values']['info']['prog_dates'].


There are multiple ways to do it. The easiest way would be to use views. You can create a view of taxonomy terms with only an image field and display it as a view block.

See an example of view below.

Let me know if you need any help.


Slider via uploaded Image on each node + Fallback

Solved because I've found out that block views don't retrieve node-ids by default.

You have to set at "When the filter value is NOT available":
- Provide default value: with type "Content ID from URL"

Now the block view recognizes the ID as well.


You need to either disable cache entirely with max-age = 0 or to make it vary based on the GET argument value, which is the better way unless your GET argument unique for everyone or most people.

Something like $form['#cache']['max-age'] = 0;

See https://www.drupal.org/developing/api/8/render/arrays/cacheability for the documentation.


First you must enable the following modules:

1. Mailsystem module  http://drupal.org/project/mailsystem
 2. Mimemail module http://drupal.org/project/mimemail (it contains the mail actions and sending mail function) or you can use htmlmail module  http://drupal.org/project/htmlmail
 3. Rules module http://drupal.org/project/rules

After that you will do some steps:

1. Create new rule in admin/config/workflow/rules/reaction/add and select the "React on event" is "After saving new content".
 2. Add a condition. Choose Node (Content is of type) for condition and choose your custom content type in the "Content types" list box.
 3. Add another condition.  Choose User(User has roles()). Choose data selector is "node:author" and choose the role of donor.
 4. Add the action. Choose System (Send HTML email). You'll change the To, CC, subject, content here.
 5. Try to test that.

Be sure that you can send email using your system. If you use the htmlmail module. It will have the send test email in its setting.


Rules: use a View's result as a condition?

Even though your own answer is indeed a way to solve your question, it doesn't say that for this to work, it requires the Conditional Rules module to be enabled (without that, you cannot add a Rules Condition as an extra rules Action).

An alternative solution to solve your question, is to use the Views Bulk Operations (VBO) module to transform your view into a VBO view, so that you can use a Rules Condition "Check number of results returned by a VBO View" in which you can perfectly construct the Rules Condition you're looking for.

Have a look at "this answer" for an illustration of how this specific Rules Condition is used.

PS: I'm assuming this question is about D7.


Stop from going to node on content creation

The Add another module might come in handy for that:

  Add another is designed to save time during repetitive content creation. It allows the content creator to add another node of the same type much faster.

It provides a 'Save and add another' button in addition to the standard 'Save' button on node forms.


How to add a second Contextual Filter to the calendar view? (this view is automatically created by the calendar module)?

What are you trying to achieve exactly? You want to restrict the calender to show only nodes tagged with a certain term?

It looks like you're trying to do this by setting up a relationship with the terms and then passing in the term name. Is there a reason why you're not using the Content: Has taxonomy term ID contextual filter? This cuts out the need for the relationship, but requires you to pass a term ID rather than a term name.

If there is a reason why you're not doing this, then ignore me :) Just thought I'd reply in case you didn't know about it.


When an image shows up in "page not found" in Watchdog, how to find the content containing the image link?

This is not the ultimate solution, but in this specific case, since I moved the icons into another module, to fix this particular error I just symlinked the folders:

mkdir countryicons_shiny
cd countryicons_shiny
ln -s ../mycustommodule/countryiconsdirectory images


How do you change the LDAP DN for a user?

If memory serves me the DN will get auto updated next time they log in.  No editing necessary.


Same thing i do in my module may be it is set to you requirement

    global $content;
    $content .= '<button class="btn btn-primary" data-toggle="modal" data-target=".bd-example-modal-lg">Apply</button>';
    $content .= '
';
    $content .= '
';
    $content .= '
';
    $content .= drupal_render($form);
    $content .= '
';
    $content .= '
';
    $content .= '
';
    return $content;


How to handle multiple forms' submission in a custom module by clicking on a link

Drupal requires a submit button to submit - it uses the value of the submit button to determine which form was submitted.

Add a submit button to your form, and instead of executing $.submit() on your form, execute $.mousedown() on the hidden submit button.


If you are going to do this often, or expect changes that require these two types to be in sync in the future, you might investigate the http://drupal.org/project/features module, which packages stuff up like this.  But, if it's a one off thing, I'd just go and create a new content type and reuse the existing fields plus the new/different ones in the second content type.  If you don't want to type everything in again, you should be able to use the CCK export feature and then just change the name and type of the result and import it, which if all goes well, will create the second type for you identically to the first.  Then just add the new/different fields manually.


It really sounds like the team name is a tag based on a Taxonomy Term. You could make a taxonomy called Teams and add a term_reference to your node type. Views can then make an exposed filter based on the term reference.

Using the autocomplete widget for the field will auto create non-existing team names. For more UI flexibility see Autocoplete Deluxe.


Customize "Access Denied" (403) page for specific content type

You could do that using the rules module.

Create a rule using the Rules module, with as Event something like After visiting node no_access. So that the entire rule configuration would look something like this:

Events: After visiting node no_access

Conditions:
        User has role - Parameter: User: [site:current-user], Roles: anonymous user
        NOT Text comparison - Parameter: Text: [site:current-page:url], Matching text: user/login

Actions: Page redirect - Parameter: URL: user/login

And then for the logged in user, you can create another rule that checks if the user is logged in, and then redirects to a custom page if the user visits a no_access page.

For the general access denied page, you can set a url in Admin > Configuration > System > Site information, under error pages.

Hope it helps


Ask user for URL on registration and create feed from the URL on his/her profile page

Since you already know how to do it in PHP, you could use the Panels module. You can then use a Panel to display the user's profile, and you can add a "Custom" field with your php inside.

You could also do something similar by using the Display Suite module and adding a custom code field.

Of course that would require you put php directly into the UI, which isn't always considered the best approach but can be done. To get the user's username, you'd put a field in their profile asking them the user name. That value would then be stored in the $account object.


Ajax pager failure in view after modifying view on hook_views_query_alter

When the view query is being called from inside the pager, the requesting URL is different. It becomes: '/views/ajax'. This URL does not match any that had been specified in my context, so no results were returned.

I solved the problem by checking if the query view is being called within the pager -- i.e. if $_SERVER["REQUEST_URI"] == '/views/ajax'. If so, then I extract the correct path instead from $_SERVER["HTTP_REFERER"]. If not, then it's okay to accept the path from $_SERVER["REQUEST_URI"].


How to fix broken file.module function 'file_ajax_progress' without hacking the core and patching after every update?

Patching core is not the same as hacking core.  Many of us have patched versions of Drupal in the wild (eg, using Secure Pages).

You need to work out how you want to manage this between upgrades.

On sites where I don't track Drupal's repo, I keep a directory of patches next to the DOCROOT.  Before I upgrade, I check on whether the patch is needed or not.  I then drush pm-update drupal and apply patches.

On sites that I have built with git, I can typically build the site in its own branch, apply patches, and then upgrade core versions by merging the latest tag and doing the database updates.


How do I programmatically show a view block?

Use views_embed_view():

echo views_embed_view('view_machine_name', 'block_1');

You can find out the display name by clicking the tab and check its name in the address bar of your browser: #views-tab-block_1 gives you block_1.


Where to add Drupal.t function in a javascript

$(language).find('.content').append("
" + Drupal.t('Next step') + "
");  // add next steps to demo voice list


How to use checkbox under description of any webform field?

You will create a check box component fields below mobile phone number fields after "yes|I am providing my express..." in OPTIONS .
   Create Check box -> Options -> "yes|I am providing my express..."

and align with CSS code


When confirming installation of modules, I get a server error (500)

Hoeray! I found it myself :)
It appears, you can increase the limit on multiple places like described on this page.

Thanks @Clive for the effort though!


Convert a SQL database design to a drupal schema installation file

I knew of a few possabilities, only 2 may work. I haven't tried:

dbtng_migrator - migrates a drupal db to different DBMS engines at will. no schema export support.

Data - module to move data into and out of drupal databases.

  The Data module provides

  an API for dynamically allocating tables for single-row records. an
  API for insert/update/delete operations and describing how tables join
  to each other. automatic views integration. a way to export table
  definitions to code.

Schema - drush dl schema Includes the following functionality not found in Core:

  Schema structure generation: the module examines the live database and
  creates Schema API data structures for all tables that match the live
  database.

I have a drupal DB with other database connections defined in settings.php. You can go into Schema settings and tell to look at any named database connection (by default drupal is default). Here I select dew_remote_sources -- a "remote" (non drupal) database of data. The inspect tab then lists the SchemaAPI hook_schema defintion for each table with dummy comments to fillin.

Lastly views_schema is pretty cool. It creates the hook_views_data for drupal tables based on their schema api definition.

Honestly I dont think you looked at @4Life answer close enough because given a db connection string, Schema does what you want.


This module may help: Select (or other)

Or maybe you want use form alter and #state attribute: http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#states


Get UC product attributes using Views Global PHP

If you use a variable in your request, it's preferable to use it like this : WHERE o.order_id = :oid', array(':oid' => $row->order_id).

So I guess it would be :

$request = db_query('SELECT o.data FROM {uc_order_products} o WHERE o.order_id= :oid', array(':oid' => $row->order_id)')->fetchField();

To have different fields, you can do this processus for each field, by using multiple PhP fields in your view. But to rationalize requests, I would first do that request in the "setup code"  and set all your data in the $static variable.


Remove entities programmatically from view results before pager is generated

You need to alter the query in one way or another, that is the only way the pager can work.

Sounds like you are using nodes, then you can use the node access grant system. Basically, it allows you to "index" the access checks and assign attributes to the nodes, like the group they belong to. And then there is a second hook, that allows you to define what groups (or whatever it is in your case) the user has access to. This will then be combined into a query for you.

Be aware that this is one of the most complicated systems in Drupal, but if you can't do the access check directly as part of the query (like checking the value of a certain field), then this is the only way.


How to debug TransactionOutOfOrderException: in DatabaseConnection->rollback() in database.inc?

Basically the TransactionOutOfOrderException exception is triggered by transaction being rolled-back (see: rollback()) called by Commerce module which was triggered by inability to save your entity (such as validation errors like saving empty values for required fields). Check commerce_line_item.controller.inc or commerce_order.controller.inc files for more details when exactly rollback is triggered.

Since you're using entity metadata wrappers, it is strongly recommended that you should implement try...catch section to catch exceptions and add debugging errors into watchdog. Here is the sample syntax of saving node wrapper:

try {
  $node_wrapper = entity_metadata_wrapper('node', $node);
  $price = $node_wrapper->field_product->field_price->value();
}
catch (EntityMetadataWrapperException $exc) {
  watchdog(
    'MODULE_NAME',
    'EntityMetadataWrapper exception in %function() <pre>@trace</pre>',
    array('%function' => __FUNCTION__, '@trace' => $exc->getTraceAsString()),
    WATCHDOG_ERROR
  );
}

So adequately your code should look like:

if (empty($form_state['values']['product'])) {
  drupal_set_message(t('Missing product on the submit form! Form values: @values',
    array('@values' => print_r($form_state['values'], TRUE)), 'error');
  return;
}
// @todo: Do above condition for other parameters as well.
$selected_month = $form_state['values']['month'];
$selected_year = $form_state['values']['year'];
$order = commerce_order_new($form_state['values']['user'], 'checkout_checkout');
commerce_order_save($order);

try {
  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
  $product = commerce_product_load($form_state['values']['product']);
  $line_item = commerce_product_line_item_new($product, 1, $order->order_id);
  commerce_line_item_save($line_item);
}
catch (Exception $e) {
  drupal_set_message(t('Error saving line item: @item, message: @error.',
    array('@item' => print_r($line_item, TRUE), '@error' => $e->getMessage())), 'error');
  watchdog_exception('mymodule', $e);
}

try {
  $order_wrapper->commerce_line_items[] = $line_item;
  $order_wrapper->save();
catch (Exception $e) {
  drupal_set_message(t('Error saving order: @order, message: @error.',
    array('@order' => print_r($order_wrapper, TRUE), '@error' => $e->getMessage())), 'error');
  watchdog_exception('mymodule', $e);
}

Note: Test the above code first on your testing environment.

So basically by implementing more logging into your code, you can see further what's missing and why it's failing.

For further debugging, ideally you should setup your local environment with copy of the database and reproduce the problem on your development machine.

Since you're dealing with submit handler, for easier debugging, you can use DevTools (in the supported browser) where you can repeat XHR requests, so you can see results after code changes without filling out the complex forms. If your form will require different token on each submit, ideally you should add die()/exit(); to prevent the form being completely submitted, this way you can test your form using quick and repeatable method.

For more sophisticated debugging, you should use step-by-step debugger by using some IDE editors which can support that, by enabling XDebug PHP extension. Or generate the trace file which can help you to find out more about your issue.


Cannot import database. An error occuring in wamp server

To make this on-topic on a Drupal Answers, you should have asked: How do I migrate a Drupal configuration from a WAMP server?

I'll pretend you did that, and suggest you take a close look at the Backup and Migrate module.

It knows about Drupal-specific stuff (such as what tables are not worth migrating), and is also very simple to use.


This is, presumably, by design. If you look at Search Config's query alter function, you can see that the function returns (without limiting results) if you're you're the superuser. Hence, when you're logged in with UID = 1 you will not see the pagination.


Possible?

Probably. But it would require a lot of work, as you would basically have to provide all the data and calls that such plugins need. That is very likely more work than re-implementing this functionality yourself.

And creating an entity type would only make sense if you need to manage multiple "things" that each has images attached.


When you write $variables['options']['attributes'] = ['target' => '_blank'] you are replacing all attributes, never ever do that!

Only set specific keys:
$variables['options']['attributes']['target'] = '_blank'.

If that key is an array, append your value:
$variables['options']['attributes']['class'][] = 'appended_class'


Users cannot log in to new site in multisite

This issue might be a variation of the question about "drupal /?q=user is working but /user not working". So verify if you can use an URL containing ?q=user or ?q=admin. If that gets you going, then probably tuning RewriteBase in your .htaccess (as described in the accepted answer of that question) should help.

It might be worth trying to further enhance your .htaccess file, by adding a line after that existing RewriteBase, which looks like so:

RewriteRule . index.php [L]

For more details on the above line, refer to the (accepted) answer in this question on StackOverflow.

Another option for debugging is to retry using another browser. If via that browser you are able to login, then it's probably a cookie problem (in your original browser).


Is it possible to set: "show block on specific pages" into "is only the listed pages", programmatically?

You need to set,  visibility => 'BLOCK_VISIBILITY_LISTED'

function menuNode_block_info() {
  $blocks['Course'] = array(
    'info' => t('Dit toont alle blocken weer'),
    'region' => 'sidebar_first',
    'weight' => 1,
    'status' => 1,
    'visibility' => 'BLOCK_VISIBILITY_LISTED',
    'pages' => "overview_courses/course",
    'cache' => 'DRUPAL_NO_CACHE',
  );
  return $blocks;
}


How to find and remove string in front of URL?

I see many problems in the code you posted in your question. First of all, you are missing a parameter in preg_replace. Take a look at the PHP documentation.

Second, you have no delimiters in your pattern. The correct pattern should be:

$patt = '/.+\//';

(You don't need the parenthesis, but you do need delimiters such as slash bars. See this).

Third, preg_replace() returns an array with the replacement. You need to assign the result to $alias, as in $alias = preg_replace(...)

I have not use this hook before, but keep in mind (from the description) that this is only invoked before the alias is saved.


Multiple database group users for one database

Although the question is a little unclear, it sounds like you just need 3 roles in your Drupal install

Administrator
Writer
Anonymous ( built-in )

You can add the roles at /admin/people/permissions/roles and configure access permissions for each role, regarding node creation etc, at /admin/people/permissions


Migrating a huge live drupal 6 site to drupal 7 Server

This topic is already well covered in the Drupal documentation.


Pre process a template that uses layout display

It appears quite easy to achieve what I want:
I needed to create a conditional field functionality. I know there is a module for that but at this time the module is not stable and not performing well with layout builder.
As indicated by @CG Monroe the last called template is field.html.twig.
If this is a user field the fully loaded user is available in:
$variables['elements']['#object']

So I could access all the user fields I needed to manipulate the field output in the preprocess function
function my_module_preprocess_field(&$variables) {
  $field = $variables['elements']['#object']->field_some_other_field->value;
  // now I can manipulate the output of the field being viewed
  // the manipulation is needed because of the value of "some-other-field"
  $variables['items'][0]['content']['#context']['value'] = ' ***  ****';
  $variables['items'][0]['attributes']->addClass('my-module-field-manipulated');
}


You should use migrate module, it's in drupal8's core.

You can define migrations for blocks, nodes, comments, users ... and launch then when you need.

You can select "update" option to syncronize imported content on your new site with changed content on old site.

Here's the offical doc of migrate:
https://www.drupal.org/migrate


Unable to edit custom block without administrator permissions

To edit the blocks in layout builder, the user needs to have permission to use contextual links.


Turned out to be a conflict with the Superfish menu module. Leaving this here because several other people have reported similar issues and this might help.


Why is the third level not showing in my superfish menu?

I would give this a try:

  In the drupal bloc configuration just disable "Slide-in effect"

Quoting the last comment from this thread:
https://github.com/joeldbirch/superfish/issues/30

Hope you get lucky with this, that whole github thread could be also interesting/relevant to your issue.

Update: This is apparently a theme specific superfish implementation, the respective theme being (most probably) Nexus

In order to deactive the effects that could be causing the error, you should edit the file sites/all/themes/nexus/js/custom.js at about line 7, commenting out the animation options:

//  animation:   { opacity:'show',height:'show'},   // fade-in and slide-down animation

Hope this does the trick!


Workbench: How can I reorder display of Workbench Tabs?

under the view Table Display Settings. You should be able to assign placement of the columns there.

See the Format > Table > Settings at the left:

Then assign fields to certain columns here. The ordering of these columns by default is the ordering of the Fields defined in the View.


Filter a view by the Group ID of the current logged in user

I just ran into this today. Found this article and here's the solution I did (only available recently).

I create Content view showing the Content Types that I want. I setup the Relationship to "Content group content" (checkmarking the Content Types I want). I then add a second Relationship to "Group" which is now available (based on the first relationship).

Once the relationships are done, I have access to add a new filter of Group ID.  I can manually enter a group ID number and it works... but current user has not been addressed yet.

Now I install:
https://www.drupal.org/project/token_views_filter
critically, with this patch:
https://www.drupal.org/project/token_views_filter/issues/3038695

I can go back into my Group ID filter and checkbox the "Use tokens".  Now I can access information about the current user via Tokens.

I felt like I should have been able to setup a Contextual Filter for this... but the system didn't allow for it, so this was my work around.


Use part of the user_profile_form on another page

I made this work based on the work by Erik. I guess you could do ['#access']=false for all the values you don't want.

//Provide a custom page at /custom-profile to access our custom profile form
function mymodule_menu() {
  $items['custom-profile'] = array(
   'title' => 'Custom Profile!',
   'page callback' => 'mymodule_custom_profile',
   'access callback' => TRUE,
   'type' => MENU_NORMAL_ITEM,
 );
}

//displays the custom form at /custom-profile
function mymodule_custom_profile() {
  module_load_include('inc', 'user', 'user.pages');

  global $user;
  $user = user_load($user->uid);

  $form = drupal_get_form('user_profile_form', $user, 'account', 'custom');

  return $form;
}

function mymodule_form_user_profile_form_alter(&$form, &$form_state){
  //modifies the form_user_profile DO CUSTOM STUFF BELOW!
  if(isset($form_state['build_info']['args'][2]) &&
           $form_state['build_info']['args'][2] = 'custom'){

   //rename submit button
   $form['actions']['submit']['#value'] = t("dooo it!");

   //remove a few account things from this page
   $form['account']['#access']=FALSE;

   //needs to be there for the picture to work
   form_load_include($form_state, 'inc', 'user', 'user.pages');
  }
}


Paginate options in checkbox of a form field

Might be no one will land up here,still adding the answer and foolish doubts I had

The pagination done for query to get options works! .

The reason I was in doubt before was because of using the query results as option of checkbox field, the time I added themed the pager while rendering the form, I got the pager which worked out of the box!

How I figured out if pagination working with the query was by adding ?page=1 in the url manually which changed the checkboxes , it ensured me I just have to theme the global pager :) .


How to add Open Graph Tags in Custom Module detail page?

I think that you need this.

    /**
 * Alter the metatags for pages that are not of content entities.
 *
 * @param array $metatags
 *   The special metatags to be added to the page.
 * @param array $context
 *   The context, containing the entity used for token replacements.
 */
function hook_metatags_alter(array &$metatags, array $context) {
  // Exclude metatags on frontpage.
  if (\Drupal::service('path.matcher')->isFrontPage()) {
    $metatags = NULL;
  }
}


It sounds to me that you have a template, probably field.html.twig that is adding this space. You can enable the twig debug to see which templates' files are used.

Also, I think it's better to test the value on node.field.value instead of content.field as it's done for the rendering only.

Note that the twig operators as {% for ... %} also add spaces, so you should add - as well in there for e.g.:

{%- for item in items %}
{{ item.content }}
{%  endfor -%}


Why do all auto created urls in my multilingual site cause a Page not found?

Check your configuration at Configuration -> Languages -> detection and selection: the order specified there could be what explains the current behaviour in your site.

You'd have to experiment a bit with what the exact order in your case should be. In my experience, I often get these kind of issues to work by using an order like 'URL, Default, User', and not something like 'Default, URL, User'. It could well be that that is all that's needed here ... So try to experiment a bit with the various combinations in this order to see if it helps.

Note: Debugging is the art of taking away all possible causes of a problem. So sorry upfront if this answer turns out to not be the solution.


I wanted to do the same thing.  I had a view of blog posts and at the bottom of the post I wanted to put a link that had a comment count that was a hyperlink (as I've seen this done on many other blogs).  The way I did it was like this:

Originally my view was set up to just display the full nodes.  I clicked to edit the view and went to Page Details->FORMAT->Show and changed the setting from "Content" to "Fields".

Added the following fields:

Content: Title
Content: Body
Content: Path
Content: Comment count

The key and answer to this post is: Even though I don't want to display the path on my view I need to add it as a field so that I can later use it when building the link for the comment count.  Also I believe the order of the paths is important, so the path field must come before the comment count field.  For the Content: Path field I checked the "Exclude from display" check box.  This hides the path from showing up in the view. Next under "REWRITE RESULTS", I checked "Use absolute link (begins with "http://")".  This is necessary for a proper URL when using the path as token below.

For the Content: Comment count field, under "REWRITE RESULTS" I checked "Output this field as a link" and in the "Link path" box I put [path].


How to programmatically add default values to existing nodes of a specific content type

You may use module Views Bulk Operation. Then create views page like table and field title, your field, add field Content: Bulk operations (Bulk operations) with settings VIEWS BULK OPERATIONS -> SELECTED OPERATIONS Execute arbitrary PHP script (views_bulk_operations_script_action). Save, Open the page, select one node, choose Execute arbitrary PHP script

enter next code and execute:

//change entity title or what you want to do
$entity -> title = $entity->title . ' test';

//save entity
entity_save('node', $entity);


What you want to do is use something like $form_state['temporary'] in your myMod_submit function. Set $form_state['temporary'] = $someValue and rebuild your form. You also want your myMod_form function to have a place holder for your data. When the form is loaded, simply check to see if your temp holder is populated. if it is then you know you have a result and display it.

See code below.

function myMod_form($form, &$form_state) {

    ...

    if(!empty($form_state['temporary'])) {
        $form['results'] = array(
            '#type'     => 'item',
            '#markup'   => $form_state['temporary'],
        );
    }

    return $form;
}

function myMod_submit($form_id, &$form_state) {
     ...

     $results = callSomeFunctionToGetResults();

     $form_state['temporary']   = $results;
     $form_state['rebuild']     = TRUE;

     ...
 }

i omitted all my code that would populated $results but this should get you to where you need to go.

quick addition here.

I just realized that you wanted it to go to another page and not the same page. I believe in your myMod_submit function you can use drupal_goto(). pass it a url and also pass it some options. you can then parse out the options as your values in the other page. See drupal_goto. however, i haven't tested this option out.


Need multiple url paths for single node without redirecting

Decided to solve the issue by adding URL query parameter to designate where the particular page was coming from as per suggestion of leymannx and Rick Harinton.

Thanks for all your help!


Add bulk products drupal commerce: Warning: Invalid argument supplied for foreach() en form_type_checkboxes_value() line 2337 form.inc

The problem was because I am creating too many products at once. Not supported by the database or the hosting. It colapses and the foreach sends the warning. The result was a white screen.


How to validate file is selected or not on ajax processed jquery validation

What are you using for the file upload element? Is this in a form, webform etc.? With the Form API managed_file should do what you want.


How to split taxonomy checkboxes on node edit form

You can do it with css. You will need to add the following to your Admin theme's css file.

The Drupal default admin theme is Seven theme, located in /core/themes/seven. You may want to create a sub theme of Seven and use that as your admin theme, so when you upgrade Drupal your css file does not get overridden; thus, you will not lose all your changes.

#edit-field-name {
  width:760px;
  margin-bottom:20px;
  overflow:hidden;
  border-top:1px solid #ccc;
}

#edit-field-name div {
  line-height:1.5em;
  border-bottom:1px solid #ccc;
  float:left;
  display:inline;
  width:25%; }

replace -name with the actual name of your field.

Source: http://csswizardry.com/2010/02/mutiple-column-lists-using-one-ul/


Getting 'bool(false)' output before normal page HTML

It seems that the problem went away if I commented out the user_module_invoke() call inside user_login_finalize().

Obviously, I didn't want to maintain a patch for that, nor did I want to take out that behavior, as I may want to use hook_user_login() sometime. So, I basically copied user_login_finalize() into my own private function, removed the user_module_invoke() call, and am now using the private function for my particular need. Seems to be working fine!


Entity Reference multi value fields, filter on parent

Add a Contextual Filter in your view, use the "Member" field (Entity Reference guess) from your content type "Family".
Then add a relation in Relationship section, using the same field (Member).
Add a Title field and use that relation.
Pass the NID of your family has an Contextual Filter in your preview... you might get all the members of that family.

Notice: in yout Contextual Filter you have to select how will you pass the Contextual Filter (Family's NID in this case). You can add it via URL, etc.


Add a twig variable to a certain href url menu item when it is being created

I just ran into this and have a late answer for you.  Your twig template's if statement does not work because your string comparison is against the Drupal Core URL object. You can, however, create a variable in twig and use that for your comparison.

{% set menuUri %}{{ item.url }}{% endset %}
{% if menuUri == '#blog'  %}
    {{ item.title }}  /Tksksks iss
{% else %}
    {{ link(item.title, item.url) }}
{% endif %}

This will let your comparison to the URL "#blog" work just fine.


Create a primary link for the user edit page

I use the me aliases module to do this: it provides an alias, user/me, that you can add to menus and elsewhere. It also provides mappings for things like user/me/edit.


If nothing else helps, delete them in the database directly (its probably advisable to make a backup):

DELETE FROM `your_database`.`node_type` WHERE `node_type`.`type` = \'blog_post\'"


How to import multiple terms from XML into a node?

I finally found a way to achieve this goal at least for my use case. Publish my solution here for anyone to use if required.

My Settings for XPath XML parser :

Context -> //product/list/Destination
Product id -> ../../id
List of ports -> DestinationName # This is a term reference field which well have multiple terms per product

Then mapped all required fields as normal.

I created a small module with hook_feeds_after_parse() hook (I will use "My module").

My module has one .info file and the .module file.

function my_module_feeds_after_parse(FeedsSource $source, FeedsParserResult $result) {
    $current_id = -1;
    $cuurent_destination_list_final = '';
    foreach($result->items as $key => $row) {
        if($current_id !== $row['xpathparser:0']){
            $cuurent_destination_list_final = '';
            $current_id = $row['xpathparser:0'];
        }
        if($cuurent_destination_list_final === ''){
            $cuurent_destination_list_final = $row['xpathparser:1'];
        }else{
            $cuurent_destination_list_final = $cuurent_destination_list_final . ',' . $row['xpathparser:1'];
        }
        $result->items[$key]['destination_list_final'] = $cuurent_destination_list_final;
    }
}

What this module does is it creates a comma separated list of destinations.
Once we set $result->items[$key]['destination_list_final'] (This builds a comma separated list of terms) using this module, we can refer destination_list_final from Feeds Tamper (Refer this).

Install and enable Feeds Tamper PHP.
Add 3 pluggings to xpathparser:1 -> List of Destinations

Execute php code (This come from above installed module) -> return     $item['destination_list_final'];
Find replace - Use to remove double quotes (")
Explode - Use to explode the comma separated list we created from the custom module.

That's it. It worked for me.


You can use the Webform module to create a quiz.
Here is a quote about it (from the module's project page):

Webform is the module for making surveys in Drupal. After a submission, users may be sent an e-mail "receipt" as well as sending a notification to administrators. Results can be exported into Excel or other spreadsheet applications. Webform also provides some basic statistical review and has and extensive API for expanding its features.
Some good examples could be contests, personalized contact forms, or petitions. Each of these could have a customized form for end-users to fill out. If you need to build a lot of customized, one-off forms, Webform is a more suitable solution than creating content types and using CCK or Field module.


How to add frontend form using custom content type?

This is usually done by giving the user permission to add the content type and presenting them with the /node/add/{content_type} page, letting them create their own page content.


Optimize performance of custom pre-built option list to webform

You can always cache the results as seen in the official documentation

  if ($cache = cache_get('my_module_cache') && REQUEST_TIME < $cache->expire) {
    $data = $cache->data;
  }
  else {
    $data = 'xxxxxxx'; //do all your time taking complex calculations here
    cache_set('my_module_cache', $data, 'cache',  REQUEST_TIME  + (3600 * 24 * 30 * 6)); //stores in cache table and expires after 6 months
  }

More about cache_set and cache_get


Book navigation pager is moved under the comments

This sounds like a weight issue.

First: Try actually setting the field display weights.

1) Click the "Show row weights" button.

2) This will replace the drag and drop interface with an integer weight field. Set the weights to be lower (more negative) for all of your field items. Hopefully, this will allow them to float above the comments field.

Second: If the above doesn't work, then you might have to manually set the weight of the elements by altering the form.

You will need to place your code in a custom module. And then using hook_ENTITY_TYPE_view() alter the weight of the comments form.

Your code would look something like this:

// This part would go at the top of your mymodule.module file.
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;

This is where you actually set the  weight of the comment form.

function mymodule_node_view(&$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {

  // This probably isn't exactly what it will look like for you, but it's close-ish.
  if ($entity->getType() == 'book' && $view_mode == 'full') {
    // Not exact, but this should be pretty close as well.
    $build['comments']['#weight'] = 30;
  }
}

Hope this helps!


What's the explanation for my product permission issue in a Drupal Commerce view?

Below is another recommendation to address your "... I went to the permissions config page, and I checked the permission "View any product of any type" for anonymous and authenticated users" ... and your "So I do not know if I'm doing things correctly".

Have a look at the (old) Drupal Commerce issue "Views results empty for unprivileged user when using Relationship: Content: Referenced Product". Especially what's written in comment nr 158, i.e.:

  edit your View: > "Advanced" > "Query settings" : check "Disable Query Rewriting"

So instead of granting that permission (so that "normal users and anonymous can see the view correctly", as in your question), it may be sufficient to just adapt these advanced query settings as mentioned above. If it does, it'll be way better then granting that permission with that scary warning.

If you want more info about what the real issue is (and why this is only a work around), then have a look at comment nr 101 of the same issue, which states:

  The issue is not with Commerce. It's a node access issue, and it's triggered when you use a Views Relationship with a node access module (such as OG or Domain Access), and there's no related item the user has access to. The quick work-around is to disable SQL rewriting, which allows the view to get all results and ignore the node_access rules -- of course, this will show content the user should not otherwise have access to.


I'd go in with firebug and check first that those collapsible blocks contain the HTML form content you expect to be there and that it is simply hidden by CSS rule(s). Then if that is true then edit the CSS for those collapsible blocks to make them able to dismay content.
If there is no form content there then possibly could be a permissions issue at a guess.


Create node template only for default view-mode

Try adding the following code to your theme's template.php file:

function THEMENAME_preprocess_page(&$vars, $hook) {
  if (isset($vars['node']->type) && isset($vars['view_mode']) && $vars['view_mode'] == 'default') {
    $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type . '__default';
  }
}

Replace "THEMENAME" with the machine name of your theme.

This should allow you to use a template file called node--customnode--default.tpl.php (assuming your content type is called "customnode") which will apply only on the default view mode.

n.b. You will need to flush your caches after adding both this functino and the template file.


Deprecate multisite in 8.x for removal in 9.x

You have a few questions there, so I'll hit them individually:

  How serious is deprecation in 8.x and removal plan of multi-site in
  drupal 9? the topic is in category of plan for two years.

It's hard to say. Controversial topics like that can go in circles for years in the open source community. As you can see, that topic started over three years ago, and still has not reached a conclusion, and may well never reach one.

  Even if removal happens in 9.x, we have to expect some migration path to removal of 9.x or not? In my idea this migration didn’t happen for shared tables.

It will be fine even if you are sharing tables, as you can just migrate each multisite to a new individual site. You may have to do a special database dump and import to get the shared tables into your new system. I did this once when migrating from D6 to D7 for my company site - I was using multi site, and in the upgrade, I just created two sites out of the one.

  I can’t understand it. How does it works?

Git keeps all your code in a repository, which you can clone as necessary. So any time you need to spin up another site, you just clone the code, and you have a new Drupal instance. As you update sites over time, you can merge the code changes from one repository to another.

In my own company system, we have a central repository for each project. Any time someone new works on the project, they clone the code from the central repository, and they have an exact copy of the site. We then clone the repository to the webroot, so that it is available over the web. When people make changes to the code, they push the changes to that central repository, and then anyone can pull them at any time to their own repository, and/or the repository stored in the webroot of the public site.


What is the best way to show category by image?

In you view change the Format section to show fields and after that add the image field from your taxonomy, then add the filter Taxonomy term: Parent term


Conditionally apply CSS class to a conditionally-rewritten View field?

Generally, every field has a unique selector already. If the defaults are not giving you enough control, I would recommend the Display Suite module which will allow to you add classes (and many other things) to individual fields.

You might also be able add the tip with the same method that you are using to rewrite with the X right now.


How to add a field to Browsing Widgets partial form?

It seems that you can just do this by going to your content type, edit the field you want to show and check the "Display in the browsing widget mini-form". After all the trouble it seems quite simple..


How do I add edit/delete buttons to a custom module items list?

You can try code:

use Drupal\Core\Link;

[...]

// Create the row element.
$rows = array();
foreach ($result as $row => $content) {
  $rows[] = array('data' => array($content->requestid);
  $rows[] = array('data' => array($content->name);
  $rows[] = array('data' => array($content->contact);
  $rows[] = array('data' => array($content->reqtext);
  //Actions.
  $edit_link = Link::createFromRoute($this->t('Edit'), 'myrouter.edit_form'['id'=>$content->requestid], [
        'absolute' =>
          TRUE
      ]);

$delete_link = Link::createFromRoute($this->t('Delete'),'myrouter.delete_form',['id'=>$content->requestid], ['absolute' => TRUE]);

$build_link_action = [
      'action_edit' => [
      '#type' => 'html_tag',
      '#value' => $edit_link->toString(),
      '#tag' => 'div',
      '#attributes'=>['class'=>['action-edit']]
     ],
     'action_delete' => [
       '#type' => 'html_tag',
       '#value' => $delete_link->toString(),
       '#tag' => 'div',
       '#attributes'=>['class'=>['action-edit']]
       ]
      ];

 $rows[] = ['data' => \Drupal::service('renderer')->render($build_link_action)];
}

// Create the header.
$headers = array('requestid', 'name', 'contact', 'reqtext','options');

$output['results_table'] = [
  '#theme' => 'table',
  '#rows' => $rows,
  '#header' => $headers,
  '#empty' => $this->t('There are no items to display.')
];
return $output


For some weird reason the Ajax response wasn't updating the form_build_id value and the request takes it as the same form, so I added a new Ajax Command:

function saveAjaxForm(&$form, FormStateInterface $form_state) {
  $old_form_build_id = $form['#build_id'];
  $new_form_build_id = $old_form_build_id.rand();

  $response = new AjaxResponse();

  $response->addCommand(new UpdateBuildIdCommand($old_form_build_id, $new_form_build_id));
  $response->addCommand(new AlertCommand('Saved'));

  return $response;
}

It solves the issue.


You can try CSS Injector.

Project page says:

  Allows administrators to inject CSS into the page output based on
  configurable rules. It's useful for adding simple CSS tweaks without
  modifying a site's official theme -- for example, a 'nighttime' color
  scheme could be added during certain hours. The CSS is added using
  Drupal's standard drupal_add_css() function and respects page caching,
  etc.


How to retain  tag in HTML output when added in a Views Fields?

Had to use Views PHP module for the <noscript> tag to be retained. Even so, had to do some workaround to make it work >.<


Recommended module or method for a generic map/media embed field?

The built-in text area field seems like it would be sufficient, assuming that this field would only be accessible to trusted user types (see "Tread with Care" later in my post).  If you configure your filters to allow "Filtered HTML" (with embed/iframe allowed) or even "Full HTML",  users can just copy and paste embed codes to their heart's content.

Any HTML snippets that are posted will get rendered when viewed without needing any extra template code or a custom module to handle them.  A "Filtered HTML" filter might still strip important attributes away, but "Full HTML" will not.

There is not really a generic way I can think of that would allow you to verify (even if you felt confident about your PHP) that iframe/embed html is a Vimeo video vs a banner advertisement vs a reference to malware.  That is why there are 20 different emfield modules; the sources for each type of content all do things differently and can constantly change how they approach embedding.

Text filters are available at: /admin/config/content/formats (in Drupal 7) and full documentation can be found here: Specifying the allowed formats for user input

Tread with care!

Keep in mind that users will be able to post anything else they want, too.  The "Full HTML" filter offers minimal protection and even if you went with "Filtered HTML" instead of "Full HTML" and permitted iframe or embed tags you are still in potentially dangerous territory if this field is going to be used by just anyone in your userbase.

Example/Demonstration


Rule to Send email to Admin when user points category reaches a certain value

Perhaps you can use the patch that's provided here: https://drupal.org/node/1109992.


1) Make sure you have set up a working alias for your content type at /admin/config/search/path/patterns

2) Go to /admin/config/search/path/update_bulk

3) check "Content"

4) Submit

I have just tested this on my local dev environment by going in the db and deleting the alias to one node:

delete from url_alias where source = '/node/2940'

and running the bulk operation generated an alias for all unaliased nodes (which just happened to be the only one I deleted).

So if the bulk operation isn't working for you, it may be that you don't have a pattern set up for your content type (node bundle).

Check at /admin/config/search/path/patterns and make sure you have a working pattern set up for your content type.


Making Twitter 1.1 API requests on site with OAuth and Twitter modules

Perhaps not a Drupal solution, but I thought I would update to say that I have settled on using Twitter-API-PHP found here https://github.com/J7mbo/twitter-api-php


How can i load a specific CSS file for a specific View?

Looks like you need Code per Views Display module.


How do I show only those node that have images available via a view?

You can achieve it by following steps.

Add  Image field filter criteria.
Now in configuration, select operator Is not empty (NOT NULL).


If there are so many modules in Drupal, are the hard-coded functions reserved only for contributed modules?

Only using Site Building features (no custom module development yet) should get you pretty far (if not far enough ...).
The Relativity Data Model for Drupal
Have a look at the (illuminating) article "Relativity Model for Drupal", for which this is an introduction to it (quoted from this linked page):

The Relativity Data Model for Drupal is a zero-custom-code, collection of steps, procedures and methods that strive to help site builders, users and site visitors interact with Drupal in a far easier and more efficient way. This is done by:

Data architecture and data modeling merging as a single step through a documentation procedure.
Customized user interfaces that cater to individual workflows throughout permission roles.
Multi-level relational data structures that relate to other multi-level relational structures.
Mimicking the concept of database joins within Drupal's UI's.
Vastly reducing the size of Drupal sites by a small handful of modules that provide greater power, speed and expansion capabilities.

The small handful of modules (cfr. the last bullet) is like so (apart from Drupal core):

Chaos tool suite (ctools)
Date
Entity API
Entity reference
Entity connect
Field Group
Token
Pathauto
Views

Note: this same topic is also presented in the video "Revolutionary DRUPAL Data Modeling Concept!! (This will change your Drupal life!)".
Typical add-on modules
Even though that small handful of modules above can get you already extremely far, I often add a subset of other contributed modules to it also, as further detailed below.
Business logic
Using the Rules and Flag module, it is possible to implement all sorts of business logic (= rules), simply using the typical Drupal admin UI for those modules.
Queries, custom reports and charts

To perform queries (listings, etc), use the Views module, possibly further extended with modules such as Views Slideshow: Galleria (there are dozens of modules to further enhance views).

The Forena module can be used as a supplement / alternative (e.g. if you'd need to also create charts or so, or if you have a need to access data in some external database such as MS SQL, Oracle, etc).
Using the Forena integration with the Feeds module it is possible to import data blocks and reports as Drupal nodes or Drupal users. For a tutorial about the available features check out the video about How to import data and reports based on data as Drupal nodes.

Create charts using the views integration of the Charts module to visualize a lot of data in a way that can be quickly digested.

Page Layout
Modules like Display Suite and/or Panels can help to enhance the look and feel of it all also.
Many more modules

Group (a pretty new alternative to Organic groups, to create arbitrary collections of your content and users and grant access control permissions on them).
Workflow (to create arbitrary workflows, and assign them to entities).
IP Geolocation Views & Maps, a mapping engine to create Views-based mapping solutions using the map renderer of your choice (Google, OpenLayers or Leaflet)
Or, or  ... on and on goes the list.

Disclosure: I'm a (co-)maintainer of Forena and Charts.


Add link to topic list after new topic or comment submission

There's count of ways to do it, one of these: Rules module. Just add condition on node or comment adding, and add action for redirecting. For taking correct forum page of node or comment, I assume you should enable "php filter" and add php code that got forum taxonomy term and redirect to certain page.


Disable user login, register and password reset

in a custom module that we call 'custom', have custom.services.yml with content :

    services:
  custom.route_subscriber:
    class: Drupal\custom\Routing\RouteSubscriber
    tags:
      - { name: event_subscriber }

then create the file src/Routing/RouteSubscriber.php with the following :

<?php

namespace Drupal\custom\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;

/**
 * Listens to the dynamic route events.
 */
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
    // Always deny access to unwanted routes.
    $disallow_routes = [
      'user.login',
      'user.register',
      'user.pass',
    ];
    foreach ($disallow_routes as $disallow_route) {
      if ($route = $collection->get($disallow_route)) {
        $route->setRequirement('_access', 'FALSE');
      }
    }
  }

}

enable the 'custom' module and this should work :)


Is there a core method in views that can pad numbers with leading zeros?

Go to /sites/all/themes/yourtheme/ folder and in template.php add the following code:

function yourtheme_preprocess_views_view_fields($vars){

  if ($vars['view']->name == "view_name" && $vars['view']->current_display == "block_1") {
    $vars['fields']['field_example']->content = str_pad($vars['fields']['field_example']->raw, 2, 0, STR_PAD_LEFT);
  }

}

replace yourtheme with the actual name of your theme
replace view_name with the name of your view.
replace block_1 with the machine name of your view.
replace example with the name of your field (2 replacements).

Lastly, in Drupal, clear/flush your cache to see the changes.


Before I install this module I want to better understand this note

Let's break the question down into parts.

  Autosave uses a modified version of the jquery.field plugin (modified since it doesn't support Drupal field naming conventions very well)

This means that when the project was written, they took a plugin (piece of code) from another module and used it as a base for their own code.

  This version of the plugin was based on jquery 1.2 and does not work with jquery 1.3.

This bit taken just by itself means that the module will not work if you are using JQuery 1.3 or higher with your Drupal site.  It does, however look like old information and should be disregarded because:

  Rev 6.x-2.7 DOES support jquery 1.3 and should still support jq 1.2. Please raise an issue if you find that it doesn't.

...which states that version 6.x-2.7 supports JQuery 1.3.

The module has been updated several times since then, as you can see the Drupal 6 module is now on version 6.x-2.11.  It is likely that the Drupal 7 version of the module supports much more recent versions of JQuery since it was last updated 6 months after the last Drupal 6 version.

What should you do?

Make a development copy of your site if you haven't already, where you can break things without worry.  Use a VirtualBox or similar if you know how or can learn.
Install the current version of the module and see if it works.  Click around your site and see if you can find any unexpected behaviour
If it doesn't work, consider installing JQuery Update which allows you to choose the version of JQuery being used by your site.


use multi level/chain of entity reference fields to create a list of nodes using views

For everybody stuck in a similar situation and not having advanced knowledge; this is how I solved it:
I broke the problem into 2 views and used "view field view" module to connect the 2 views.

In the first view; i used a relationship(entity referencing) and contextual filter(Content:nid) to reach the nid of the outline from the chapter nid.

In the second view; i used a relationship(entity referenced) and contextual filter(Content:nid) to reach the nid of the notes from the outline nid.

Using the Global: view field (from view field view) module I substituted the Outline nid for the contextual filter (Content:nid) in the second view.


Do you have an entity type or a content type? If you create one in the UI, it's a content Type. Then it really is a node, so what you want to use is {node}. Then upcasting will work (assuming you have NodeInterface $node in your controller).

That said, access denied is, as Ivan Jaros said, the missing access definitions. The default access definition is that that access is denied. access: 'TRUE' will give anyone access.

What you likely want to use is _entity_access: node:view then the standard node access system is invoked and the user has access if he can view that node.


Rewrite output in a view using CCK fields

In D6, you would look for the HTML Element, Label HTML Element and Wrapper HTML Element dropdowns in the Style Settings of the fields and set them to none. I am assuming (there I go again) that something similar is there in D7.


Found a way to display the menu correctly.

{% import _self as menus %}

{% for item in items %}

{% if not item.below %}

    {{link(item.title, item.url)}}

{% else %}

 {{item.title}}

      {% for subItem in item.below %}

{{subItem.title}}

      {% endfor %}

{% endif %}

{% endfor %}


Autocomplete entity reference - Required to select entity

Are you sure you are using the Autocomplete widget or are you using the Autocomplete (Tags Style)? I believe tags style allows for an entity to be created like taxonomy term.


How to specify which form mode to use for a content type

Unlike view modes you can't select form modes out of the box. To manage form modes you need a module. You can try one of these:

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

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


Use Webform to email users with query parameter or argument?

Pass that value in the URL to identify the user to locate, to know where to send the mail
  Load and check the user from that passed value before showing the form
  If the user is not a certain role, serve a 404 instead of a form (only certain roles can be contacted).
  Preferably have a url like /staff/{FOO}/contact where {FOO} is my custom value.

If you want to make a webform integrated module, you can achieve all of the above by altering certain webform's route(s) & maybe service(s).


Display Views Result Summary in Twig Template

I hope you mean views results count. If that is what you are looking for then you get it by  {{ view.total_rows }}