How would I use entity wrapper to insert new values into an entity property list? bundle?

A field can only hold multiple values if it's been explicitly set to hold more than one value (this is an option when creating the field - see "How many values the field will store" at http://drupal.org/documentation/modules/field-ui ). In that case, the correct syntax using the entity metadata wrapper is to use array operator [] as follow:

$tids = array(....);
$wrapper = entity_metadata_wrapper('node', node_load(1));
foreach ($tids as $tid) {
  $wrapper->field_taxonomy[] = $tid;
}

Please note that in your original example you use the field 'title' - however that is a special drupal field, and it cannot be made to be multi-valued.


How to group multiple blocks into one big block

Block Group module may help you

  This module extends the standard drupal block system with block
  groups. Each block group provides a new block as well as a
  corresponding region. Child blocks can be moved into any group region.
  The position and the settings of the parent block are propagated to
  its children. Also block groups are nestable.

Take a look. I am not sure how it will integrate with responsive style.


What should I write in Submit function?

That's up to you, depends what you want to do. It sounds like you're just unsure how to get access to the submitted values. Those reside in $form_state['values'], so:

$value = $form_state['values']['dropdown_third'];


Try this out.
get_all_nodes_not_referenced_by_article('page');

use Drupal\Core\Database\Database;
/**
 * @param $type
 *
 * @return mixed
 */
function get_all_nodes_not_referenced_by_article($type){

  $connection = Database::getConnection();

  //- Step one get all referenced nids
  $query = $connection->select('node_field_data', 'nfd')
                      ->condition('nfd.type', 'article')
                      ->fields('nfd', ['nid']);
  $query->leftJoin('node__field_ref', 'nfr', 'nfd.nid = nfr.entity_id');
  $result = $query->execute()->fetchAll(PDO::FETCH_ASSOC);

  $referenced_nids = [];
  foreach ($result as $key => $value) {
    $referenced_nids[] = $value['nid'];
  }

  /**
   * Check if $referenced_nids to avoid
   * Drupal\Core\Database\InvalidQueryException: Query condition 'nfd.nid NOT IN ()' cannot be empty.
   * */
  if (!empty($referenced_nids)) {
    return $connection->select('node_field_data', 'nfd')
                      ->condition('nfd.type', $type)
                      ->condition('nfd.nid', $referenced_nids, 'NOT IN')
                      ->fields('nfd', ['nid', 'title'])
                      ->execute()
                      ->fetchAll(PDO::FETCH_ASSOC);
  }
  else {
    return $connection->select('node_field_data', 'nfd')
                      ->condition('nfd.type', $type)
                      ->fields('nfd', ['nid', 'title'])
                      ->execute()
                      ->fetchAll(PDO::FETCH_ASSOC);
  }
}
?>


I had to enable the RDF module and now it works.


How do I get computed column using db_select?

You can make use of the addExpression() method:

$query = db_select('digitaliq_question_points','n')
  ->fields('n',array('points'))
  ->condition("node_id", $node->nid, '=')
  ->condition('n.fld_group', $fields, 'IN');

$alias = $query->addExpression('SUM(points)', 'sum_of_points');

$points = $query->execute()->fetchAll();

Obviously that might need to change slightly based on your return value/grouping requirements but that's the method you're looking for.


Attach different CSS styles on a node basing on publishing date or other PHP properties

You are asking the wrong question. The question you should have asked is "how do I add a class on a node depending on some properties?". Using different set of CSS files to control styling a an element is just a no-no.

The answer to the correct question depends on whether you are targeting Drupal 6 or Drupal 7:

On Drupal 6, you will generally have to implement the logic your own node template;
On Drupal 7 (or on Drupal 6 if you are using an intelligent base theme like Zen), you would implement a hook_preprocess_node() in your theme and add classes to the 'classes_array' variable


Modal windows module for Drupal 7 content?

I've used the colorbox module for this purpose for a couple of recent D7 projects.  It works well and seems to fit your use case.

You might also want to checkout the overlay module in D7 core, but it generally involves more effort to make it work for the non core use cases.


Include Lead Forensics code in all pages

The better way to do this is by placing the script in the code for the theme.

You may be able to pretend this is another script and use a Drupal module that adds a script to the theme.

An issue you may be having by using a block is that unless you have the right permissions and also are careful to preserve this code as source, Drupal may try to alter what you enter for security or because you don't have permission to add a script.

We are a user/partner of Drupal and LeadForensics.


I figured out what I was doing wrong. It had to do with the defaults of the page view path.

In the Front Page View I changed the page settings path to /home and went into
Configuration >> Site information and scrolled down to the Front Page settings.

I set the default front page url to home and the pager was removed as per my configuration of the frontpage Page pager settings.


Best method for multi-page user registration form?

The Profile2 and Profile2 Registration Path modules can help to solve your problems. You can do the following:

You can create the profile for each role of users.
Have the different register pages for each profiles.
Can config the way to do after registration.
Have the edit user information with include the extra fields from Profile2 module.


Do not confuse the cache with the "theme registry".

If you're updating theme functions, flush the cache (which will also update the theme registry).

if you post code there could be other reasons it isn't working.  if you're dealing with comments I would look at using comment specific hooks rather than node submission hooks.


How to determine if a script is started by cron?

You may check your $_SERVER globals in the script.

A better way, I think, would be to pass a parameter with your call to the script that separates the caller (I.e when you call it from the HOOK_cron(), add a myFunc(..., $caller="cron") to your call. And declare myFunc(..., $caller=null) as default parameter.

If this is not possible, you may set a session variable in HOOK_cron and check that in your script.


Field:REWRITE , Contextual filters Views 3

You should call Content: Nid (Nid) field above the conference_details field,
as showing below

Than only [nid] will be available for REPLACEMENT PATTERNS for Rewrite the output of this field as Output this field as a link

edit the Content: Nid (Nid) configuration


How to define custom permissions for organic groups?

I found the solution here:

/**
 * Implements hook_og_permission().
 */
function custom_permissions_og_permission() {
  $name = "taks";
  return array(
    'update own task content' => array(
      'title' => t('Update own %type_name content', array('%type_name' => $name)),
      'description' => t("Edit own %type_name content.", array('%type_name' => $name)),
      // Determine to which role to limit the permission. For example the
      // "subscribe" can't be assigned only to a non-member, as a member doesn't
      // need it.
      'roles' => array(OG_AUTHENTICATED_ROLE, OG_ADMINISTRATOR_ROLE),
      // Determine to which roles the permissions will be enabled by default.
      'default role' => array(OG_AUTHENTICATED_ROLE, OG_ADMINISTRATOR_ROLE),
    ),
    'update any task content' => array(
      'title' => t('Update any %type_name content', array('%type_name' => $name)),
      'description' => t("Edit any %type_name content.", array('%type_name' => $name)),
      'roles' => array(OG_AUTHENTICATED_ROLE, OG_ADMINISTRATOR_ROLE),
      'default role' => array(OG_ADMINISTRATOR_ROLE),
    ),
    'create new task content' => array(
      'title' => t('Create new %type_name content', array('%type_name' => $name)),
      'description' => t("Create new %type_name content.", array('%type_name' => $name)),
      'roles' => array(OG_AUTHENTICATED_ROLE, OG_ADMINISTRATOR_ROLE),
      'default role' => array(OG_ADMINISTRATOR_ROLE),
    ),
  );
}


How can I connect drupal 6 and activemq?

If you're willing to upgrade to Drupal 7, Services version 3 should interface to (for instance) JSON or SOAP.

Feature of version 3:

  Response format API allows you to define response Formats for CONTENT-TYPE ie. application/json or application/xml.

Edit: I didn't know about STOMP, which the OP mentions in a comment. I add it here for searches/future reference:

  STOMP is the Simple (or Streaming) Text Orientated Messaging Protocol. The Stomp module implements an alternative Drupal Queue backend for queues supporting the STOMP protocol - such as ActiveMQ, RabbitMQ.

For Drupal 6, there is JSON server.  I am not familiar with it, but you may be able to use that instead.


An illegal choice has been detected. Please contact the site administrator is given on ajax form after programmaticly adding an item to a select list

Upon validation, the FAPI checks that the values given for any select/option/radios match what was originally available when the form was first built. This is a security check, and is built in to all form processing.

Changing the values of an existing select list with javascript means your form has been altered outside of Drupal's control (perhaps maliciously, the FAPI cannot know), and so the validation fails.

To stop the message appearing, you should use the AJAX framework to build you form, instead of manipulating it directly with jQuery.


How to add a extra products fields on ubercart check out pane table?

You can go for Ubercart Webform Integration

This module integrates two other modules: webform and ubercart. It allows you sell
products directly from your webforms. It is particularly suited to be used as part of a
registration system.


When to use Views attachments vs. content panes?

Attachments can inherit the exposed filters of the display they are attached to.


Drupal Node Display Main Image or Video not both

This should work:

{% if node.field_video is not empty %}
  {{ content.field_video }}
{% else %}
  {{ content.field_image }}
{% endif %}

If the field is populated with a value, render that field. Otherwise, render the image field.


Wrap html in link based on uri component of other field

I needed to use the drupal function file_create_url and PHP parse_url to accomplish this.

function newsletter_preprocess_node(&$variables) {

  if ($variables['type'] === 'newsletter' && $variables['view_mode']) {
    // Generate a path to the file based on the download uri
    $path = $variables['field_download'][0]['uri'];
    $path = file_create_url($path);
    $path = parse_url($path);
    $path = $path['path'];
    $variables['download_link'] = $path;
  }
}


How can I generate a link from a text field and a URL in a View?

In Views you have a couple of ways to do this:

Method 1:

Add the url field to the view, but "exclude" it from the display
Add the description field to the view, but re-write its out put to a link and add the URL token replacement as the URL or path.

Method 2:

Add the url field to the view, but "exclude" it from the display
Add the description field to the view, but "exclude" it from the display
Add a global field for custom text and inside of it add field-description where field-url and field-description are the replacement token from the fields added to the view.

Note: In views it is important the order of the fields, so if using method 1 the url field has to be placed before the description field.


Access hook_preprocess_node variables from page controller

So the problem turned out to be an incorrect #theme template name in my returned render array. The node type I was adding content to was called product_group, but in my controller, I returned this:
 return [
   '#theme' => 'node__product_resource__full',
   '#product_group' => $content,
   '#node' => $pg_node,
   '#view_mode' => 'full',
 ];

product_resource is a valid content type in the site. Once I changed it to
'#theme' => 'node__product_group__full',

It worked fine.


how to correctly chain multiple files in '$settings['container_yamls'][]'?

The settings.php file already contains the following line.

$settings['container_yamls'][] = __DIR__ . '/services.yml';

It is much easier to add the following one at the bottom of the settings.php file.

$settings['container_yamls'][] = 'modules/redis/example.services.yml';

Since it is added on the bottom of the file, it is easier to find and remove it, in the case you decide not to use that module anymore. In this case, you just remove a single line, and Drupal doesn't use that module's services anymore.

Also, if you install another module that requires to add a similar line, you just need to add a $settings['container_yamls'][] which can be easily removed without touching the other lines.

Those are the only considerations I could make about which code snippet I would use. Otherwise, for PHP 5.5 (and Drupal), the following code snippets are perfectly equivalent.

$settings['container_yamls'][] = __DIR__ . '/services.yml';
$settings['container_yamls'][] = 'modules/redis/example.services.yml';

$settings['container_yamls'] = array(
  __DIR__ . '/services.yml',
  'modules/redis/example.services.yml',
);

$settings['container_yamls'] = [
  __DIR__ . '/services.yml',
  'modules/redis/example.services.yml',
];


How to remove/hide 'to time' in time field

You can change in the field setting

Go to your content type, Now when we add a field of Date type. Then it will show a section for start and end date mentioned in the image

For already added field, you can not edit it i think because there is already content with end date. You can hide it if neccessary

Hope it will help!


Showing more detailed error messages to user

You might want to check services.alter.api.php

As described in this post

<?php
/**
 * Allows alteration of error data before the status code or message are returned.
 *
 * @param array $error_alter_array
 *   An associative array with the following keys:
 *     - 'code': the HTTP status code.
 *     - 'header_message': the message returned as part of the error response
 *       (for instance, "404 Not found").
 *     - 'body_data': data that was passed to the thrown exception.
 * @param array $controller
 *   The current controller definition.
 * @param array $arguments
 *   Arguments passed to the current controller.
 *
 * @see RESTServer->handleException()
*/
function hook_rest_server_execute_errors_alter(&$error_alter_array, $controller, $arguments) {

}


Now its a separate module called Field group. It comes with several display options including vertical tabs.


To update core on its own try

drush pm-update drupal

A plain

drush pm-update

will update all modules, and then core.

Note that it doesn't backup .htaccess, robots.txt, or any other files that you may have modified.  I have gotten in the habit of doing a full drush archive-dump before core updates, and/or using Backup and Migrate in combination with having everything under git control.


Parent node does not update when updating referenced entity child node

When the referenced child node is updated in the database this triggers automatically a cache invalidation.

In this case there are three theming levels, page, parent node and child node. They all need to be invalidated when an entity involved gets updated.

But this only works when they are tagged properly. You only need to have the children tagged, because tags bubble up to the parent.

For debugging check the response header X-Drupal-Cache-Tags. To enable this header copy sites/default/default.services.yml to services.ymland set:

  # Cacheability debugging:
  #
  # Responses with cacheability metadata (CacheableResponseInterface instances)
  # get X-Drupal-Cache-Tags and X-Drupal-Cache-Contexts headers.
  #
  # For more information about debugging cacheable responses, see
  # https://www.drupal.org/developing/api/8/response/cacheable-response-interface
  #
  # Not recommended in production environments
  # @default false
  http.response.debug_cacheability_headers: true

Now you can check the response headers in the browser debugging tools and see which cache tags are missing in the page.


How to change modified date in a node when users votes more than 5 times?

Since vote_up_down uses voting API underneath, you can use the voting rules module to allow you to configure rules to fire when votes are made.

You could then make a rule that fires when a vote is made, that then checks the total number of votes for that node and if it has 5 votes update the nodes updated date and save.

So the event/trigger would be voting on the node, the condition would be that the node has 5 votes (after a quick look it is likely the "Evaluate the results of a vote on a ..." condition), and the action would be updating the modified/updated date of the node.


The customer information is stored as commerce_customer entity. By default it has an address field attached to it. For multiple addresses, you could either allow multiple values on the field, and use some theming to display one as billing and the other as delivery.

The other option would be to add a new address field and use that for delivery/billing. With hook_form_alter you could add custom elements to the form, like the checkbox and JavaScript effects.

You have a few options if you want to customize your address field form. You can implement AddressFieldForm, the default looks like this:

/**
 * Default address handler.
 */
class AddressFieldForm_default implements AddressFieldForm {
  public function form($address, $field, $instance, $langcode, $items, $delta, $element) {
    $required = $delta == 0 && $instance['required'];

    $form['thoroughfare'] = array(
      '#title' => t('Street'),
      '#type' => 'textfield',
      '#required' => $required,
      '#default_value' => $address['thoroughfare'],
    );
    $form['premise'] = array(
      '#title' => t('Residence, building, ...'),
      '#type' => 'textfield',
      '#default_value' => $address['premise'],
    );
    $form['sub_premise'] = array(
      '#title' => t('Floor, stairway, ...'),
      '#type' => 'textfield',
      '#default_value' => $address['sub_premise'],
    );
    $form['dependent_locality'] = array(
      '#title' => t('Suburb, post box, ...'),
      '#type' => 'textfield',
      '#default_value' => $address['dependent_locality'],
    );
    $form['postal_code'] = array(
      '#title' => t('Postal Code'),
      '#type' => 'textfield',
      '#size' => 5,
      '#required' => $required,
      '#default_value' => $address['postal_code'],
    );
    $form['locality'] = array(
      '#title' => t('City'),
      '#type' => 'textfield',
      '#size' => 30,
      '#required' => $required,
      '#default_value' => $address['locality'],
    );

    // All the other fields are unsupported by this handler.
    foreach (array('administrative_area', 'sub_administrative_area') as $field) {
      $form[$field] = array(
        '#type' => 'value',
        '#value' => '',
      );
    }
    return $form;
  }
}

This is what addressfield uses to internally handle different address types. Using addressfield_mapping_alter you would be able to overwrite the default mapping, or create a mapping for your own country:

function module_addressfield_mapping_alter(&$mapping) {
  $mapping['default'] = 'AddressFieldForm_my_custom_default_form',
  $mapping['DK'] = 'AddressFieldForm_dk', // Add for Denmark which doesn't exist yet
}

In addition to this, you have all the usual tools, like hook_form_alter and adding a custom theme function to render the form like you which. You should be aware that addressfield makes heavy use of AJAX to replace form elements when changing country.


Gallery Formatter Adjusting the Width of Gallery-Thumbs

make shure the empty li's have no width specified (or are now shown at all). change

to

if you cannot manage that - do it via css

.gallery-thumbs li.empty { width: 0px !important; }


What does a/ and b/ stands for in patch header?

A' and the 'B' are prefixes to differentiate source and destination.

You can change the prefixes with

--src-prefix=<prefix>
Show the given source prefix instead of "a/".

--dst-prefix=<prefix>
Show the given destination prefix instead of "b/".

From http://git-scm.com/docs/git-format-patch


Saving a field of type 'text_format' as a system setting variable

The following worked for me; the #default_value is expecting a string but the text_format form element is stored as an array.

$barvalue = variable_get('bar', array('value' => '', 'format' => NULL));

$form['foo']['bar'] = array(
'#type'     => 'text_format',
'#title'    => 'Bar',
'#definition' => 'Foo Bar',
'#default_value' => $barvalue['value'],
'#weight'   => 1,
'#format' => $barvalue['format'],
'#required' => FALSE,
);


What is the difference between rendered entity and content in views 3?

At a guess...

The "Rendered Entity" format is available so any type of entity can be rendered. The "Content" format is only available for nodes, and as such can't be used generically.

Nodes are entities (as are users, taxonomy terms, and a whole host of others provided by contrib modules) and so just happen to be one of the 'items' that the "Rendered Entity" format can handle.

It also happens that Views already implements a format specifically for nodes ("Content"), so it does kind of look like there's repetition; but in reality it's not repetition at all, they're two separate things that just happen to have a bit of crossover in functionality.


Different Site name and slogan for Organic Groups based multisite architechture

Open Atrium (6.x) uses spaces to save different configuration for each og, this may be helpful.

  Spaces is an API module intended to make configuration options
  generally avaliable only at the sitewide level to be configurable and
  overridden by individual "spaces" on a Drupal site. It has been
  described as:

  A way to make one Drupal site act like several sites A way to provide
  much more configurable, full-feature Organic Groups or user homepages
  A generalized API for contextual configuration


How can I add a custom content pane to a feature?

Unfortunately, as per this issue, a bug in features prevents custom content panes from being exported.


You need some jQuery on the page, e.g:

Drupal.behaviors.form_submit_processor = {
  attach: function (context, settings) {
    $("form#my-form").submit(function(e) {
      alert('form submitted');
      alert($('form#my-form #edit-name').val());
    });
  }
}

You could add to your theme script.js, with drupal_add_js or form_alter and $form['#attached'] ( recommended )


Why does 'Search Question' of the Answers module not show any results?

Have a look at Comment #1 in issue 1619676, which states:

One hypothesis: have you run cron?
The way content gets indexed is during cron runs ... not immediately when new content is created.

It could well be that "in the meantime" cron was run, which would explain why "... the Search feature started working..." (as in your comment).
Disclosure; I'm a co-maintainer of the Answers module.


How can I better protect access to all site reports except 'Recent log messages' based on role?

Remove the permission for "Admin" to "access site reports" at

Admin > People > Permissions.

Add hook_menu_alter to a custom module, this part changes the access permission for the admin/reports/dblog menu path

/**
 * Implements hook_menu_alter
 */
function MYMODULE_menu_alter(&$items){
  // Allow access for administrator role to recent log entries
  // Use suitable permission here, e.g editorial "administer nodes"
  $items['admin/reports/dblog']['access arguments'] => array('administer nodes'),
}

Clear menu cache, done.


How to grab $form_state value from text-format from drupal form

Try with:

$message = $form_state->getValue('message')['value'];


Whats wrong with my drush script when using sql?

i think the problem is in the " / ' , try it this way :

$q = db_query("
select node.nid AS nid from {node} node where (type='feed_item')
AND (status=0) limit 1");


Printing a drupal 7 user field into a link

Use the Link field Module:

  The link module can be count to the top 50 modules in Drupal
  installations and provides a standard custom content field for links.
  With this module links can be added easily to any content types and
  profiles and include advanced validating and different ways of storing
  internal or external links and URLs. It also supports additional link
  text title, site wide tokens for titles and title attributes, target
  attributes, css class attribution, static repeating values, input
  conversion, and many more.

Or better, yet do a search for drupal social media for a number of different modules to do exactly this.


How to display Rate module widget by php

print rate_embed($node, 'plus1', RATE_FULL);

Here, first parameter($node) is the entity where you want to vote
'plus1' is the type of widget that you want to add
RATE_FULL is the display type of widget . Either it can be full or mini.

Try by passing $node =node_load(10). Where 10 is id of some node that exists in the site

Hope it will help


A blank page often indicates a PHP Error. Is there an error in the PHP error logs you can reference?

Also, when uploading via FTP, you want to be sure that you properly transferred your .htaccess file which, on some Operating Systems, will be hidden on your local filesystem.


Can't pass variable from theme hook or controller to custom template

You cannot use #markup and #theme in the same element. #markup will always take precedence, and #theme is ignored. If you want to output some markup, you need to include that as part of your theme. If the markup is dynamic, then include it as a variable to be passed to your theme (though you need to name the variable as something other than markup).

You've also defined the variable as toto in your hook_theme() implementation, then passed the value in #tutu in your render array. You need to use '#toto' => 'some value'.


drupal loses track of a library (leaflet), randomly

How do you see that drupal does not find that files? Is it correct that you just get 404 for that files in browser? Try to load these files in browser window like http://yourdomain.com/sites/all/libraries/leaflet/leaflet.js. If it's not loaded, it's your server issue, rather than drupal one.


Expose single filter of combination of two fields in views

I eventually got a solution from this. I followed the second primary solution offered although the blogger personally used hook_views_query_alter().

installed the module Views filters populate.
added two filters "First Name" and "Last Name" (both must not be exposed) and added them to a OR filter group (Views 3 supports this). I had to use the operator "Contains any word" for both fields, otherwise the query gave me no desired result.
created a filter "Global: populate filters", added the two fields into this and exposed it.

This gave me a quick solution without hard coding.
Here is other helpful reference.


How to send Private Message using privatemsg_services module?

Here you go

To send new  message

Endpoint: http://example.com/services/privatemsg

Content to Send (JSON Format) :

{
   "recipients": "xxx",
   "subject":"xxx",
   "body":"xxxx"
}

To reply a message for particular chat thread

Endpoint: http://example.com/services/privatemsg

{
"thread_id": "xxx",
"subject": "xxx",
"recipients":"xxx",
"body":"xxx"
}


Install a PDF maker to the panel of a WYSIWYG editor?

I don't know of a pre-built solution for this.
I assume you want a PDF icon similar to what there is in MSWord or OpenOffice.

There is no PDF generation capability with client-side Javascript that I am aware of, so it would be difficult to implement something like this in the browser.

There are plenty of server-side PDF solutions, however, but you'd have to send the editor content back to the server somehow (AJAX), and then have the PDF generated and sent back to the client.

There looks to be some discussion of this at the CKSource forums.

It might be easier to just use the Print module.


How to execute javascript iframe in custom module?

The $form var in chat_with_librarian_get_html()is rather useless, just return the $html var instead and it should work.

function chat_with_librarian_get_html() {
  $html = '

' .
    '
';
  return $html;
}


Programmatically Filter Node Access beyond permissions, views, etc

You say that you do not want users to be able to enter node URLs directly. To me this suggests you do need to use permissions, as it is the only way tou can guarantee your node won't be accessed.

The reason is that you never know which parts of Drupal might be displaying your node. For instance you could manually insert a drupal_goto in hook_boot to provide your own custom permission handling, testing the URL for the node id - however the node would still be accessible via Views. The great thing with Drupal is that all sorts of modules can use your data in all sorts of ways - however this means you have to present your data (in that case, your permissions) in a way other modules will understand.

You say that your permissions are distance-based. This means you cannot use Role-based permissions, since you would end up having one role per user. What you could use however is the ACL module - this provides an API allowing you to define per-user/node permissions.

You would then need to implement hook_node_update/hook_user_update to re-calculate the permissions and change the ACL for that node/user when the node/user is changed.


Is it safe to remove database tables of removed modules?

Disabling a module doesn't mean uninstalling it. To uninstall a module, once you disabled it, you need to go to admin/build/modules/uninstall (Drupal 6), or admin/modules/uninstall (Drupal 7, and Drupal 8), select one of the module listed, and click on the button to uninstall them.

Since Drupal 7, every database table declared with hook_schema() is automatically deleted from Drupal. Modules still need to delete any Drupal variables they define, though.
Since Drupal 8, a module can just be uninstalled. You cannot anymore first disable it, and then uninstall; you just go to admin/modules/uninstall and uninstall the modules you need. If the module cannot be uninstalled for any reason, Drupal will show in that page the reason why it cannot be uninstalled.


how to apply CSS for a Custom Block/View

It depends on what theme you're using. The core Drupal themes are stored under /themes/. If you have a custom theme, it should probably be installed in /sites/all/themes/. Different themes may name their main CSS file differently, but look for .css files within your theme's directory or a subdirectory beneath it.

From there, you'll need to know what ID or class name is associated with the particular block.  You can right click in somewhere in the block and choose "Inspect Element" to examine the source file. Or for even more power, I'd recommend installing the Firebug extension for Firefox. You can find out more about Firebug in this screencast.

For more complicated theming, I'd recommend also installing the Theme Developer module. It will allow you to see what theme file or function is currently outputting a specific area of the page, as well as what files or functions can be used to override it. See the screencast for more detailed information.


How do I alter the output of an existing views handler?

The short answer is that you can't alter the output of a views handler. But what you can do is:

Create your own handler that is a subclass the handler you want to overwrite.
Add a render method - which will generate the output (this is where your alter code is)
Use hook_views_data_alter to make views use your handler instead where needed.

This will get the wanted effect, where you can alter the output of the original views handler, but in reality to make views use your custom handler.

In code it could look something like this.

class my_custom_handler extends views_handler_field_user_picture {
  function render($values) {
    ...
  }
}

function my_module_views_data_alter(&$data) {
  $data[...]['handler'] = 'my_custom_handler';
}

This code is for Drupal 7, but the method can be used in both Drupal 6 and 7. For Drupal 7 you should create the class in it's own file and add the file to the module's .info file, to make Drupal autoload the file with the class when needed.


How do I programmatically change settings to simplify sharing of config changes?

At the risk of opening up a whole ugly can of worms on Drupal's current lack of config management, I am just going to point towards the D8 Configuration Management Initiative as the over-arching response to this.

To answer your more specific question about block/layout management, there are a few attempts at addressing this using Features/Features Extra:

Layout with Context or Panels or Display Suite

Better blocks with Boxes or Bean or Bricks


Image preview not showing on add/edit page

This is a known issue in the current version of entity_browser that ships with Lightning.  Upgrade the entity_browser module to 8.x-1.0-alpha10 or later to resolve the issue.

If you have used composer to install, simply update the drupal/entity_browser module via composer.


Hope this will help you, For achieving your goal you need to create a plugin of ckeditor, First of all read more about ckeditor plugin, and create a view to get all the video with the display in a page, you can use the views page url for the ckeditor plugin to insert the media on ckeditor, a good tutorial is here.Click Here

this is one of the module which will help you click here & click here


How to convert an HTML website with stylesheets to Drupal 7 nodes?

What you are looking for to avoid creating a whole theme from scratch is known as a starter theme.  Starter themes are special themes designed to not work as themes by themselves, only to be used as foundations for a theme you build on top of them (the latter is known in Drupal-speak as a sub-theme). I.e. starter themes are theme framworks that "reset" the CSS, so that you can rebuild the CSS without having to think about inherited styling.

Pick the starter theme that looks like it best suites your needs, and build on that.

As for stater themes: Zen is the one that most people use. The other one I will recommend is Basic.  It is a stripped down fork of Zen. As a bonus, both are responsive by default.


How do I remove webforms from content types?

If you use the webform module (I'm not 100% sure from your question), and you want to disable the webform functionality for the content type, then you can do this on the settings page of the content type (Admin > Structure > Content types). There should be a a fieldset or vertical tab called "Webform", and when you click on that there should be a checkbox that you can disable.

But be aware that this removes the form from all previously created nodes too, not only for the new ones.

If you're not using webform then please specify what modules do you use so that we can understand how this functionality is build into your site.


How can I custom sort a views display containing multiple content types to list the newest item from each content type sequentially?

You just need to set a correct order in your 'sort criteria', post date first, then content type.


Complex where condition with entity field query (D8)

No, in general, it is not. Entity query is not an SQL-query replacement, it designed to also work with other storage backends, so you can not use 100% of the SQL features.

If you need that, you have to implement your own SQL query.

That said, I don't quite understand why your special SQL logic is even necessary, date fields can be queried natively, e.g. publish_date > :date should just work, as long as you provide the date in the correct format as and timezone input.

See How to do a date range entityQuery with a Date only field in Drupal 8?


How to set MINIMUM number of required fields?

You can use the Field validation module, and set up a validation rule using "number of selections".
The Field validation module has many validation rules you can set for any of your fields. It works by defining a set of validation rules at first, then you can assign that set to a field.

To answer your question, the validation rule you need to use is the "number of selections". You can define a minimum and a maximum number of values required. Just leave blank the "Maximum number of selections" parameter and set "Minimum number of selections" to your needs.


Taxonomy jump list in view in parent/child order

You need to add "Content: Taxonomy terms on node" as a relationship.


How can I get the content of a mini panel that is limited to admin-only access using a scheduled rules component?

The problem seems to be an anonymous user triggering the component and since you want an admin user to run the component, you will have to impersonate the admin user.

Try this code inside your components to impersonate the admin user :

global $user;
// Save the current user
$current_user = $user;
// Save user session
$current_session = drupal_save_session();
// From now on we don't want to save the session, since it would be unsafe
drupal_save_session(FALSE);
// We impersonate admin user
$user = user_load(1);
// Do wathever needs to be done.
// ...
// Now let's restore the triggering user and session.
$user = $current_user;
drupal_save_session($current_session);


add a repeatable autopopulate node title select list to custom block

You can use form select options

put the list of your nodes in to an array and pass them into the form function

function mylist_form($form, &$form_state, $args) {
$mylist = array();
foreach ($args as $node){
$mylist[$node->nid]= $node->title;
}

$form['mylist'] = array(
  '#weight' => '1',
  '#key_type' => 'associative',
  '#multiple_toggle' => '1',
  '#type' => 'select',
  '#options' => $mylist,
  '#title' => 'Select nodes',
);
 return $form;
}

after in the block view function you can render the form

$mylistform = drupal_get_form('mylist_form' , $nodes );


There is a module for that. Try the Conflict module

This module allows parallel editing of nodes with field-level conflict detection and a trick to prevent accidental overwriting of fields when they are changed by another session while a node is being edited.
This behavior is useful for things like issue queues where multiple people might be following up to an issue simultaneously.
It works by hashing the field data and comparing these hashes. This is done so we can generically do a 3 way comparison between the original node, the node as edited by us, and the node as edited by others.


Term taxonomy child from first and second level menu

I've found a way to do it. It's not the best way but it's a way which is enough clean for me for now .
It's with Menu block module.
I made 2 blocks with this module and I configure it on a specific page.
http://www.youtube.com/watch?v=1rku2vHqZP4

If you want you can also use Pathauto module to generate nice url so you don't need to configure  on evry specific page but on every page with a specific URL like www.yoursite/Vehicle/*.

To configure that go to admin/config/search/path/settings and set the Slash (/) option to "Do not Replace" under "Punctuation" then go to the taxonomy path which you need and put [term:parents:join:/]/[term:name] the URL will be like www.yoursite/Vehicle/4-wheel/car.

Hope that help.


Move “Submitted By” from node.tpl to page.tpl

you can construct your own with something like this, adjust as desired:

if(isset($node))
{
    $nodeUser = user_load($node->uid);
    print 'Submitted By ' . l(t($nodeUser->name), 'user/' . $node->uid) . ' on ' . format_date($node->created);
}


You can use the file_create_url function.

$uri = 'public://';
$path= file_create_url($uri)


List organic group members from the current user group on his profile page

I forgot to answer you last time.! Sorry. You said your were happy with some code so here it is.

Step 1: The custom module.

function CUSTOM_MODULE_views_pre_view(&$view, &$display_id, &$args){
// Select our view
    if($view->name == 'VIEW_NAME' and $display_id == 'DISPLAY_NAME') {
    // Get User ID from url
        $view_user = user_load(arg(1));
        $user_groups = array();
        // Get Group IDs
            $items = field_get_items('user', $view_user, 'og_user_node');
                foreach($items as $item) {
                    $user_groups[] = $item['target_id'];
                 }
    // Join like 4+78+345 for Views
        $user_groups_args = implode("+", $user_groups);
    // Send IDs to view
        $args[0] = $user_groups_args;
    }
}

Create a module and change what's in caps. Be aware that that module doesn't do any checking.. Only use it for user/* or node/* etc. where the second argument is an integer.

Step 2: The View

In your View, add the OG membership: Group ID contextual filter
(make sure it's first in the list).
Under its settings under More, check Allow multiple values.
Because some users may be in more than one group, go to Query settings under Other and check Distinct.

That should be it.


How to convert objects into array using serialization API?

I tried serializer.normalizer.content_entity but got no success in normalizing the (node) revision entity, or even node entity for that matter. It always resulted in the following error:

  PHP Fatal error:  Call to a member function normalize() on a non-object in core/modules/serialization/src/Normalizer/ContentEntityNormalizer.php on line 28

For this I had to enable the serialization module. I also tried with the ContentEntityNormalizer provided by the "hal" module from core. Result same error:

  PHP Fatal error:  Call to a member function normalize() on a non-object in core/modules/hal/src/Normalizer/ContentEntityNormalizer.php on line 95

I had success with directly using the serializer service from the serialization module. The working code for serializing a node revision is given below. It was verified on /devel/php

$revision = node_revision_load(4);
$container = \Drupal::getContainer();
$normalizer = $container->get('serializer');
$normalized_array = $serializer->normalize($revision);
dsm($normalized_array);

Or combine line 2 and 3 above to get the serializer directly as

$serializer = \Drupal::service('serializer');

In your setup() function, you need the following change:

$this->serializer = $this->container->get('serializer');

P.S: I am still trying to figure out why serializer.normalizer.content_entity is not working and throwing the errors.


Computed twig Automatically update the computed value using Ajax

I figgured out. It was because the theme template rewrite the form input element and this broke automatic comuting on forms.


Try out the Ultimate Cron module.

  Runs cron jobs individually in parallel using configurable rules, pool management and load balancing. Multiple rules per cron job. Configuration per job (enable/disable, rules, etc.)

There is also the Elysia Cron module.

  Elysia Cron extends Drupal standard cron, allowing a fine grain control over each task and several ways to add custom cron jobs to your site.


Assuming you're referring to the Admin menu module then you can head to the configuration page under admin/config/administration/admin_menu and under the System tweaks tab you can check the option for Move local tasks into menu.


AJAX forms will break when used in subform

Use $form_state->getTriggeringElement()!

Example for the callback:

public function addmoreCallback(array &$form, FormStateInterface $form_state) {
    $items_field = $form_state->get('num_foobar_rows');

    // Gets the button that triggers the ajax call
    $triggering_element = $form_state->getTriggeringElement();

    // Retrieve the parents, so we can climb back up the tree and do not have to hard code the unknown position of our subform
    $parents = array_slice($triggering_element['#array_parents'], 0, -1);

    // Use NestedArray to get the element in `$form` at the path that `$parents` describes.
    return NestedArray::getValue($form, $parents);
}

Note that I'm using #array_parents, this will contain all the parents including simple array parents or elements without #tree. This will prevent problems you are most likely to encounter when your form gets embedded in a field and ofcourse other forms.

Also note that the array_slice part, this will just slice off some parents to make sure we have the path to our first (-1) parent. If the element that you want to return is one or more parents up the tree, you'll need to adjust the -1 accordingly. Also, if your to be returned element is not actually the parent of the triggering element you'll want to alter the $parents array accordingly.


Why has my security shield for my new module on Drupal.org been removed?

Only full releases get the security shield. Your screenshot only shows a dev version. I don't think the shield was removed from your module, as it wouldn't have had one in the first place since you don't have a full release.

To get the security shield, you'll need to release a full version (one not suffixed with -dev, -alpha or -beta).

** EDIT **

I have just discovered that an additional step needs to be taken in addition to creating a full release. Until recently, if a module was given a full-release, it automatically received the security advisory. However, I just promoted a module I've got from RC to a full release, and it did not receive the security advisory. Editing the module page now has an option that requires to module maintainer to opt into the security advisory.

Even having done so, my module still does not have the advisory shield, so I assume it now goes under some review from the security team before receiving it. This issue seems to support that assumption: https://www.drupal.org/node/2666584

--- Edit 2 ----

It turns out their was a bug in the system. I am already able to promote modules to drupal.org rather than the sandbox. With existing modules, when upgrading from D7 -> D8, modules were automatically given the shield when I released a full version. However the module I mentioned above did not have a D7 version, and when I promoted it to a full release it didn't receive the shield. After waiting two weeks for approval I finally contacted the security team, and they looked into it and found a bug in the caching system, and fixed it.

So it appears that the original information I gave - that you just need to release a full version, and have opted into security advisory coverage, is correct.

Here's a screenshot of the module edit page.


Get list of nodes by field-collection value

I think you have to possibilities to solve this:

Looks like you already got a tag for joining the field_group entities here:

$query->addTag('joinentity');

You could then implement hook_query_joinentity_alter() to implement the join, see also EntityFieldQuery INNER JOIN

You use db_select() or db_query() and add your joins there rather than an EFQ. I think this is preferable as implementing tags and hooks for those gets a bit messy IMO.


Multiple form submissions sorted by user

It sounds like you are doing two different searches:

A. Get all webforms for which a user is the author

B. Get all users

Basically, Views has trouble with this kind of thing, because Views generally deals with one type of entity at a time, and users and webforms are different types of entities.

You can use Views Field View module to put one view inside the other.

Rough outline:

Create a view showing all the forms for a given user (filter for the user using a Contextual filter on the UID)
Create another view showing all users.  Use Views Field View to embed the view created in 1 and supply the UID as the argument.

This view will probably be very slow/performance intensive but since this is mainly for admin purposes hopefully that's ok.

See more details in this answer.


Implement Twig format in view exposed filter

For example if you use the preinstalled view Search Content, then put the file views-view--search-content.html.twig in the template folder of your theme and add the div containers:

{%
  set classes = [
    dom_id ? 'js-view-dom-id-' ~ dom_id,
  ]
%}

  {{ title_prefix }}
  {{ title }}
  {{ title_suffix }}

  {% if header %}

      {{ header }}

  {% endif %}

    {{ exposed }}
    {{ attachment_before }}

    {{ rows }}
    {{ empty }}
    {{ pager }}

  {{ attachment_after }}
  {{ more }}

  {% if footer %}

      {{ footer }}

  {% endif %}

  {{ feed_icons }}


I get answer here https://stackoverflow.com/a/65888182/13738862
function helper_form_views_exposed_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
    if($form['#id']== 'views-exposed-form-pozdravleniya-taxonomy-term-page-1') {
      $form['sort_by']['#title'] = '';
      $form['sort_by']['#options']['created'] = '';
      if ($form_state->getUserInput()['sort_by'] == 'count') {
        $form['sort_by']['#options']['count'] = 'New';
      }
    }
}


Output ctools_modal_form_wrapper() with translatable items in the form

This is an open issue for ctools modal_form and is in need of some more data / feedback to push the issue forward. The specific bug is called out here and appears to be related to the language header that is used in the modal form window:

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

There is a potential patch for this here:

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


I managed to achieve the desired result by using "OG Theme" Module. It adds a field to GROUP pages from which you can select a different theme for each group. Themekey is quite awesome and I will still use it to do mobile version.


How to show Wordpress blog posts in Drupal's Search Api?

There are 2 ways you can achive this :

[simple] Import the posts from wordpress rss with Feeds https://www.drupal.org/project/feeds
[more difficult] Crawl the Wordpress content and populate the Apache Solr index directly. You can use an open source crawler like Apache Nutch
The difficult part is that the external content is not managed by Drupal, only through Solr so you don't have many options to play with the indexed content in the Drupal site.


How to make product attributes appear as checkbox on the add-to-cart form?

The closest thing to what you're asking for is Commerce Add to Cart Extras.


What is causing /user/*/taxonomy/term/* to redirect to /taxonomy/term/*?

The source of the redirect could be essentially any module you have, and several modules allow for configuration that will cause redirects as well. You will need find the source of the redirect on for your particular situation.
Suggestions:

Deactivate modules in a 50 / 50 manner. This allows you to quickly narrow down which module is providing the redirect, and hopefully that will help you to work it out. Using drush to disable/enable modules will make this much faster.

Install Devel. It has a settings called "Display redirection page", and implements devel_drupal_goto_alter halting the redirection.
The primary purpose of this is to gather up debug information that would otherwise go lost due to the redirect. In this particular case, I suggest you add a dpm(debug_backtrace()); into the hook so you can trace the call to the source of the redirect.

Everything else failing, fire up a full debugger, and trace the call, ideally with help from the information provided by the debug_backtrace() above.


create url with destination parameter and additional query string to views page with exposed filters

Instead of Trying to generate destination manually, can use drupal_get_destination(). So your above code would be like this:

$url = url('admin/dashboard/applications/create/' . $row->nid, array('query' => drupal_get_destination()));
$link = 'App+';

drupal_get_destination() gets the current path + encode the query strings and make them as destination. this will generate below URL:

http://www.site.com/admin/dashboard/applications/create/154575?destination=admin/dashboard/enquiries%3Fnid%3D%26field_enquiry_fname_value%3D%26field_enquiry_email_value%3D%26field_enquiry_country_tid%3D%26field_enquiry_campaign_id_value%3D%26field_enquiry_emailed_value%3D0%26field_enquiry_stage_1_tid%3DAll%26field_enquiry_enabled_value%3D1

instead of your URL.

http://www.site.com/admin/dashboard/applications/create/154575?destination=admin/dashboard/enquiries%26nid%3D%26field_enquiry_fname_value%3D%26field_enquiry_email_value%3D%26field_enquiry_country_tid%3D%26field_enquiry_campaign_id_value%3D%26field_enquiry_emailed_value%3D0%26field_enquiry_stage_1_tid%3DAll%26field_enquiry_enabled_value%3D1

The difference is the encode of '?'. I have tested it in  local D7 installation.


Using Twig how can I get the summary of the body field to use in a template?

The only way I managed to solve this is:

if you only want to target the value of the summary, you can target the entity you're on. If you're on a node then you can do this :

node.body.summary

In a paragraph

paragraph.field_body.summary

You can also get the summary front content like this :

content.body['#object'].body.summary

Not great but will do for now.


Taxonomy Alphabetical Sorting - Nested or Multi-Level Terms

You may reset the list to alphabetical without losing your hierarchy. While the terms will be sorted alphabetically, those terms that have a parent item will keep that parent item, and so naturally will continue to be displayed under that parent in the hierarchy.

The reset button is found at the bottom of the list terms page in Drupal 7


Accessing variable_get when loading bootstrap from an external file

Why not write a proper Drupal module and include your intended code in there? You miss out on so many of Drupal's nice features if you use it your way, including the issue you are asking about here, but also lots of security and sanity checks. Just sayin'


How do I tell Drush where the root directory is?

When I run:

$ composer create-project drupal-composer/drupal-project:8.x-dev drupal-project-test-site --no-interaction
$ cd drupal-project-test-site
$ vendor/bin/drush status

Then I see:

 Drupal version : 8.6.13
 Site URI       : http://default
 PHP binary     : /usr/local/Cellar/php/7.3.0/bin/php
 PHP config     : /usr/local/etc/php/7.3/php.ini
 PHP OS         : Darwin
 Drush script   : .../drupal-project-test/drupal-project-test-site/vendo
                  r/drush/drush/drush
 Drush version  : 9.6.0
 Drush temp     : /tmp
 Drush configs  : .../.drush/drush.yml
                  .../drupal-project-test/drupal-project-test-site/vendo
                  r/drush/drush/drush.yml
                  .../drupal-project-test/drupal-project-test-site/drush
                  /drush.yml
 Drupal root    : .../drupal-project-test/drupal-project-test-site/web
 Site path      : sites/default

Drush should be able to find the Drupal root for the site that it's contained inside without the use of --root or an alias. I'm not sure why vendor/bin/drush would not work. Perhaps try again with a new test project, and see whether you get the same results? Perhaps your install did not complete.


Can you give more detail on the problem and your setup. For example what is a store owner, is this just and administrator of a single site or do you have many store owners on one installation, for example some kind of marketplace?

What do you mean by node access? you want customers to buy a product and then be able to view or edit it.

What version of ubercart/drupal are you using?

If the scenario is you have only one store owner per site and you want a customer to purchase a product and then have view access to a specific node I would look into using the following modules

node reference / entity reference - create a reference to a node from
a product
content access - this allows fine grained permissions for individual
nodes or for content types etc
Rules - create a rule that after successful checkout grants
permission to the node that is referenced on the product


How to show data from external api to theme template?

There are a few answers to that question, and it depends on the design (appearence and behaviors), but the Drupal foundation is usually the same.
1st step
Create a custom block and place it in a page (node of a generic type is a good option or a programmatically created page.
OR
Create a custom page (see ´hook_menu´)
2nd step
Create a custom theme function using ´hook_theme´ (template file is usually easier to maintain)
3rd step (connect to the API)
Due to performance considerations (async vs. sync request) I prefer to use JavaScript to get the data and present it on the page / block we created. (AngularJS is my friend..)
If JS is not an option, then you can make the request in ´hook_block_view´ in case you used custom block, ´hook_page_build´ or in your ´hook_menu´'s callback in case you chose a page in step 1.


How to redirect user page to front page for specific roles

Solved using EventSubscriber like this:

services:
  my_module.event_subscriber:
    class: Drupal\my_module\EventSubscriber\MyModuleSubscriber
    tags:
       - {name: event_subscriber}

And MyModuleSubscriber:

namespace Drupal\my_module\EventSubscriber;

use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\views\Views;
use Drupal\views\ViewExecutable;
use Drupal\user\Entity\User;
use Drupal\Core\Url;

class MyModuleSubscriber implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public function checkForRedirection(GetResponseEvent $event) {
    $request = \Drupal::request();
    $requestUrl = $request->server->get('REQUEST_URI', NULL);
    $userID = \Drupal::currentUser()->id();
    $user = User::load($userID);
    $uid = $user->get('uid')->value;
    $roles = $user->getRoles();
    $userPage = "/user/" . $userID;
    if (
      $userID !== '1' &&
      !in_array('administrator', $roles) &&
      $requestUrl == $userPage
    ) {
        $path =  \Drupal::service('path.alias_manager')->getAliasByPath('/');
      $event->setResponse(new RedirectResponse($path, 301));
    }
  }

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

}

I don't know if it is the correct way to do this but it solves my problem.


Add a vocabulary and a term-reference field or just add a select field?

As @reptilex mentioned, the answer to this question is going to vary depending upon your very specific situation.  There are a lot of helpful documentation resources and blog posts floating about with good advice about making this decision.

drupal.org Guidelines for Taxonomy Design
blog - How to Decide Between Taxonomy and CCK to Classify Content
blog - Drupal Taxonomy vs. Content Type Field


How do I implement hook_views_pre_render()?

You need to read and understand the Module developer's guide first, then it's as simple as adding the following to your .module file:

function MYMODULE_views_pre_render(&$view) {
  // Do stuff with the $view object.
}


You can to get rid of the surrounding  wrappers by overriding theme_item_list($variables) function in you template.php or module and comment hardcoded lines:

    $output = '
';

and

    $output = '
';

See details on http://api.drupal.org/api/drupal/includes!theme.inc/function/theme_item_list/7


Warning: file_put_contents(temporary://): failed to open stream

Make sure your temporary folder exists and is writeable.

See the file system settings at:

admin/config/media/file-system


Scroll Calendar View so that it Centers (vertically) on page

One solution that comes to mind is to use hook_pager_link() to modify your view's pager links to include fragment/anchor that is in your view's header. This would work on the assumptions:

You have custom unique text for previous/next pager links (e.g. "previous month"/"next month").
You placed an anchor link in your view header (e.g. ).

In your theme's template.php you could override like so:

function MYTHEME_pager_link($variables) {

  // If we are looking at pager links with our custom title
  // use our modified theme_pager_link code:
  if (in_array($variables['text'], array('previous month', 'next month'))) {
    $text = $variables['text'];
    $page_new = $variables['page_new'];
    $element = $variables['element'];
    $parameters = $variables['parameters'];
    $attributes = $variables['attributes'];

    $page = isset($_GET['page']) ? $_GET['page'] : '';
    if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) {
      $parameters['page'] = $new_page;
    }

    $query = array();
    if (count($parameters)) {
      $query = drupal_get_query_parameters($parameters, array());
    }
    if ($query_pager = pager_get_query_parameters()) {
      $query = array_merge($query, $query_pager);
    }

    // Add our custom #calendar fragment
    $attributes['href'] = url($_GET['q'], array('query' => $query, 'fragment' => 'calendar'));
    return '' . check_plain($text) . '';
  }
  else { // Otherwise fall back to core theme pager.
    return theme_pager_link($variables);
  }
}


Why does email attachment fail on rescheduled rule?

The problem was that I needed to allow the cron user to "Send Arbitrary Files" in the Mime Mail permissions.


See the Fast Permissions Administration module; it is like the Module Filter module, but for permissions.

  This module is here to alleviate frustration when trying to manage permissions in Drupal. By providing a better permissions interface hopefully a few innocent keyboards and mice can be saved.

You can filter on the module name with @module, or permission@module:

  Module filtering:
  You can also filter on the module a permission belongs to using the @ symbol: permission@module.

  For example, if you want to show only permissions that contain the word admin for the comment module you would enter: admin@comment.


<?php
// Enter the machine name of the menu you want to show.
$menu_name = 'main-menu';
// Check if there are any menu items in it.
if (count(menu_navigation_links($menu_name))):
?>
<div id="secondaryNav">
  <?php print theme('links', array('links' => menu_navigation_links($menu_name), 'attributes' => array('id' => $menu_name, 'class'=> array('links', 'inline')))); ?>
</div>
<?php endif; ?>


A page that list all the nodes by views but to have a one CMS controlled banner image on that page

Create a admin form that allows the admin user to upload the image file, as you say in your question.
Create custom block that renders the image as you want. You can do in a custom module (better, more solid) or crete the block using the GUI and add the HTML code. In both cases, the img should point the file uploaded by the admin form.
Place the block over your view in the view's page.

This is good if:

You only have one view that needs the header image.
That image is the same for evey user.


PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'env_id' in 'field list': INSERT INTO {apachesolr_stats}

Check your drupal database, table apachesolr_stats if it has a field env_id.

If not check installation of module apachesolr_stats, maybe uninstall and reinstall. It should create that table apachesolr_stats with the field env_id.


Has 'Administer content' permission always been required to expose publishing, authoring etc options?

This is from node_form() in Drupal 7.0:

$form['author'] = array(
  '#type' => 'fieldset',
  '#access' => user_access('administer nodes'),
  '#title' => t('Authoring information'),
  '#collapsible' => TRUE,
  '#collapsed' => TRUE,
  '#group' => 'additional_settings',
  '#attributes' => array(
    'class' => array('node-form-author'),
  ),
  '#attached' => array(
    'js' => array(
      drupal_get_path('module', 'node') . '/node.js',
      array(
        'type' => 'setting',
        'data' => array('anonymous' => variable_get('anonymous', t('Anonymous'))),
      ),
    ),
  ),
  '#weight' => 90,
);

Note that #access is set to user_access('administer nodes'). The revision and options fields have the same access set. So yes, it's always been required, at least as of Drupal 7.

You don't necessarily need a 3rd party module, but you'll need at least a custom module to make changes. You can implement hook_form_alter() (or hook_form_FORM_ID_alter()) to change the #access key of the desired elements in a few lines of code.


How to add 'style="width:100px"' in Global Custom Text field in a view?

Here is a fun and a little naughty solution to this:

1.) Instead of style, set the token as value="[token]" - make sure your token is only a number, no alphabetic characters like px etc.

--- Value is set and DIV is spat out ---

2.) Use jQuery to get the value of value="" - define it and use it when the page loads:

$(document).ready(function(){
var div_width = $('.my-div').val();
$('.my-div').width(div_width);
});

The width will now be appended to the div via inline-style using jQuery. Not optimal, not recommended but it should work.

More on adding custom jQuery to your Drupal installation: https://www.drupal.org/node/171213


Drupal 7 Rule to save node based on fetched entity throwing EntityMalformedException if field empty

Well I wound up writing code to fetch the entity:

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'my_content_type')
  ->propertyCondition('status', NODE_PUBLISHED)
  ->fieldCondition('field_my_field', 'value', $some_value, '=')
  ->range(0, 1);
$result = $query->execute();

I then wound up using $result to update the target node's author:

if($result) {
  $eid=current($result['node']);
  $node = node_load($eid->nid);
  $node->uid = $account->uid;
  node_save($node);
}

I wonder if there's a method to query the database for a single entity? That would save the "hassle" of adding a range, then having to extract the desired value from the $result array.


How to make a custom block listen to context module?

Firstly, You can try putting a regular block at a regular region created by drupal core in context. That should work.

Then compare the different results you got for your custom block and custom region. Try putting your custom block at regular region, or putting regular block at your custom region.

Also, You may need to double check the 'custom region' you mentioned at question does exist at page.tpl.php. I.e the code does print the 'custom region' in page template, like

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


In a custom module you can change the theme like this:

function YOUR_MODULE_custom_theme() {
  if (current_path() == 'checkout') {
    return 'plain';
  }
}

With this approach you need a full new theme (in the above example named plain). You then can directly use it's page.tpl.php. In template_preprocess_page you could add javascript and fill variables with your html (or blocks).

Also you can place the blocks like you want for this theme.

To get the correct current_path you would need to debug a lil. checkout is just guessed by me ..


Using rules to grant new role upon visiting page

The Rules Path and Rules URL Argument modules trigger events based on the current URL being viewed.

You could also use the Rules Link module to generate a custom link that will trigger your rules. The catch here is that this specific link must be clicked to access the page and the user I believe must be signed in.

If you need fine tuned control over when the Rules event is triggered you could even implement your own Rules Event.


Filtering my products on drupal commerce

You can do it in the view.

Select a filter criteria for example "size", then click on expose filter.

This permit you create a custom search box as well clicking on "exposed filter in block" under Advanced in view.

First part of a tutorial http://www.youtube.com/watch?v=9-sKG1bplx0


The way to alter the action handler for the search form is to add a submit handler, as outlined here: https://stackoverflow.com/questions/6444769/altering-search-form-action-not-working-for-custom-search-module-drupal-6. You can call your function in the submit handler or redirect to it from the submit handler.

/**
* Implementation of hook_form_alter()
*/
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == 'search_block_form') {
    $form['#submit'][] = 'mymodule_form_submit';
  }
}

/**
 * Process a block search form submission.
 */
function mymodule_form_submit($form, &$form_state) {
  // The search form relies on control of the redirect destination for its
  // functionality, so we override any static destination set in the request,
  // for example by drupal_access_denied() or drupal_not_found()
  // (see http://drupal.org/node/292565).
  if (isset($_GET['destination'])) {
    unset($_GET['destination']);
  }

  // Check to see if the form was submitted empty.
  // If it is empty, display an error message.
  // (This method is used instead of setting #required to TRUE for this field
  // because that results in a confusing error message.  It would say a plain
  // "field is required" because the search keywords field has no title.
  // The error message would also complain about a missing #title field.)
  if ($form_state['values']['search_block_form'] == '') {
    form_set_error('keys', t('Please enter some keywords.'));
  }

  $form_id = $form['form_id']['#value'];
  $form_state['redirect'] = 'search/mymodule/'. trim($form_state['values'][$form_id]);
  }


Content type term reference field selected or populated from URL parameter

For drupal 6:You can put a link using following code in your node.

function hook_link($type, $object, $teaser = FALSE) {
  $link = array();

  if ($type == 'node') {
    $link['yourlinkname'] = array(
      'title' => t('Your link'),
      'href' => 'node/add/example',
      'attributes' => array(
        'title' => 'Your link',
      ),
    );
  }
  return $link;
}

For drupal 7:You can put a link using following code in your node.

function hook_node_view_alter(&$build)
{
   $build['links']['node']['#links']['example-mylink'] = array(
    'title' => t('Your linkname'),
    'href' => 'node/add/example',
    'html' => TRUE,
    'attributes' => array(
      'title' => 'Your link',
      ),
   );
}


Display date picker not inline in Drupal 7 Forms API

Have you tried using DatePicker inline module?

From module page:

  This module permits inline rendering of date's popup widget. That is,
  it display the datepicker embedded in the page instead of in an
  overlay.

  It integrates with field API, form API and views exposed
  filters (via date_views).


What is the first function read by Drupal in a custom module?

The first hook invoked is hook_boot(), if the Drupal variable page_cache_invoke_hooks is TRUE, otherwise is hook_language_init() (followed by hook_init()).

I am assuming the module is not implementing alternative versions of bootstrap functions; in that case, the version of cache_get() implemented by the module is called first.

About hook_boot() keep in mind that:

hook_boot() is invoked too early, when Drupal has not completed its bootstrap. This means that the only loaded modules are the ones implementing hook_boot(). Even in this case, your module can use function implemented from modules implementing hook_boot(), and already loaded from Drupal, which uses the following code.

foreach (module_list(FALSE, TRUE) as $module) {
  drupal_load('module', $module);
  module_invoke($module, $hook);
}

If your module is aaaa.module, and it tries to call zzzz_create_object() (where zzzz.module implements hook_boot()) from aaaa_boot(),  aaaa_boot() will cause an error message about a not existing function.
When hook_boot() is invoked, Drupal has not yet initialized its database, its Drupal variables (only when $conf['page_cache_without_database'] is TRUE), and its session.

As consequence, the functions hook_boot() can call are restricted. For sure, the functions the hook can call are the ones that are part of bootstrap.inc, and all the PHP functions (with some restrictions too).

References

drupal_bootstrap()
_drupal_bootstrap_page_cache()
drupal_language_initialize()
_drupal_bootstrap_full()


For the first part of your question, set an event listener to bind when the other option is selected, and then display your popup. I would suggest setting a custom state (see the Form API) and listening for that state. The example given in the states API explains better:

  Each remote condition is a key/value pair specifying conditions on the
  other element that need to be met to apply the state to the element:

array(
  'visible' => array(
    ':input[name="remote_checkbox"]' => array('checked' => TRUE),   ), )

  For example, to show a textfield only when a checkbox is checked:

 $form['toggle_me'] = array(
   '#type' => 'checkbox',
   '#title' => t('Tick this box to type'),
 ); $form['settings'] = array(
     '#type' => 'textfield',
     '#states' => array(
     // Only show this field when the 'toggle_me' checkbox is enabled.
     'visible' => array(
       ':input[name="toggle_me"]' => array('checked' => TRUE),
 ),
),

  );

jQuery UI Dialog would be a good solution for the popup.

For the second part, there is a module to handle just this situation, so that taxonomy terms can be moderated and approved. Taxonomy Other:

  Use case example: You have a taxonomy vocabulary called 'Organization
  type' and you want to allow users to be able to choose '- Other -' and
  add their own type. You want to use a simple select list and to keep
  the list small to encourage people to use the types you've provided.


Save values from Commerce Profile to User Profile with Rules?

In order of asking:

Data

'Add a Variable' saves data to the {variables} table in the database, to be used with the standard variable_get() method.
'Add an Item to a List' will let you pick an entity and list-type field in the next step to initialise/add another item to (this might include a field with multiple values allowed, say).
'Set a Data Value' will let you set the value for a single, arbitrary field/property (usually as part of an entity). It's different from 'Add a Variable' in that it set the data value on the entity, and doesn't add it to the {variables} table.

Entity (profiles provided by the core profile module are not entities, if you're using the Profile2 module, then they are).

If you're using Profile2, yes.
If you're using Profile2, you'll be able to use it to save the entity after you've used the 'Set a Data Value' to set the value.

Looking through the profile.module and user.rules.inc files I can't see any built in support for the profile module; it stores its data in custom tables and I can't find any glue code that would suggest support's been added for rules (it's worth double checking this though, I could easily be wrong).

If it's not too late on in the build it might be worth having a look at Profile2; as each profile is an entity you'll get rules support built in automatically.

The other thing you could do is write the profile rules functionality yourself (implementing hook_rules_action_info() etc.) but that would be quite a bit more complicated.


RouteNotFoundException thrown when trying to reroute

These are the routes for content entities in a drupal standard install:

 entity.block_content.canonical                        /block/{block_content}
 entity.comment.canonical                              /comment/{comment}
 entity.contact_form.canonical                         /contact/{contact_form}
 entity.menu_link_content.canonical                    /admin/structure/menu/item/{menu_link_content}/edit
 entity.node.canonical                                 /node/{node}
 entity.taxonomy_term.canonical                        /taxonomy/term/{taxonomy_term}
 entity.user.canonical                                 /user/{user}

In this list the route parameter names are in {}. Put the parameter name as key in an array:

$route_parameters = ['node' => $nodeid];

Don't send the response, return it:

return $response;


Is there a way to update custom packages with composer?

You do this with requiring the Composer Merge Plugin in your Drupal project's composer.json and then define in which additional locations it should look for composer.json files to be merged.

  Composer Merge Plugin is intended to allow easier dependency management for applications which ship a composer.json file and expect some deployments to install additional Composer managed libraries. It does this by allowing the application's top level composer.json file to provide a list of optional additional configuration files. When Composer is run it will parse these files and merge their configuration settings into the base configuration. This combined configuration will then be used when downloading additional libraries and generating the autoloader.


How do I replace function commerce_customer_options_list with my own?

Try using hook_field_widget_form_alter in your custom module for either $context['field']['type'] == 'options_list' or of type options_select ... it looks like the widget is set as options_select in commerce_customer_field_widget_info_alter. I'm pretty sure its 1 of the 2 values.

Then you can set a #pre_render attribute to a function that alters the default commerce_customer supplied values. A derived example from the API comments is:

$element['#pre_render'][] = 'mymodule_pre_render_commerce_customer_options_field';

Then in your pre_render function you can add/remove values from the list. I think i've done this once before myself for god knows what ... haha.

Alternatively, you could also probably set or unset values from any old FAPI #options array in a $form with hook_form_alter. Hopefully 1 of these 2 approaches gets you there.

Also, you'll probably want to be sure your module invokes after commerce_customer.


Finally, I discovered that the module uses the core listing resources, so the theming can be achieved via template.php and function NAMEOFTEMPLATE_item_list($variables). The only caveat is that, as the call to this function is recursive, you will need some tricks to know in which level you are. Those tricks could depend on the listing itself; another solution would be to modify the module itself to send the level.

Honestly, I think this in an example of a module whose existence is questionable. A direct treatment of the View_results is much faster and easier to theme.


Admin account has it's own log in form and should not be able to log in in default log in form

You could implement hook_form_alter or hook_user_login() to check the roles of the user logging in and deny if the user is an administrator. Check the Examples module for uses of hook_form_alter and other contrib modules like Legal and User Auth API are practical examples of extra validation and control during user authentication.


How do I add a JavaScript file to a form?

There is no use to attach libraries to a form that is displayed in a modal window because the window has no place for assets (JS and CSS files). Instead I would suggest using hook_page_attachements or attaching the library to page element that is responsible for triggering that modal window.


Rules - Use data from webform field in new entity type

Below is something I learned about using webform data in Rules, which may help you to get this to work (assuming your question is about D7) ...

You have access to all labels and all values of any field of a webform, ie:

[data:MachineFieldName-title] contains the Label of a field with machine name MachineFieldName.
[data:MachineFieldName-value] contains the Value of a field with machine name MachineFieldName

So try to use similar tokens.

For way more details on this, and a prototype rule about this, refer to the answer to "How to create a node from a Webform using rules?":

the 1st attempt relates to using "Entity has field" (which doesn't work for Webform)
the 2nd attempt explains what to do in case of Webform.


This would be better:

  drupal_set_title(t("Donation Details for Project: @title"),
  array('@title' => $project->title));

Taken from here

  Special variables called "placeholders" are used to signal dynamic
  information in a string which should not be translated. Placeholders
  can also be used for text that may change from time to time (such as
  link paths) to be changed without requiring updates to translations.

  @variable, which indicates that the text should be run through
  check_plain, to escape HTML characters. Use this for any output that's
  displayed within a Drupal page.


Try using db_select something like below to build the query for your above condition:

$currentuniversity_query = db_select('field_host_university_value', 'fhuv');

//query of left join with 'content_type_manage_current_university' table.
$currentuniversity_query->leftJoin('content_type_manage_current_university', 'ctmcu',
  '(fhuv.nid = ctmcu.nid)');

//query of conditions and fetching the result
$currentuniversity_query = $currentuniversity_query->condition('fhuv.uid', $uid, '=')
  ->fields('fhuv');
  ->execute();

You may have to modify a query little bit, I just provided what you can try. Also have a look at: https://api.drupal.org/api/drupal/includes!database!database.inc/function/db_select/7

For Drupal 6 try the following:

$currentuniversity_query = db_result(db_query("SELECT mcu.field_host_university_value FROM node n INNER JOIN content_type_manage_current_university mcu ON n.nid = mcu.nid
WHERE n.uid =%d", $uid));


Using multiple sort criteria on a view, can't get them to play nicely

So, first, stickied staff members should be shown sorted by last name. Next, unstickied staff should be shown also sorted by last name.

So you want 2 views (1 being an Attachment) and not 1 View. and you can do all this.

1 View is of all the people fields with only stickied people as a
filter. Sorted by last name.
The Attachment is all non-stickied people sorted by last name. You then
"attach" this View after the 1st view. Get the page to look how you
want using CSS in your theme.

As a final thought I tend to make 2 fields in my content types: first_name and last_name and then join them as a pseudo-field in Views using substitutions or use the Node Automatic Title to hide the title field by using the fname and lname as the title field upon save.

You could change your name column into 2 fields using Views Bulk Operations after creating the "last name" field in your content type ... just saying.

EDIT

The benefits to this approach is that you get rid of the odd custom sorting you've hand made and rely on Core Views utilities on your site. This makes moving your site or upgrading drupal versions easier in the long run ...


Clicking any hash/"#" link, even in Seven themed edit page tabs, scrolls to top of page?

Your problem appears to be that the arrows for the slide show and "logo parade" are linked directly to their container <div id="logo-parade"> with the anchor href="#logo-parade", which causes the page to essentially "snap" to the container, since the div id is the same as anchor when called as a hash (you can see in the url that #logo-parade gets appended).

This could be caused because of a portion of javascript is not being called/run properly which should trigger the carousel without needing to use anchors.

Since your problem doesn't occur in development (you can test this by clicking on one of the arrows and making sure that in your URL bar you don't see #logo-parade appended) it leads me to believe that perhaps a file hasn't loaded correctly on the server, or perhaps the .htaccess rewrite has something to do with it


How to associate the last image from gallery to user's profile picture

Amodule-based solution is preferable. Is there a better way of doing this,
  ie without a new content type? Essentially I'm looking for a user-friendly
  way for users to upload and show their profile pictures.

I would like to recommend field_collection module as I already mentioned in the question's comments.

Step # 1: Enable field_collection module.

Step # 2: go to /admin/config/people/accounts/fields and add a new field named as User Gallery (machine name should be field_user_gallery) and choose field type as "Field collection" and save. Note that you can set the field cardinality as you like.

Step # 2: Go to admin/structure/field-collections and add a new image field named as Image (machine name should be field_image) and choose field type as "Image" and save. (It might already be added in the existing field list.)

Step # 3: Download custom module from custom_user_profile and extract to your module directory. Make sure extracted directory name is custom_user_profile and then enable it.

That's all. I hope it will work for you as works for me.


How to add backgroud image to bootstrap flatly?

It's best practice to create a child theme on Bootstrap, the css modifications go into your child theme. That way you can update Bootstrap later on, otherwise your alterations would be overwritten by the update. More info on how to create a child theme can be found here


How to add image to only front page of Drupal 7?

Here is another approach:

create "a" node (pick whatever content type you want), say it's node id is 123 (generated automatically by Drupal when you save it). Or add a "path" to it like my_page_with_image.
include that image in that node and make sure your input filter that you use (i.e if you use "filtered HTML", which is what I'd recommend) accepts "images".
set node/123 as your frontpage (or my_page_with_image instead, if you added a path for it).

Next question? Maybe "How do I set that page as my frontpage"? ... Ask (via a new question, only 1 question per 'question' here ...) and pretty sure you'll get the answer to that question to ...

PS: What is so special about all your pages where you are considering using PHP for it's actual content? You are aware that using PHP for those things is in general NOT recommended, right? And that you have to be very carefull in which user "roles" will be allowed to create such pages ...


How do I load CSS files to a custom theme?

After trying alot of different things I found the problem in page.html.twig file. Had misspelled one region name (a "-" instead of a "_"). Fixing the misspelled region name just got the CSS working.

Thank you all that helped me by commenting on the question.


How to prevent email address from displaying on edit profile page?

You can to this using hook_form_FORM_ID_alter(), like this:

function MY_MODULE_form_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if (in_array('role_B', \Drupal::currentUser()->getRoles())) {
    // We restrict access if the field is disabled.
    $form['account']['mail']['#access'] = FALSE;
  }
}


This is a known issue, and something I'm hoping to tackle at some point in the next couple of months: https://drupal.org/node/1485074 (see in particular comments #5 and #8). Feel free to subscribe to that issue as well.


I want to change default product variation machine name?

Yes its possible.

if you want to edit the machine name of your content type name 'pages' then goto 'admin/structure/types/manage/page' --> click the "edit" button and update with the required value.

Same way you can do it for any content types.

Thanks


Integrity constraint violation: 1048 > Column 'entity_id' cannot be null

Short answer

It sounds like you have some code which deletes the node ID on saved nodes causing trouble.

Longer answer.

When you create a new node, Drupal will internally make an insert to the node table to generate an ID and then use that id to populate node_field_data and node_field_revision tables (assuming you are using revisions). The ID is also set on the node entity itself and is accessed via the id() method on the Node class.

The NodeForm does a check on the node object upon being saved, and rebuild the form in case the node doesn't get an ID.

Since you don't get an error for node_field_data and node_field_revision tables, it's pretty safe to assuming that the ID generation works and the node is populated with the ID (Core has lots of test cases covering this).

Since stuff reacting to the node being saved fails, with the missing ID, some code must delete the ID after it's set. Class instances are passed by reference, meaning that if you change one instance you change it every where that class instance is used. So most likely you have some code messing stuff up. There is a good chance that it's some code implementing hook_entity_insert or hook_entity_update (or the node specific variations of those hooks).


Why is "/es" showing up twice in my URLs?

In case anyone is having a similar issue, this is how I fixed it.

There may be a better way to do this but I can at least say that this worked for me.

Situation:

So let's say that there is a view that contains two fields. "Path" (for the path to the node being listed) and the "Name" (Arbitrary text field).

The value of the "Path" field contains something along the lines of "/services" (English) or "/es/services" (Spanish). I exclude it so I can link the outputted title as a link to that path.

My Initial Situation:

I INITIALLY did what seemed logically correct (and what usually works). I chose to "Output this field as a link" and chose the "Path" token (under "Re-write results").

For some reason, using this was outputting the path incorrectly,

Solution:

Interestingly, doing the following fixed it:

Rather than selecting "Output this field as a link" and specifying the value of the "Path" field as the "Link path", I re-wrote  the results entirely by coding it by hand.

It baffles me since to me, it appears that doing both of these methods should produce the same results.

Regardless, if you have the same issue I had, this will definitely work.

PS: Modules I have enabled that may have contributed to this:

Views
Pathauto
Locale (for multiple languages)
Links


I think, the module Field Permissions can solve all of your problems.


How do I check a value when creating new content?

You should try to use the "entity has field" Rules Condition (instead of entity is of bundle). In my experience that one works to make that field available as a token in subsequent Rules Conditions and Rules Actions.

If you have other reasons why you need to add that entity is of bundle condition also (I doubt, but one never knows ...), that's fine too, but make sure to do so only after the "Entity has field" Rules Condition.

Refer to the answer to "How to specify a Rules condition related to select list values?" for an example rule.

If you're not familiar (enough/yet) with Rules, checkout the 32 (!!!) great, and free, video tutorials Learn the Rules framework.

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


Hi try to configure this setting
http://yoursite.tld/admin/structure/domain/roles


How to create an rss.xml feed on my Drupal 7 site?

You said you're using the views module, so yes -- very doable:

Go to admin/structure/views/add.
Give the view a name (required), add any (basic) additional configuration options you might want, and then under Create a page, select Include an RSS feed.
Give the RSS feed a path (you'll see the box).
Continue & edit, configure the view like normal, then save.


Importing blog articles from a WordPress site

Maybe WordPress Migrate is what you are looking for? Excerpt from its project page:

  supports migrating WordPress blog exports (WXR format) into Drupal using the Migrate module. Import of posts, pages, comments, attachments, tags and categories is supported. Imports can be rolled back completely.


How to unset or hide a view header / footer when an exposed filter is being applied?

I found this solution that is really very simple:

use Drupal\views\ViewExecutable;
/**
 * Implements hook_views_pre_view().
 */
function MODULE_views_pre_view(ViewExecutable $view, $display_id, array &$args) {
  if ($view->id() == 'nouvelles' && $display_id === 'block_1' && !empty($view->getExposedInput())) {
    $view->removeHandler($display_id, 'header', 'view');
    //or
   // $view->removeHandler($display_id, 'header', $view->getHandlers('header')['view']['id']);
  }
}

With the getExposedInput() function you can figures out what the exposed input for this view is, so wee need to check if the returned value is not empty.

The function removeHandler() is the key here, but wee need to know:

  public ViewExecutable::removeHandler($display_id, $type, $id)

$display_id -> is in the function params
$type -> can be header or footer
$id -> view (see the getHandlers() output)

You can found additional info with the getHandlers() function:

dpm($view->getHandlers('header'));

Array (
    [view] => Array
        (
            [id] => view
            [table] => views
            [field] => view
            [relationship] => none
            [group_type] => group
            [admin_label] =>
            [empty] => 1
            [view_to_insert] => en_vedette:block_1
            [inherit_arguments] =>
            [plugin_id] => view
        )

)


Captcha is not working as expected.Visible on webform when logged out and invisible when logged in

That is expected behaviour. Under permissions there is an option:

Skip CAPTCHA
Users with this permission will not be offered a CAPTCHA.

Admin by default has this set meaning they won't see the Captcha. Captcha isn't necessary for an Admin since they are assumed to be trustworthy.
You can also set other roles here so that they don't see the Captcha. If you have strong Bot deterrents in user registration, you probably don't want authenticated users to have to go through the Captcha process after every node/comment/etc creation as this will just cause annoyance, especially for regular contributors. If you allow anonymous content creation, obviously you don't want to provide this option for that role, or the Bots will come knocking...


how to get weight or delta of current field collection item that is being computed

I was searching in wrong path :( this is found at

http://drupalcontrib.org/api/drupal/contributions!field_collection!field_collection.module/class/FieldCollectionItemEntity/7

code for getting delta is

$wrapper = entity_metadata_wrapper('field_collection_item', $entity);
$cur_delta=$wrapper->delta();


Is there any way to fetch all users into a list in rules?

I'm assuming your question is about D7. A possible answer to your question is to use the Views Rules module, as further detailed below.
1. About the Views Rules module
The Views Rules module makes Views data available in Rules, enabling intuitive rule configuration for dynamic data. Some details from its project page:

... provides two types of elements in Rules, configured with a "Rules" view display:

Views loop: A views loop is similar to a regular Rules loop, but allows looping over rows of view results.

Collect view result rows (action): This action collects each variable in all view result rows into list variables for use in Rules.

Tip: When selecting the data type for variables in the view, if the field is an entity identifier (e.g. Node ID), you can set the data type to the entity type (i.e. Node) to directly use the variable in Rules as an entity!

2. Create a view of display type 'Rules'
After you enable the Views Rules module, you can use Views to create a view of those users you want "to fetch into a list in rules" (as in your question). Add of view of display type Rules (important, that's the key to make it work!). Here is how you can add such display:

Next configure the row variables, by using the link that says "edit field info", as shown here:

You probably want to use one or more of the variables similar to those that are shown in this screenprint:

3. Create a rule using the view of display type 'Rules'
Create the appropriate Rules Actions in your rule, using these guidelines:

Use the link that says Add view loop to add a Views loop, and select the "Rules" display created in the previous step.
Configure the parameters and variable names.
For each user contained in your Views loop, perform whatever Rules Action that fits your requirement, using the variables you configured at the end of the previous step (you may have to revisit the previous step to add more similar variables there if needed). If you created the Rules row variables as suggested in the previous step, your actual eMail can use tokens such as [usermail:value], [username:value], etc.

Easy, no?


Should I use t() in a hook_menu's description?

See Strings at well-known places: built-in menus, permissions, log messages and .info files community documentation:

  The Drupal 6 and 7 menu system stores menu item titles and descriptions in English. This allows the system to cache the data, but display to users using various languages on demand. For this to work, you should not use t() on the title or description of menu items in your hook_menu() implementation. Additionally, you should attempt to use a literal string (rather than a dynamic string) for these two keys, so the translation template extractor can find the string you used.

Emphasis mine.


The doc root should be where index.php is; that's where all requests for non-existent files are rewritten to.

If you mean "should the application and the front end be separate, like in other frameworks?", then yeah, maybe they should. But they're not at the moment, if memory serves there was a declined issue about doing just that when D8 was first being planned.


It sounds like there is some invisible HTML over the top of your form.

Inspect one of the form elements with Firebug and see what it actually selects, then fix the HTML / CSS.


How to pass an argument into Views for Drupal 7?

In your contextual filter, under WHEN THE FILTER VALUE IS NOT AVAILABLE, choose Provide default value and select "Content ID from URL" under Type.


Print stylesheets & overriding a base theme style sheet

You shouldn't be doing

stylesheets[][] = ...

Instead you should be doing

stylesheets[type][] = ...

type is the type of media to include the stylesheet for, like all, screen etc.


caching issue after updating records into database

Any well written module that has a cache, should prefix it with cache, meaning that the answer to your question is "Yes".

In the odd event that a module caches data somewhere else, you can check your modules for implementations of hook_flush_caches, and see what they remove.

Reference by Letharion


Overriding a view with views_pre_render. How to be more specific?

You should be able to put in logic like

if ($view->name == 'topic_page' && $view->current_display == 'MACHINENAMEOFBLOCKDISPLAY') {
  // do whatever you want whenever Views is crafting up this view and display
}

which will further filter to a specific View as well as display.