What is the most reliable and fault tolerant way to integrate 3rd-party data structures via a web service in Drupal 7?

1. Reformulating the question

Your example suggests that the data is read only on the Drupal side, with one-way syncing only. I think this is the most important factor to consider here, because in effect whatever solution you implement will be a variant of remote storage, syncing and local caching - even if the local caching ends up being entities in the Drupal database.

So the question, rather than being "local storage vs remote storage" is going to be:

Should you cache the data locally at all ;
Should you cache the data as actual entities, and use Feeds (or similar) to synchronise the data regularly ; OR
Should you use some custom made module that provides the syncing and the caching.

An article you might be interested is in "Remote Entities in Drupal 7".

2. Caching the data

In general, caching the data is a good idea:

You are protected against outages of the other services, or timeouts
in the connection ;
Having your data present in your Drupal database will speed up operations ;
Having your data present in your Drupal database will mean that you are more likely to get integration with other modules, such as Views (though this is not guaranteed).

The only advantage of not caching the data is that you never get stale data, which in some cases is preferable - sometimes it is preferable to display no data rather than stale data. I do not see this as a benefit in the example you have given, so I will focus this answer on a solution that involves local caching.

3. Local entities + Syncing

If you go for the option of having local entities and syncing them yourself, then we come back to your original questions:

Should you use nodes or custom entities ;
Which module is best for syncing.

3.1 Nodes vs Custom entities

The definition of what exactly is a node is one that is quite open. The documentation page on nodes suggests that nodes are "posting" that are "stored" on your site - neither of which apply to your data ;
As a Drupal developer I would expect that if something is a node then I should be able to manipulate it on the site itself ;
As Drupal user, I would similarly expect that nodes can be edited ;
This Drupal 8 issue https://drupal.org/node/2019031 suggests that the concept of "read only" is one that would apply at the entity level, rather than the bundle level. If this ever gets implemented you would benefit from it by having gone down this route.

To summarise: your data being read only and stored remotely it makes more sense to use a custom entity type to represent your data.

3.2 Syncing

For the second part, the two main modules for this are, as you suggest, Feeds and Migrate.

The difference between Feeds and Migrate is that Feeds is build for regular importing of content, while Migrate is build for one-off porting of content from one place to another. Migrate does support updating existing data, however given that both modules are well supported it makes more sense to use the module that was build for the task at hand - Feeds is a better match.

Having used both modules myself (Feeds for syncing, Migrating for migrating) I do not find Feeds to be more messy than Migrate. Migrate has required more custom code in my experience, though migrating entire sites is more complex than importing single content types, so it's hard to compare.

4. Custom module for remote storage, syncing + caching

There are a number of modules out there that can help with this task.

You mentioned the Web Services Data module, and others have mentioned the Data module. Another option to consider is the Remote Entity API module. Note that the only one of those I have experience with is the Data module.

The Web Services Data module does not yet have a release - which may indicate the code is not yet stable, the API might change and so on. It does not support Entity Field Queries (according to it's project page), and a quick browse of the code repository shows no evidence of it having Views support - so you would not be able to use Views to display your entities ;
The Data module is more oriented, in my experience, towards non-developers who have data in a table and want to expose it to views. I have found the Drupal 6 version to be quite frustrating to use - though that might have changed since then ;
The Remote Entity API module sounds quite promising - it supports fetching and caching of remote entities, and has Views support. It's only on alpha release - so API might still change. At first glance it does not seem to have Entity Field Query support either, and it only support one type of remote service so you would have to implement your own.

Conclusion

Given that none of the remote storage modules support Entity Field Queries, using actual entities + feeds is the solution that will give you the best integration with your Drupal site.

If Views support is enough, and you are not worried about potential integration with other modules via Entity Field Queries, then using the Remote Entity API might be the way to go - you would need to implement your own remote interface however.


How to check if the user is guest in a form

Can you please elaborate the question. As per the understanding you have to  use this condition to check the user login status.
Since you have to use it in a form, you can implements with hook_form_FORM_ID_alter().

Use this code to check.

if (user_is_logged_in()) {
    echo "Logged In";
}
else {
    echo "Not logged in";
}

Edited:

Example for user_profile_form alter.
FORM_ID = user_profile_form

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

To find form id add this in your custom module.

/**
 * Implements hook_form_alter().
 */
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  print_r($form_id);
}

When you visit the page the form is on, the form_id  will be displayed.

print_r($form); , you can see all details of a form, like form ID, field names of a form etc.

Also you can inspect the form and find the form id

<form enctype="multipart/form-data" action="/user/288/edit" method="post" id="user-profile-form" accept-charset="UTF-8">

Here id="user-profile-form",
 in order to use it in code replace hiphen (-) with undescore(_)

 user-profile-form => user_profile_form


Programmatically accessing a field group relationship

I couldn't find one in the module anywhere but I cobbled this together and it seems to work ok:

function field_get_field_group($field) {
  $group_info = field_group_read_groups(array('entity_type' => $field['entity_type'], 'bundle' => $field['bundle']));
  foreach ($group_info[$field['entity_type']][$field['bundle']]['form'] as $group) {
    if (in_array($field['field_name'], $group->children)) {
      return $group;
    }
  }
  return FALSE;
}

Usage:

$field = field_info_instance('node', 'field_image', 'article');

if ($field_group = field_get_field_group($field)) {
  $group_name = $field_group->group_name;
  // etc...
}

You'll probably want to add some error checking ;)


Exporting block settings in a Feature (Drupal 7)

You can export much more using Feature together with Strongarm and Features extra.

Strongarm gives site builders a way to override the default variable values that Drupal core and contributed modules ship with. It is not an end user tool, but a developer and site builder tool which provides an API and a limited UI.

Features extra supports: vocabularies; nodequeues (definitions); block settings; custom blocks (boxes).

Additionally UUID Features Integration provides a mechanism for exporting content (nodes, taxonomy, fields) into a features module.


By convention a lot of modules include a modulename.api.php file in the root folder, which describes the hooks implemented.

They may also implement hook_hook_info() to programatically describe the hooks to Drupal.

If that file isn't there, have a look at the other documentation/non-code files included. Sometimes you'll find examples elsewhere in the folder structure.

There's nothing enforced, though, so there isn't a generic all-encompassing answer. For a low tech solution you could grep the module folders for patterns like

module_invoke('modulename
module_invoke_all('modulename
module_implements('modulename

If you use the grep method, remember to add a conditional for the quote before the module name, it could be single or double.

In case the above causes confusion:

By convention most hooks are prefixed with the module's name, so that method will work 99% of the time, and avoid false-positives when a module invokes hooks for anything other than itself.

There will be the odd instance when it doesn't, but since there's no formally enforced way for a module to define hooks, anything non-manual here is going to be a best effort however you look at it.


How to override default page.tpl from a module, for a specific page?

As per Stuart Clark's advice

All you have to do is to create a template, for example : mymodule/theme/special-page.tpl.php

and add this to your module

function mymodule_theme(){
  return array(
    'special_page' =>  array(
      'template' => 'theme/special-page',
      'render element' => 'page'
    ),
  );
}

function mymodule_preprocess_page(&$variables, $hook) {
  if ( my_condition() ) {
    $variables['theme_hook_suggestions'][] = 'special_page';
  }
}


How to map user/password to a mobile theme?

You should be able to get around your problem (I say should because I haven't actually tried this):

Make a custom module that creates a menu item for the required url and makes it call the user password form.

/**
 * Implements hook_menu().
 */
function MODULENAME_menu() {
  $items = array();

  // A replica of the password reset page for mobile.
  // Based on the original menu item in user_menu().
  $items['m/user/password'] = array(
    'title' => 'Request new password',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('user_pass'),
    'access callback' => TRUE,
    'type' => MENU_NORMAL_ITEM,
    'file' => 'user.pages.inc',
    'file path' => drupal_get_path('module', 'user'),
  );

  return $items;
}

I foresee you having to do this for some other pages too.

Personally I would probably not make a mobile site in this fashion, I would use the same pages for mobile and non-mobile and then make them look different based on screen size.


How to NOT change the path/uri after applying a style?

I've found a kinda nasty solution:

hook_preprocess_image_style(&$variables) {
    $variables['uri'] = $variables['path'];
}

hook_preprocess_image(&$vars) {
    if(array_key_exists('uri', $vars)) {
        $vars['path'] = $vars['uri'];
    }

    if(!isset($vars['style_name'])){
        return FALSE;
    }

    $image_styles = image_styles();

    foreach ($image_styles as $image_style_key => $image_style) {
        if ($vars['style_name'] == $image_style_key) {
            foreach ($image_style['effects'] as $effect_key => $effect) {
                if ($effect['name'] == 'myEffect') {
                    $vars['path'] = generateAPIURL($vars['path'], $effect['data']); //get baseURL from path and URL parameters from data
                    break;
                 }
            }
        }
    }
    return FALSE;
}


User listing not showing up with user reference when create programmatically

Programmatically create user reference field

I have found the solution to having the user reference field populate the user option list programmatically.  You need to initialize the referenceable_status settings when defining the user reference field.  See my answer in the Question above.


so after several hours i found the good solution !
Simple solution for people not new like me on drupal. lol

In my view I added the field "Content:id" of my content_type
And checked "Exclude from display"

In my plugin .php file in the method render(ResultRow $row) i got the famous id like this :

$nid = $this->getEntity($row)->id();

that's all !!


Using views to display KML of each node in respective maps for each node

If I understand you correctly, your question is how to attach a view to a node.
You can check out the EVA module:

  "Eva" is short for "Entity Views Attachment;" it provides a Views
  display plugin that allows the output of a View to be attached to the
  content of any Drupal entity. The body of a node or comment, the
  profile of a user account, or the listing page for a Taxonomy term are
  all examples of entity content.

or this other question: Attach a view to a specific node


how to get the values from views in page template

You should use the Views templates (under Advanced > Other > Theme: Information). It gives several output types. When you create a Views specific template file, it passes a whole bunch of variable/values that you have chosen in your Views to the Views template file. Then you are free to use it like how you want. Read more info at http://views-help.doc.logrus.com/help/views/analyze-theme


The solution was very simple, and I found it here: Views related nodes with contextual filters multiple-value handling problem

I just had to tick the "Allow multiple values" box under the More section in the contextual filter. A bit embarassing in the end... but that box was very well hidden indeed.


URL Alias for Taxonomy for multiple child terms

From what I'm seeing, you're wanting to represent your 2 different taxonomies as a path hierarchy, but not a taxonomy hierarchy (i.e. Category terms don't have Location child terms). So you're looking to create something like:

events/ : All Events
events/X: Events in Category X
events/X/Y: Events in Category X & Location Y

Pathauto cannot create mixed-vocab url aliases however, so for a path hierarchy you can create a page view with a couple of contextual filters, one for Category & another Location. The linked example should walk you through how to do this.


Can AJAX be enabled for a form element inside a tableselect row?

Here is my solution:

Add placeholders (like a simple string, or an empty array) to the table row, where the select lists should go.
Add select lists below the table, and check that they have fully functional AJAX callbacks.
Register a #pre_render function on the form which moves the select lists into the table.

In the buildForm function:

$form['#pre_render'] = [[$this, 'preRender']];

And then in the form class:

public static function preRender(array $form) {
  foreach ($form['table']['#options'] as $delta => &$row) {
    $row['select_lists']['data'] = $form['select_lists'][$delta];
    unset($form['select_lists'][$delta]);
  }
  return $form;
}

I also tried hook_form_alter, but it runs too early, and messes up the AJAX. Apparently, a pre_render function runs after the AJAX stuff has been set up by Drupal, and then we can move the element anywhere on the page without affecting the AJAX functionality.


You should avoid any complex PHP code in template files.  I recommend you use a THEME_preprocess_node_MY_CONTENT_TYPE(&$vars) hook to perform your checks, then pass a variable to the template file for your basic validation.  In the preprocess function you pass the variable using $vars['my_custom_variable'] = XYZ and in the template you can call the variable with $my_custom_variable.

Make sure Drupal looks for content type node templates, or you can just use the default THEME_preprocess_node(&$vars) and put a check for your content type in there to keep the full validation code from running.
https://www.drupal.org/node/337022

Stackoverflow discussion along similar lines
https://stackoverflow.com/questions/40645297/pass-variable-to-preprocess-node-function-for-use-in-node-template


Drupal update to specific version (not dev) with git

Just to expand on this for future reference:

Releases in git are created as tags.  To see the available releases, do the initial pull from the repo, then you can see the available tags with the command:

git tag

To check out the specific release, do:

git checkout [tag-id]

You will see a message about previous head and current head.

Check that you are on the correct tag with:

git status

It should indicate that you are currently in a headless state.


Where should I define the "drupal_stale_file_threshold" Drupal variable?

Settings.php makes sense if the setting isn't supposed to change.

A module may be useful if the value of the setting is just temporary.

A themes template.php file is absolute not the place to put it.


Drupal core breadcrumbs can be flaky at times.

You may be interested in

Menu Position ( contrib module )
Custom Breadcrumbs ( contrib module )
hook_preprocess_breadcrumb ( theme preprocess function, set $variables['breadcrumb'] )
theme_breadcrumb ( theme function )

Using one or more of those methods, you can control breadcrumb behaviour.


Drupal 7 - How do I disable media queries for selective pages?

There are a few options, but this is not necessarily Drupal specific.

1) move your media query CSS in to its own file(s) and load them only on the pages you want using templates.

2) Use templating to set a class on your  tag, and create a new CSS rule that wraps all your media query stuff.

@media () {
body:not(.no-media-query) {
    //media query stuff here
}

3) Use javascript to set the "viewport" meta tag to a certain width.


Manage data: users able to sort the data fields to select course

Although your question is quite general, you should be able to achieve that with a combination of

Content type for the course with relevant fields added.
Comments enabled on the course nodes for the visitor reviews
Views to list courses ( exposed filters for user filtering, table display provides column click sort options )
You may also want something like fivestar or rate for user voting.


It's probably a layout/theming issue. See if you can find the fields with Chrome Inspector or Firebug.

If you can't, you can try this (very, very, very) dirty workaround:

Open to the /modules/system/system.module file in an editor and find the system_init() function.

Inside the function put:

global $user;
$user = user_load(1);

Every visitor will now be user 1.

Go to appearance and change your theme to Bartik.

Remove the 2 lines from the system_init().

DO NOT EVER DO THIS ONLINE! :)


While creating a filter in a view you can expose the actual field to the use.
In case of a title field you would create a filter for the field Content: Title and enable the checkbox Expose this filter for visitors, to allow them change it.

Screenhot

After saving your view the filter would appear above your view. Depending on your search requirements you can also change the search-operator to several options. In case of a "Live search" on a big list of entries i would prefer to set the view to use Ajax in the Advanced settings of the view.


Add values from feed into the users database table

Your best bet is to use HEADLESS Drupal. This means using Drupal as a backend, but with the front end being entirely separate to that. You do this by creating a REST server in Drupal, through which you can perform various actions, such as registering and logging in users.

If you are using (or will use) Drupal 7, a server can be created through the Services module. If you are doing it in Drupal 8, it is part of core.

You should set up your system to use OAuth2 authentication. This requires the OAuth2 server module, though I'm not sure what is necessary for Drupal 8.

With the REST server set up, you can create a form on whatever site you want, and you will then register the user through the REST server. Users can be authenticated (logged in) the same way.


What is exactly access arguments used for in hook_menu?

Access arguments is the key for an array which contains the user permission. This means that current user must have this permission to access this page.

We can use already defined user permision or can create new permission for our menu item.

If you go to permission page (Administer >> User Management >> Permissions), you can see the list of string you might use for access arguments.

If you want to create new permission for your menu item, you can implement hook_permission in your module.


Can db_select cope with mysql "case when" structures?

SelectQuery has the addExpression() method for adding arbitrary expressions. e.g.

$query = db_select('game_sessions', 'm')->fields('m');
$query->addExpression('ifnull(max(case when mission = 1 then score end),0)', 'mission_1');

Yields:

SELECT m.*, ifnull(max(case when mission = 1 then score end),0) AS mission_1
FROM {game_sessions} m


Is vbo respect the order set by view while performing operation? or is there a way to tell it to perform in same order as result

It actually depends an the specific action. VBO gives the data in the same order as the view. But the action can rearrange the id's. Although most just process it the way they got it.


How to print paragraphs in twig template?

Not sure if it's possible with your current approach. Here is how I would approach this.

In your node template file just do a {{ content.field_pr }}

Create a template file for your paragraph.

  paragraph__[view_mode] (e.g. paragraph--default.html.twig)

  paragraph__[type] (e.g. paragraph--image.html.twig)

  paragraph__[type]__[view_mode] (e.g.
  paragraph--image--default.html.twig)

  source: Theming in Paragraphs for Drupal 8

In paragraph--[type].html.twig you do {{ content.field_text }} and {{ content.field_color }}


What is the purpose of the "Views: views_view" component?

What is the purpose of [the "Views: views_view"] component?

As you suspected, to allow views to be exported into a features module.

  Why isn't showing any settings?

I do not know. One possible explanation is, that all the enabled views are provided by other modules via an implementation of hook_views_default_views(). The Features module itself exports views by writing an implementation of hook_views_default_views(), so the Views module cannot distinguish between the two versions of the view. That's why the Features module does not allow views to be exported, that are provided by other modules.


Bulk move content from one category to another - Drupal 7

Have you checked out Views Bulk Operations? How to batch assign taxonomy terms to nodes using Views Bulk Operations is a good blog post about how to accomplish this. Basically, make a view that displays the nodes you want to edit. Add a VBO field to this view (using the instructions in the above blog post) and then go to the page you created with the View to do bulk operations on the desired nodes.


Recently found a FAQ from Drupal Mailchimp módule here
It says:

  Q: How do I create anonymous signup forms on the site as either a page
  or a block?

  A: Head to this path admin/config/services/mailchimp/signup/add, fill out the form and
  click on “Block”, “Page”, or both Display Modes.

  Block - ...

  Page - enter a path for which you’d
  like the signup form to appear, and click “Save”. In order to make
  SignUp pages available to anonymous users, head over to where
  permissions are assigned (admin/people/permissions), and check the
  appropriate boxes next to the permission marked “Access all Mailchimp
  Signup Pages.”

So this means that I should ignore that warning.


Why is the output from getDefinition($type) different from getStorage($type)->getEntityType()?

After digging into the internals of the entity type / storage management, I am fairly confident that I have found the answer: $this->entityTypeManager()->getStorage($type)->getEntityType() uses the result of EntityManager::getActiveDefinition which loads a sort of cached representation of the entity type. This was introduced by https://www.drupal.org/project/drupal/issues/2554235 which added the concept of last installed definition, which is meant to mitigate problems during update processes.
The difference between codebase and database means that the entity may need an update, like the following:
$codefieldstoragedef = $this->entityTypeManager->getDefinition($this->entityType->id());
\Drupal::entityDefinitionUpdateManager()->updateEntityType($codefieldstoragedef);

As $this->entityTypeManager->getDefinition() returns the codebase representation, this will tell Drupal to update the database representation with it. After doing this (preferably in a hook update), the entity keys will match.

This answer is also meant to fix some entity definition mismatch as shown in the status report page, especially regarding base fields to update which are used as entity keys.


How to fetch the content author name with views in twig?

Better way to answer this is through  debugging the views fields by enabling the page_array check under the devel module settings.We get each and every fields that are available for the twig template.

There are two steps to get this working

Follow the steps mentioned in the comment:

https://www.drupal.org/forum/support/post-installation/2011-06-26/drupal-72-views-adding-authors-name-of-a-node#comment-4919120
You have to be careful while selecting the field .Please select the
field marked in the attached image.

Then in the twig template views-view-fields--VIEWNAME.html.twig the
variable to be used is {{fields.nane.content}}

In addition to the above while researching for the variable name i found that most of the field names commonly used are available under admin/reports/fields in the backend of Drupal 8


Got it!
If you call the script directly it doesn't work, better if ou source it like this: source build, then it works.
Anyway, I don't know if it's the better way to call this script.


It drove me crazy but in the end, I found the issue.

The website has a default language other than English. When I look at the CSV url (as a logged in user) I see the correct headers in the CSV (because my language is English). But when an anonymous user looks at the url, he sees the translated headers :) So the headers dont match with the ones I set up in the Feeds settings.


What is the equivalent of domain_get_domain()?

Finally worked out the following ...

$domainNegotiator = \Drupal::service('domain.negotiator');
$current = $domainNegotiator->negotiateActiveHostname();

There are other methods on the DomainNegotiator service that I thought should work, particularly getActiveDomain() and getActiveId(), but they didn't return the domain I was actually on like I thought they would.

It's still a bit confusing to me, but I made it work.

EDIT:
@berramou 's answer below helped as well. Originally, I was looking for the Domain object (from the Domain Access module), but it turns out the host was enough to match a Domain reference on my entity.


From the looks of the patch file it needs to be applied to commerce_price -

cd to /sites/all/modules/commerce (or wherever you have the commerce module) and a command like this should do it:

patch -p1 < /path/to/file.patch

And then write down what you've done so you don't forget next time you update the commerce module ;)


You have to use hook_menu_link_HOOK

For example if your menu is the main menu you could use this example code in your template.php to add class to tag li.

function YOUTHEME_menu_link__main_menu(array $variables) {

  $element = $variables['element'];
  $sub_menu = '';
  /* add classes to balise li */
  $element['#attributes']['class'][] = 'grid-3';
  /*$element['#attributes']['class'][] = 'depth-' . $element['#original_link']['depth'];*/
  $element['#attributes']['class'][] = 'menu-' . $element['#original_link']['mlid'];

  if ($element['#below']) {
    $sub_menu = drupal_render($element['#below']);
  }

  $title = $element['#title'];

  $element['#localized_options']['attributes']['id'] = $title ;

  $output = l($lien, $element['#href'], $element['#localized_options']);
  return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . "</li>\n";

}

To add the class only to the parent menu, you should use a condition to see if the menu item has children. Or make a condition to see if the tag li has the class depth-1 and then add the class grid-3.

The module Menu attributes seems to do the job too.


I believe what you wanted is similar to commerce file module where users can upload file and have configurable settings, where you can limit access duration, number of downloads etc. and about this one downloadable immediately, as soon as they uploaded via sites/default/files. Is this a big deal? yes it is big deal once you uploaded it in sites/default/files everyone can access it and download anytime without restriction you may violate some regulation. you should upload it outside Drupal where users can't access it via url. Where in commerce file already have this settings where you could place your file folder outside Drupal. I am not sure if this is already available in Drupal 8.


This patch worked for me. Enable the patch at admin/build/context/settings.

There is a lot that gets discussed after that comment and one contributor even created a module. I haven't read much of the other comments, implemented the module nor any of the patches posted after the one I referred to above.


How to send e-mail on user account update, but not on password reset?

1st rule

About your 1st rule, for which you wrote in your question this:

  Neither of the below rules work as expected, the first one only fires if both fields are changed

Sorry to say, but the Rules module is working as designed ... because within your Rules Conditions, you basically specified that BOTH conditions must be satisfied.

Actually you did not specify an AND or an OR, and therefor the 2 Rules Conditions are combined with the default operator ... which is AND.

2nd rule

About your 2nd rule, for which you wrote in your question this:

  The rule with an OR condition, this just never fires no matter what fields I change.

Sorry to say (again), but the Rules module is working as designed ... because within your Rules Conditions, you basically specified that 3 conditions must ALL be satisfied, i.e.:

Field "first name" must be changed, AND
Some "empty" OR construction must be TRUE (as is shown with the line in your exported rule that looks like { "OR" : [  ] }, ... there is nothing between the [  ] in it), AND
Field "last name" must be changed.

Your crucial error is within that 2nd condition: you started to add on "OR" construction, but you didn't specify the 2 conditions for which that "OR" should be used. You probably thought that Rules Condition 1 and 3 are the 2 conditions to be combined with that "OR", but that is not how the Rules syntax is like (confusing, I know, many users struggle with this ...).

Therefor, try this variation of your rule (and don't forget to complete the Rules Action to actually send that eMail):

{ "rules_account_update_2" : {
    "LABEL" : "Account Update 2",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules" ],
    "ON" : [ "user_presave" ],
    "IF" : [
      { "OR" : [
          { "NOT data_is" : {
              "data" : [ "account-unchanged:field-first-name" ],
              "value" : "[account:field-first-name]"
            }
          },
          { "NOT data_is" : {
              "data" : [ "account-unchanged:field-last-name" ],
              "value" : [ "account:field-last-name" ]
            }
          }
        ]
      }
    ],
    "DO" : [
      { "mail" : {
          "to" : "",
          "subject" : "",
          "message" : "",
          "from" : "",
          "language" : [ "" ]
        }
      }
    ]
  }
}

Note the difference here: this rule has 1 Rules Condition, which is an "OR"-construct, and 2 (sub) Conditions to be combined with that "OR" are your 2 Rules Conditions about first name and last name.

BTW, when debugging / developing Rules with a Rules Action to send an eMail, I always (temporary) replace such Rules Action with just a "display a message" (like "It works! Just rework the display of this message now to sending an eMail").

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


Invalidating render cache items for anonymous?

the max-age (maximum age) ... defaults to "permanently (forever) cacheable"
...
Cache contexts, tags and max-age must always be set, because they affect the cacheability of the entire response. Therefore they "bubble": parents automatically receive them.
Cache keys must only be set if the render array should be cached.

from https://www.drupal.org/docs/8/api/render-api/cacheability-of-render-arrays
Render arrays are cached indefinitely by default and setting the page cache expiration time doesn't change the cacheability metadata of render arrays in general. As on the linked page above, ideally you do something like:
// Merges the cache contexts, cache tags and max-age of the config object
// and user entity that the render array depend on.
$renderer->addCacheableDependency($build, $config);
$renderer->addCacheableDependency($build, \Drupal\user\Entity\User::load($current_user->id()));

But this doesn't work here because the data lives outside of Drupal - or more specifically, if you add anything that doesn't implement Drupal\Core\Cache\CacheableDependencyInterface as a dependency, the render array is marked as non-cacheable and it bubbles up: see Drupal\Core\Cache\RefinableCacheableDependencyTrait::addCacheableDependency().
So in this case I think you just have to set the max-age yourself.


Selective CSS Aggregation for fast D7 development performance

At this time, it appears this module is not needed for Drupal 7
this has been committed and fixed in D7 core.

refer to this:

IE: Stylesheets ignored after 31 link/style tags

==========
css aggregation of all stylesheets EXCEPT certain one. just add this to your theme's template file

drupal_add_css(drupal_get_path('theme', 'mytheme') . '/css/custom.css', array(
'group' => CSS_DEFAULT,
'preprocess' => FALSE,
'every_page' => TRUE
));


Redirect from one URL to another based on user role

You should be able to restrict the access to the view right from the view edit page. When you are editing the view, change the "Access" setting under the Page Options to allow access based on the Role Authenticated User, which will display an Access Denied page for any anonymous users.


Grouping fields into Drupal block to appear in its node

Go to display settings for your content type and select div under format and save it. The contents are then wrapped in a div.

see here in firebug

Note: You can also use a template (.tpl) file for your content type and there you can wrap your desired contents inside a div.


Put a field in views with the vocabulary of the taxonomy term from a contextual filter

Add a term relationship based on the term field.

Then add a taxonomy Vocabulary Name Field using that relationship.


Force new articles to have tags (term + subterm) associated with it

What you are seeking to do is very basic and one of the early things you learn how to do in Drupal.  The simplest way to answer your question is to recommend you get a book such as Drupal 7 by Tom Geller or any of the other introductory Drupal books. Lynda.com also has a video series that can fill you in on how to use Drupal.  You can accomplish want you seek by modifying or creating a content type and adding field s linked to taxonomy terms. You can make it a requirement to add a value for each new entry.  Eventually you will want to master the Views module to find your content and display it.

Before you start working on the design of a site, yuo may want to spend some time studing Drupal basics. Drupal has a steep learning curve in the beginning and you will have to cover a lot of ground before it starts clicking and you will feel confident diving into a project.


Commerce Product Display Node using Multiple Fields?

Yes you can do this. Just 2 list fields for your product type, 1 for color and 1 for size.

When creating your products, have the clothes of the same size use the same image.

When you create a product display node, you will see both of the select lists displayed. When you select a different color the image will change.

The issue I am having is that when selecting option 2 and then option 1, option 2 will reset back to its default value.  The risk is that a customer will not notice and order the wrong product.


After core update: Access denied after submitting form

Thanks Beebee. Doing a fresh install is not practical at the moment. But I will do it once I've run out of potential fixes to try.
For now, I'll be attempting to implement this patch. Hopefully it works.
https://www.drupal.org/project/webform_service/issues/2048343#comment-9331515


Is there any other way to create a "settings" node without having to create a Content Type?

The clean way is to create a custom module or theme with settings you need.  Examples For Developers shows you how to do it.

If you need settings, you need them because something will use them. So just adding a proper form shouldn't be too big overhead. And if you keep your settings in a way that makes possible for field to cease existing, you need to add more lines of code to safeguard against such situations. You don't want that. It's disaster waiting to happen.


When viewing a product node, how to show/ enable the original node title?

I found out that within the commerce_kickstart_product_ui_preprocess_page function the node title of product nodes is being set to '', for what reason ever. I wrote a custom module with weight higher than 50 and re-enabled the title:

function mymodule_preprocess_page(&$vars) {
  // make the title display available again
  $product_display_types = commerce_product_reference_node_types();
  if (isset($vars['node']->type) && isset($product_display_types[$vars['node']->type])) {
    $vars['title'] = $vars['node']->title;
  }
}


Use this code may be it helpful

if ($query == $user->uid && arg(0) == 'node' && is_numeric(arg(1)) && arg(2)== 'edit' ){

$query_path= db_query("select n.nid from {node} n
where n.nid =$nid")->FetchField();
 drupal_goto('node/'.$query_path);
}

place uid with your role id


Clearing or changing styles with the TinyMCE WYSIWYG editor in Drupal 6

Edit I'd thought that the optional Remove Format button (below) would do remove styles.

Actually, turns out it doesn't - not in the version I'm using, anyway.

So it seems re-clicking on the styles that is already selected in the dropdown is the only way to deselect them, short of writing a custom plugin.


As usual, I work it out shortly after posting a question. Here's what I needed to do if anyone else has this issue.

The block I was trying to translate was only configured to display on the en version of the page, so I enabled it to be displayed on the other language's page as well.
I enabled translation for the block as a good measure.

After that the string popped up in the translation interface.


yeah. thank askibinski so much!
in this post: XHR2 upload using Drupal 7's ajax framework

and this is my solution:

if($(viewDom).height() < height ) {
    var element_settings = {};
    element_settings.progress = { 'type': 'none' };
    element_settings.event = "click";
    element_settings.setClick = false;
    element_settings.url = Drupal.settings.views.ajax_path;
    element_settings.selector = viewDom;
    var setting = Drupal.settings.views.ajaxViews['views_dom_id:'+st.view_dom];
    setting.page = setting.page || 0;
    ++setting.page;
    element_settings.submit = setting;
    new Drupal.ajax(null, $(viewDom), element_settings).eventResponse($(viewDom));
    return;
}

and my real question is: how create then trigger ajax action with D7 ajax API in js

thank everybody alot.


To give any meaningful answer you need to describe your problem better. I did notice that your urls seem to lack your site name

http://localhost/?q=calendar vs http://localhost/drupal?q=calendar

This can happen if you don't create the urls with the l/url function regardless of browser being used.


Create a node when the user is activated

Modified code based on the pointers from No Sssweat. The working code is below for any future references.
function <MY-MODULE>_user_presave(\Drupal\user\UserInterface $user) {
  if (($user->isActive()) and ($user->getLastAccessedTime() == 0 ) and ( $user->hasRole('role_name'))){
  \Drupal\node\Entity\Node::create([
    'type' => 'my_content_type',
    'title' => $user->getDisplayName(),
    'uid' => $user->id(),
  ])->save();
  }

}


For users who have access to Dashboard, remove their access to "use admin theme"; then they will by default use your theme.


How to create structure "Author -> Book -> Quote"?

Complex business like this is hard "out of the box" with Drupal. Everyones custom logic like you've listed is different -- so community modules regularly dont let you define just deep nesting of logic.

I suspect you'll have to create some custom code to enforce relationships you want (form  validation logic).

Additionally, look at Conditional Fields, Entity Inline Form and perhaps the Prepopulate module.

You can use these modules to build the dependant drop down select lists, and a button to create the Book or Author for a quote as needed -- the prepopulate module could let you pass info from a book or author on creation, to the reference entity.

You may want to look at Display Suite or Renderable Elements to tweak how the node form(s) are layed out.

As I said this isn't a solution but tools to help you build your own business-logic solution.


Search API - Acquia Search - Keyword Search

Set your Minimum keyword length to 2 in the filter criteria of your search-view


How to get custom product line item text field value?

I ended up doing the following :

    function my_Module_form_alter(&$form, &$form_state, $form_id){
           if ($form_id == 'commerce_cart_add_to_cart_form_12'){
                  dpm($form, 'cart form'); //to use with deve module
                  $form['#submit'][]=('my_Module_commerce_add_to_cart_form_12_submit');
                  }
            }

       function my_Module_commerce_add_to_cart_form_12_submit($form, &$form_state){

             $user_text_temp=$form_state['values']['line_item_fields']['field_license_details'][LANGUAGE_NONE][0]['value'];
             dpm($user_text_temp, 'extract value is ');
            // whatever else you want to do with that user_text_temp value
          }

I think that's the easiest way to do what i want. I posted it because it may be of use to people new to drupal.


How do I display image title in "Manage Display"?

Image title is a part of the image field not the main node title. So, you can't see the image title field under manage display.


form button redirecting to .inc module file

You redirect to a URL, you can't redirect to a PHP include file it's not possible.

The function you give as the #submit key is run on form submission, it's not used to build up the next page request or anything like that.

Your code should look more like this:

$form['button']['addnew_form'] = array(
  '#type' => 'submit',
  '#value' => 'new form',
  '#submit' => array('MYMODULE_form_submit'),
);

Then you'll need a submit handler to match that:

function MYMODULE_form_submit($form, &$form_state) {
  // Redirect to the appropriate URL.
  $form_state['redirect'] = 'myform/forms/newform';
}

You can add a second submit handler for your second button, with a different function name, and that redirects to a new menu item that you need to define which contains the second form.


Ctools wizard multistep form: Back button should remember entered data

To get ctools wizard to save values when the user presses the back button, you would have to remove it's '#limit_validation_errors' property that is set by default in ctools_wizard_wrapper(). There is no convenient switch or form_info property to do this so you have to use a form alter hook similar to this:

function test_form_alter(&$form, &$form_state, $form_id) {
  if (isset($form_state['wrapper_callback']) && $form_state['wrapper_callback'] == 'ctools_wizard_wrapper' && $form_state['form_info']['id'] == 'test_wizard') {
    if (isset($form['buttons']['previous'])) {
      unset($form['buttons']['previous']['#limit_validation_errors']);
    }
  }
}


How do I group taxonomy by hierarchy, not node?

I started a new view of taxonomy terms (sometimes the default taxonomy term view is overkill) which created a view of my taxonomy terms. I then created a relationship to Taxonomy term: Content with term and then added a field Content: Title using the relationship just created.

Finally I changed the Settings of view under Format to group by by term and hid the actual term field.

My output ended up like the following, Product One was tagged with Shirts and Ties, product Two just with ties as expected.

Shirts

Title: Product One
Title: Product Two

Ties

Title: Product One


You can do

drush php-eval 'my_module_cron();'

and it should run.


Drush site install without dropping/recreating database

Drush doesn't and likely isn't going to support this workflow based on developer comments in these pull requests:

https://github.com/drush-ops/drush/issues/134

https://github.com/drush-ops/drush/pull/353

Your remaining option is to install using the Drupal installer script.


Your question is too vague. Workbench is a Suite of modules: Moderation, Access, Files, Media ...

Workbench Access can work with Taxonomies or Menu hierarchies.

Currently Workbench only works with data whose base type is a Node it does not work with custom Entities you may use on your site.


How can i display child terms under parent terms and assigned articles using entity field query?

Term relationships aren't kept in a table that the entity API knows about, so you can't use an EFQ to query them.

taxonomy_get_tree() exists for exactly this purpose:

  Create a hierarchical representation of a vocabulary.

e.g.

$vocab = taxonomy_vocabulary_machine_name_load('foo_vocab');
$tree = taxonomy_get_tree($vocab->vid);

You can optionally provide a $parent_id as a 2nd argument, to force the root of the tree to a specific term.


How would I add markup inside of page title input?

Install HTML Title. It will solve your issue.

  Drupal node titles are restrictive and do not support italicized text
  or superscript text (e.g., Book titles, trademark symbols). The HTML
  Title module allows a limited set of HTML markup (em, sub, sup, b, i,
  strong, cite, code, bdi, wbr) to be used in node titles.

Also take a look at Stack Overflow question HTML\rich text in Drupal's node title?.


How can I remove content from the front page?

It sounds like you have your content type to "Publish to front page".  Edit your content and un-check "Promote to front page":


How to restrict access to specific php file to only athenticated users

.htaccess won't help with this; Apache doesn't know what an authenticated Drupal user is, and there's no easy way to grant it that knowledge. Fortunately there's a much better option:
Create a route in a custom module, and execute your code in its controller. You can easily protect the route with permissions, or by role. Aside from the flexibility this gives you around access control, you can also refactor your custom DB code to use Drupal's database API, making your code more future-proof.
The other option, less desirable IMO for your requirements, is to bootstrap Drupal in your custom PHP file, and use the current_user service to determine whether the user has access to your script.


how to set a global variable that is referenced throughout the site?

Ok. With next to no programming I would recommend trying to use the Session Cache API. This module allows for simple items to be stored in say a cookie, even for Anonymous users. You may want to try to use it directly, or use a module that already makes use of it, such as:

Views Global Filter, this module allows you to set an exposed views global filter your visitors fill out once -- and it's remembered for the duration of their visit. As they visit throughout your website your other views pages or blocks would query the existing saved off global filter values in cache and be shown the listings you want.


How can I create a bulk node creation interface?

The Multi Node Add module might provide what you need.


Chose another default theme, disabled & deleted the 'contrast' directory. Clear your cache to make sure, but there should be nothing trying to reference a theme that isn't there.


How can I add all the existing content types into a dropdown list?

In your custom form, in add $options to your content type list field.
the following snippet get list of all the content type names for you;

   $node_types = \Drupal\node\Entity\NodeType::loadMultiple();
    // If you need to display them in a drop down:
    $options = [];
    foreach ($node_types as $node_type) {
      $options[$node_type->id()] = $node_type->label();
    }


How is composer including a dependent module?

I think this is what's happening:

The Drupal packager gets dependencies from domain_group.info.yml, and adds them to the dependencies for the package record that composer will use.
When composer installs the package, it downloads the current version of the module code (which doesn't have the dependency in composer.json)
Composer doesn't use that composer.json for its record keeping - it stores the dependency from the packager in composer.lock, and also in vendor/composer/installed.json
composer why seems to use composer.lock first for its info, falling back to installed.json if unavailable.

So it doesn't really matter what's in the module's composer.json as far as Composer commands are concerned - it's looking at composer.lock or installed.json, which has domain_site_settings as a requirement from the original install.


How to use Views PHP get Taxonomy field value and field collection value?

To load your field collection item and then extract the values needed, you have to load a field collection item entity as following:

entities = entity_load('field_collection_item', array($item_id))

Where your item id is the id of the field collection. This will return an array of entities, with array_shift you can get the first element out of the array. This element will contain all 3 fields.


how to found out if a custom hook_cron has been run?

When Cron runs, it leaves a message in the next table: Reports -> Recent log messages.

If you want to know if a specefic hook has been run, you could try an experiment. For example, you could create a variable called module_variable with value 0 in your  database table and increment this value each time the hook is run.


Error using module_invoke_all('requirements', 'runtime') in my custom module

My guess would be that you have that line of code outside a function in your module. That doesn't work.

I have no idea what you are trying to do but you should at least move it into a hook, like hook_init() so that it's only executed when Drupal is fully bootstrapped.


Add node programmatically including CCK field

First I would recommend using this type of structure for crating nodes progmatically

$node = new stdClass();
$node->type = 'story';
node_object_prepare($node);

If you're worried bout the content type being an issue use a switch statement by passing the content type in:

swicth($field_map['type'][$value['type']]){
  case 'story': //populate fields of story type;
    break;
  case 'page': //populate fields of page type;
    break;
}

Also if you are using a web service to import nodes I would suggest that you use the Feeds module http://drupal.org/project/feeds rather than creating them manually. I'm speaking from experience .


The Drupal Examples modules has an example of adding extra configuration to blocks. However, you will responsible for handling the data and how it's saved to the database which means it can get complicated fast. If it is a field with a value that is used on each of the blocks then the example which uses variable_set() and variable_get() will work. You do not want to much data saved to the variable table.

If the data needs to be more dynamic and you are not building a site with 2,000,000 visitors a day, you can make a node type and use Views to render the values in a block.


Language switcher shows wrong language on front page after detection by browser settings

It could well be that your issue is due to the fact that you do not have any nodes (Drupal without ANY nodes ... go figure ... a CMS without any "real" Content). So to get it to work you may have to make Drupal give "a few nodes" (i.e. 1 for each language ...).

If you agree, and based on what is described in Multi-language website and language switcher in front page, you may want to try if the steps below, or a subset of it, resolve your issue (probably replacing all 'IT' by something like 'GE' for 'German'):

Assign "path prefix only" to the language settings.
Assign the prefix EN for English.
Created an IT front page (e.g. node/1), chose language IT and leave the menu link title empty in the primary links (you probably want to leave the body empty also).
Create the EN front page (e.g. node/2), chose language EN and leave the menu link title empty in the primary links as well. You probably want to leave the body empty also, though for testing purposes you may temporary want to put some visible content in it also.
In both the IT page and the EN page check "promoted to front page" in the publishing options.
Not sure if you need this step also (first try by skipping this step): in Administer > Site building > Menus > Primary links, create a menu item for "Home" and assign its path to "front", parent item "primary links" and language "all languages".
In "Site information",  put "node" as default front page.
Check if your language switcher now works fine: verify if it changes the content from node/1 to node/2 (each of them with their related blocks to be shown) based on selected language. If you also performed step 6, then verify if the primary link "Home" always goes to the corresponding front page (and related blocks).


Instead of Views, I would use Rules + Rules Scheduler (bundled with Rules).  This will allow the site itself to automatically send e-mail reminders at intervals you specify.  Johan Falk explains how to set this up in his Rules Scheduler screencasts.

EDIT: To do this in Views, I would add the Flag module, which also integrates with Rules.  Set up a flag for "Send reminder e-mail" (give permissions only to admin, etc.)  Then, write a rule that sends an e-mail that is triggered on the event "User is flagged..."  Last, add the flag as a relationship in your view and then add a flag link.

You will have to consider what to do about unflagging users.  By default, the user will show up as flagged after a reminder is sent, which might be nice because you'll know that the user has already received a reminder.  However, if you need something more sophisticated, you could make an additional rule that automatically unflags the user after he/she is flagged and keep track of the number of reminders you have sent by using flag's count property (also accessible via rules/views).


How do I add custom contextual links in a block?

I know that this blog post is 100 years old, but it still applies:

http://bleen.net/blog/easier-way-add-contextual-links-drupal-7

The basic idea is to make use of hook_contextual_links_view_alter

For example:

function MYMODULE_contextual_links_view_alter(&$element, &$items) {
  // This hook is called for EVERY set of contextual links
  // on a page.  We first want to check the $element to make
  // sure we are adding a link to the correct list of contextual
  // links. In this case we only want to add a link to blocks
  // created by the "search" module. We just add links using the
  // same array structure as is used by theme_links.
  if (isset($element['#element']['#block']) && $element['#element']['#block']->delta == "site_tweets-site_tweets_block") {
    $element['#links']['social-networks'] = array(
      'title' => 'Edit social network links',
      'href' => url('/admin/config/system/site-information', array('absolute' => TRUE)),
    );
  }
}


There is a module for that https://www.drupal.org/sandbox/pascalt/2128697. It also has Views integration.


Weird activites in my site. Is my site hacked?

If your site is set up to allow people to register for the site, but requires administrator approval before they're activated (pretty common set up for Drupal), then spammers will manage to register accounts, but the accounts created like that will show as blocked users until they're approved.  That may explain why these blocked accounts exist.  If this is the case, then this is normal, and no grounds for concern.

To make sure only admins can create accounts, navigate to Home » Administration » Configuration » People » Account Settings and tick the radio button "Administrators only" for "Who can register accounts?".

As for the other "weird" stuff you've noticed (includes folder deleted, CSS files modified, node edit access given to anonymous users): It gives grounds for concern, but it is impossible to tell whether it is caused by malicious actions from outsiders, or human error by some careless admin.

If node edit access were given to anonymous users, but no node was ever defaced or otherwise maliciously altered because of this, I would lean in the direction of human error.


You should use drupal_get_form as your page callback and pass the id of your form to that. This will ensure the form is processed by Drupal.

For reference, take a look at how the aggregator module declares its form callbacks in aggregator_menu().

Example:

$items['myurl'] = array(
  'title' => 'Page title',
  'page callback' => 'drupal_get_form',
  'page arguments' => array('my_form_id'),
  'access arguments' => array('my_permission'),
);


Links in sidebar to link to search results

Actually it seems like the double escaping did work OK after all. A rewrote the URL to search-page?field_[machine_name][]=[tid] and it worked :)


Drupal way to create a dynamic url as a content type field

You can do this through the UI. Select the "Rewrite Results" checkbox and "Output this field as a link". Then use replacement patterns to fill in the dynamic part of the URL.


This is most probably a namespace issue, I think you have to replace

namespace Drupal\RateField\Plugin\Field\FieldType;

with

namespace Drupal\rate_field\Plugin\Field\FieldType;

or whatever your name's folder is called.

Good luck!


Is there any way to "linux nice" a process to have less priority

Well...

This is rather complicated to solve and probably not suitable for all available configurations. Given you don't reuse processes and the given php process terminates at the end of the request you can use proc_nice().

Next thing will be to be at the right spot to nice the process, does the heavy loading occur before executing? while executing? Also nicing the php process probably won't take any load of the mysql server or whatever other backend this process is requesting.

Looking at view::execute there's no way to distinguish at this point between cached views and uncached ones - so going that route we also have to nice processes which have a cache - probably something to think about.

Drupal 7 Implementation using hook_views_pre_execute().

/**
 * Implements hook_views_pre_execute().
 */
function mymodule_views_pre_execute(&$view)) {
  if($view->name=="machine_name_of_my_view") {
    // http://php.net/manual/en/function.proc-nice.php
    // Setting something higher would lead to idle only processing.
    // Please refer to the documentation of proc_nice and nice.
    proc_nice(9);
  }
}

Drupal 8 implementation using hook_views_pre_execute():

/**
 * Implements hook_views_pre_execute().
 */
function views_pre_execute(ViewExecutable $view) {
  if ($view->id() == 'machine_name_of_my_view') {
    // http://php.net/manual/en/function.proc-nice.php
    // Setting something higher would lead to idle only processing.
    // Please refer to the documentation of proc_nice and nice.
    proc_nice(9);
  }
}

Keep in mind that this solution requires quiet some constraints to work for you:

Heay load is actually in the php layer
proc_nice() is available (not all environments allow this)
dedicated php processes which terminates at the end


You can use Field group Contributed module...

Project page says..

  Fieldgroup will, as the name implies, group fields together. All
  fieldable entities will have the possibility to add groups to wrap
  their fields together. Fieldgroup comes with default HTML wrappers
  like vertical tabs, horizontal tabs, accordions, fieldsets or div
  wrappers.


Login destination to file download - prompt user

Well, there are a few ways you could handle this. All of them are going to involve some code to handle these type of requests. One way I can think of would be to catch these requests on your custom 404 page and redirect the user to the login page with a new destination and keep the file name as a parameter. Then, on the new destination page grab the file download parameter and provide them a big fat button that links to that file.

If they are already logged in and you want to do the same thing you would need some sort of pre-processing filter to capture these and do the same as above.


Change position of Drupal ajax progress throbber

You can do it by overriding the CSS in your theme CSS file. Here is the class to use for changing the position of ajax throbber:

  .ajax-progress .throbber

You can set the position to whatever you want.

Also have a look at this blog: http://www.antimath.info/css/change-throbber-in-drupal-7/


Output data of different content types in same page

These types of problems are usually solved using Views.

You can create a single Page Display in Views listing the two Content Type nodes. Set the Page Path to what your link to that page to be. Add Sort Criteria by Content type so all the book nodes appear before the movie nodes (add more Sort criteria if necessary after that one). Make sure you set the Fields to be Hidden if Empty, since the two CTs you want to list don't share any Fields. Set that under each Field settings, and under Format settings.

Another, probably more common way to build the lists is to create two different Views Displays, one for each Content Type. For example you can create a Page Display to list only the book nodes with the two related Fields, then add Attachment Display in the same View and override it to show only movie nodes. Also override the Fields to show the two Fields you have on movie CT, instead of the two Fields from the book CT. Set the Attachment to show on the Page Display.


Help solve this error: Class CommerceLicenseEntityController does not exist

The error I got was a bit different, so this may not work for you. My error was

Exception 'ReflectionException' with message 'Class CommerceLicenseFile does
not exist' in [filepath]/entity_bundle_plugin.module:46

I disabled the Commerce License module and renabled it. I can now clear cache without error. Hope that works for you if you have not solved the problem.


Custom module template override not loaded

I think you are missing the argument for the hook_theme so you can do it this way

/**
* Implements hook_theme().
*/
function lnr_theme($existing, $type, $theme, $path) {
 $items = array();
 $path = $path . '/templates';

 $items['actualite_filter_article'] = array(
  'path' => $path,
  'template' => 'actualite-filter-article',
 );

  return $items;
}

Give it a shot


Skip a step on a multipage form based on field input

You can give a try on this module Conditional Fields.

  Conditional Fields allows you to manage sets of dependencies between
  fields. When a field is “dependent”, it will only be available for
  editing and displayed if the state of the “dependee” field matches the
  right condition. When editing a node (or any other entity type that
  supports fields, like users and categories), the dependent fields are
  dynamically modified with the States API. A simple use case would be
  defining a custom “Article teaser" field that is shown only if a "Has
  teaser" checkbox is checked, but much more complex options are
  available.


How much of Drupal 8 will rely on or be compatible with Symfony?

Symfony, as in full stack Symfony, we aren't to be compatible with.

We are using Symfony components so many concepts used there will be useful.


You could try creating a block in a custom module using hook_block_info and hook_block_view. Then use views_embed_view to load the view and display it in your block.

This may look a little like this:

function my_module_block_info() {
  $blocks['glossary_attachment'] = array(
    'info' => t('Glossary Attachment'),
    'cache' => DRUPAL_NO_CACHE,
  );
  return $blocks;
}

function my_module_block_view($delta = '') {
  $block = array();
  if ($delta == 'glossary_attachment') {
    $block['subject'] = t('Glossary Attachment');
    // Load the view.
    $view = views_embed_view('glossary', 'attachment');
    if ($view) {
      $block['content'] = $view;
    }
    else {
      $block['content'] = t('The view is empty');
    }
  }
  return $block;
}


Change site logo for different languages

The Internationalization module, after installing and enabling the modules, you can activate it at admin/config/regional/i18n/variable, look for 'theme settings'


Stop Drupal Commerce automatically adding hyphens before product variations radio button labels

These hyphens are not being added by Drupal Commerce itself, so you'll need to look into what other modules on the site might be interacting with the form.


You have to use image styles to get all the images the same size.

Goto Admin -> Configuration -> Media -> Image styles

Create new image style & enter style name with a scale and crop with exact dimensions for your slideshow.

Then go back to your views slideshow setting and select your style name as image style.


Get all the nodes with matching taxonomy terms in a view Display

If my understanding is correct, you have a view of content each with references to the taxonomy vocabulary Interests. If this is the case, then you can easily add a filter to your view with the selected terms in that taxonomy.

To allow users to select which term elements render on the page, make it an exposed filter (perhaps select or multiselect).


Drush without SSH access on remote server

Things are pretty rough without shell access.  You'd have to do a lot of work to make this function correctly.  First, take a look at the implementation of the drush rsync command.  You're going to need to build something similar that uses sftp, or whatever your host allows access to, to transfer files.

Next, you're going to want to take a look at the file examples/sync_via_http.drush.inc.  This shows how you can use the Drush sql-sync command, but use an http GET to fetch your database.  Dumping the database and putting it in a location that it can be served up by the web server (securely!) is left as an exercise for the reader.  You also have to make sure that your Drush alias records define the 'database' record for your remote site; if you don't, Drush will try to fetch it via a remote ssh call to Drush on the remote system.

Once you have this, you can use your sftp command to push your code to your hosting site, and drush sql-sync to pull your database to your dev site.  You'll have to run updatedb manually through the admin interface whenever you push new code.

However, you will find that whatever you think it's going to cost you to switch sites, you'll probably find that the cost is worth it in terms of your time savings.


Duplicated content shown in a view using a relationship

Yes. Check if one of your fields have multiple values, like Taxonomy Terms, or Images. Then, you have to group those values with the according option to prevent this.


Your example permissions (as listed near the befinning of your question) are fine.  The Drupal docs page you link to is correct and reflects IMHO the consensus of the communty.  The script you're using reflects this consensus.

I'd say that this is a false postive from Security Review. It also appears that this bug has been reported to the module's issue queue.

As stated on the Drupal docs page: All you need to know to review this yourself is that it is only files/ and the directories and files below it that shall be writeable by the server.  So if the character wshow up in anything owned by www-data or the www-data group on your site (letter 3 in the permission string is the setting for the www-data user, and letter 6 is the the setting for the www-data group) - then the site is not secure.

While it may appear insecure that files/, its subdirectories and uploaded files are writeable by the server, this is not the case. Drupal itself and the way Drupal sets up the web server (by means of .htaccess, etc. ) prevents code (shell scripts, php, etc.) that an attacker may upload (disguising it as an JPEG or other "allowed" upload file types) from being excuted.  Drupal has built-in management of uploaded files that ensures, for instance, that file attachements is deleted when the node they're attached to is deleted.  For this to work, the upload directory (e.g. files/) and the files it contain must be writeable by the server.

Also: greg should not be a member of the www-data group.


How to have SimpleSaml create a new account only when the user doesn't have a Drupal account already?

We have this setup running, and it does not register a new user each time but only the first time a user logs in, as expected. I just remember running into problems when unique identifier and user name where set to different values (my old bug report is possibly related).
To further manage the displayed user names you could use Drupal modules like RealName.

configuring SimpleSAMLphp_auth to register new users

In the admin interface, navigate to admin/config/people/simplesamlphp_auth

Under the tabs

USER PROVISIONING
check - Register users (i.e., auto-provisioning)

and

USER INFO AND SYNCING
Which attribute from simpleSAMLphp should be used as user's name *
eduPersonPrincipalName

(enter an attribute that uniquely and consistently identifies the user in your realm and that your SAML IdP provides, some attributes change with each invocation and are therefore not suitable, eduPersonPrincipalName is suitable for most educational entities, email could also work fine here)

Which attribute from simpleSAMLphp should be used as unique identifier for
the user *
eduPersonPrincipalName

(enter an attribute that uniquely and consistently identifies the user, make sure to use the same attribute as in user's name before)

From the documentation:

  Determines wether or not the module should automatically
  create/register new Drupal accounts for users that authenticate using
  SimpleSAMLphp. Unless you've done some custom work to provision Drupal
  accounts with the necessary authmap entries you will want this
  checked.

Checking which SAML attributes are available

Navigate to the admin interface of your simplesamlphp install (you might need to activate the interface and look up the password of the install from config.php).
 navigate to the Tab Authentication and "Test configured authentication sources" (/module.php/core/authenticate.php), log in to the same authentication source that is configured in the drupal plug-in under "Autenticaton source for this SP (default: default-sp)" and an overview of all SAML attibutes for that user will be displayed.

The attributes that can be used are possibly best obtained from the documentation of the identity provider, example: https://www.feide.no/attributelist


How to make the node author's email show up as a replacement token in a Rules Action?

It is not listed among the replacement tokens, but you can use the [node:author:mail] token.


User Relationships view showing each relationship more than once

You can exclude current user from view by passing argument of current logged in user id and check exclude this argument from view.

You can avoid duplicates by enable distinct in basic settings.


How to override ViewsExposedFilterBlock with my own class?

Thanks to @4k4 (here) and @nikathone and @dorf (via Slack), I was able to arrive at this, placed in exposed_filter_images.module (all caps should be replaced with a machine name):

function exposed_filter_images_block_alter(&$plugins) {
  if (isset($plugins['views_exposed_filter_block:VIEW_NAME-DISPLAY_NAME'])) {
    $plugins['views_exposed_filter_block:VIEW_NAME-DISPLAY_NAME']['class'] = \Drupal\exposed_filter_images\Plugin\Block\ExposedFilterImagesBlock::class;
  }
}


Get total row count in views-view-fields.html.twig

You can use simple code {{ view.total_rows }} in every file template views. Variable view is global.


You can simply theme every form how you want. I don't like the method by @rpayanm, cuz it hard to maintane and hard readable, with big forms this is not the case, just single wrapper and simple structure.

Every form trying to use theme equals their machine name. You can find this template name in $form['#theme'] just by alter, it is always (or in most times) same as form id machine name. What you need to do is register template for it. You need to implement hook_theme(). You can write it in CUSTOMMODULE.module or in THEMENAME.theme. Theme key must be the same as in $form['#theme'], so its automatically use it, otherwise you need to add new one via form alter.

/**
 * Implements hook_theme().
 */
function MODULENAME_theme($existing, $type, $theme, $path) {
  return [
    'FORM_ID_THEME' => [
      'template' => 'custom-form-template-name',
      'render element' => 'form',
    ]
  ];
}

Drupal pass $form variable with form.

Then you must create custom-form-template-name.html.twig (with your template name from hook_theme()).

The minimal template is

{{ form }}

You also can print every field from form where you want

{{ form.field_name }}

Here you can do whatever you want with markup.

You also can pass additional data to template by implementing template_preprocess_TEMPALTENAME

function template_preprocess_FORM_ID_THEME(&$variables) {
  $variables['example'] = 'This is added via preprocess';
}

And then use in template

{{ example }}

  {{ form.first_field }}

  {{ form.second_field }}

  {{ form.submit }}
  {{ form.preview }}

{#
Don't forget to add printing form special info at the end.
Without this data form will not working propertly.
#}
{{ form.form_build_id }}
{{ form.form_token }}
{{ form.form_id }}

I think this method is more fliexible, clean and powerful.

P.s. sorry for my english, hopes someone edit and fix my mistakes :)

Example of complex form using this method.


I believe the RoleAssign module can help you with that:

RoleAssign specifically allows site administrators to further delegate the task of managing user's roles while withholding the Administer permissions permission.
RoleAssign introduces a new permission called Assign roles. Users with this permission are able to assign selected roles to still other users. Only users with the Administer permissions permission may select which roles are available for assignment through this module.


Why does my site fail after restoring the database?

I found the reason of mistake. I accidentally put Entity module into the core and it generated WSOD when I tried to restore the database on my localhost. You should never put contributed modules into core modules folder.


Basic Multiple Image Upload to replace standard image uploader

The best multiple image uploader that I have found is http://drupal.org/project/plupload (example widget is on their website)

Also if you are working with images and are using drupal 7, you may also wish to check out http://drupal.org/project/media - this modules is looking more and more promising, and now has views integration as well. It also works with the above recommended plupload module)


is it possible to declare an user group for the remote user in aliases.drushrc.php

No; in unix, the group ownership is attached to the user.  Use usermod -a -G to add the desired group permanently to your remote user.  See man usermod for more information.


Twig finds if statement true whether or not field has value

Look at the object itself not the render array:

{% if paragraph.field_sub_title %}
  <h3>{{ content.field_sub_title }}</h3>
{% endif %}


Host two ready websites with different URL using same code base

It looks like you are looking for Multisite approach. It's pretty easy to set up and to keep sites separate, but if one day you'll need to share anything between sites, you'll regret not using Domain Access.

If you are sure there will be no need to share data, in <drupal root>/sites create 2 subdirectories, like example.org and example.com, and put site-specific files (modules, themes, libraries and settings.php) into them. Point both domains to your Drupal (your provider should be able to help with that) and Drupal will take care to recognize what site is accessed.

It might be worth to consider Domain Access module.

  The Domain Access project is a suite of modules that provide tools for running a group of affiliated sites from one Drupal installation and a single shared database.


Update values using AJAX in field widget form

I generally do something like this:

function gft_enable_display_callback($form, $form_state) {
  // Get the array parents of the triggering element
  $parents = $form_state['triggering_element']['#array_parents'];
  // Pop off the triggering element as we usualy want the one above it
  array_pop($parents);
  // Get the element from the nested array
  $element = drupal_array_get_nested_value($form, $parents);

  return $element; // or we can return $element['someotherfield']
}

We can also use the drupal_array_get_nested_value to retrieve values from form_state['values'] as needed.


How to display single fields in multiple line in VIEWS?


Changing an inner join to a left join in views 3.3?

I found clicking on the reduce duplicates checkbox converted my INNER JOINs to LEFT JOINs:

Before I was getting something akin to the following injected into my query:

INNER JOIN {field_data_field_random_field field_data_field_random_field}
        ON node.nid = field_data_field_random_field.entity_id
       AND (field_data_field_random_field.entity_type = 'node'
       AND field_data_field_random_field.deleted = '0')

These inner joins were being caused by simple taxonomy filters, so sadly I didn't have any relationships to unrequire. Checking this box however doesn't seem to have altered my query in any other way, save for removing the inner joins, which is perfect for me; and may help someone else out there in this vast monkey adventure called life.


How can i redirect the path from the product save button?

Easy to do with Rules, no coding required.

You can import this rule export, but will need to adjust the role ID and redirect path to match

Redirect on product save using Rules

{ "rules_redirect_on_product_save" : {
    "LABEL" : "Redirect on product save",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules", "entity" ],
    "ON" : [ "commerce_product_update" ],
    "IF" : [
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "3" : "3" } }
        }
      }
    ],
    "DO" : [ { "redirect" : { "url" : "somepath" } } ]
  }
}


How to get file from managed_filed in drupal 8 generate image style and use as background image for a div

Untested, but you should be able to do this:

$style = Drupal\image\Entity\ImageStyle::load(IMAGESTYLENAME);

$url = $style->buildUrl(theme_get_setting('tv_adbackground'));

$element['background'] = [
  '#prefix' => '
',
  '#suffix' => '
',
  // Force rendering of this element
  '#markup' => '',
];

You'll need to change IMAGESTYLENAME to the actual image style you want to apply.


Logically a truncate and a delete statement are very similar. They work a little different which allows truncate to be faster in many cases. For the specific code in question, it might be a little slower but it should perform the same purpose and the code should work fine.

However, if your site lacks the ability to TRUNCATE then it also lacks the ability to DROP tables. It's possible to run Drupal on sites like that for very specific purposes, but there are several Drupal features that will not work without the ability to DROP tables.


Redirect to checkout after pressing the "Add to Cart" button

you could do something like this:

use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;

function MYMODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if (strpos($form_id, 'commerce_order_item_add_to_cart_form_commerce_product') !== false) {
    $form['actions']['submit']['#submit'][] = 'MYMODULE_cart_alter_sub';
 }
}
function MYMODULE_cart_alter_sub(&$form, FormStateInterface $form_state) {
  $responce =  new RedirectResponse('/cart');
  $responce->send();
}


D7 - Ckeditor buttons get messed up when moving a site from one server to other

Have you checked Css settings on Ckeditor profile page?


Get the node ID from the "node/add" menu item and hook_form_alter()

You're right, the nid is not available at this point, it's assigned only after the the node is saved.

The easiest solution is most probably to use hook_node_insert and resave the node after having added the value to the field you have created.


You could modify the field.tpl like monymirza suggested. But you may want to use hook_preprocess_field(&$vars) and target the title element within the $vars array.

Use that function in your theme and you may view the content/structure of the $vars array with dsm($vars) from the devel module.


Add meta tags when block exist on page and its cached

Instead of adding php code in the block you could add the code in a preprocess function for the block.

/**
 * Implements template_preprocess_block().
 */
function MYTHEME_preprocess_block(&$variables) {
  if ($variables['block']->bid == 'MYBLOCKID') {
    $og_title = array(
      '#tag' => 'meta',
      '#attributes' => array(
        'property' => 'og:title',
        'content' => "My example title",
      ),
    );
    drupal_add_html_head($og_title, 'MYMODULE_og_title');
  }
}


On a content page that references a taxonomy term, how can I display only content that references that taxonomy term's immediate children?

I think you may be confused about how Views works.  To give a custom display to taxonomy terms, you don't need to create a content type to reference a taxonomy and then use Views to override how the content type is displayed; you can simply create pages with a view that display the taxonomy directly.

This means you may not need the Taxon Page content type; depending on what you intend to do, you could add any fields you need for your fish pages to the Living Things taxonomy and then display this taxonomy as pages by using a view that overrides how the taxonomy is displayed.

For an example, see the taxonomy_term view included in core:

/admin/structure/views/view/taxonomy_term

Another way to do this is to use Panels, which (with Page Manager) allows you to override the display for all taxonomy terms and attach a custom view (and whatever else you want) to those terms.

Yet another option is Display Suite.


How to prevent adding of duplicate item to Drupal Queue?

You cannot find the previously entered values in the queue, since the DrupalQueueInterface interface doesn't expose a method to retrieve a previously added value. You cannot even rely on the fact the value is added in a database table, since that is an implementation detail that can change with the class actually implementing the queue, which can be easily changed from a module.

That is the reason why modules like the Aggregator module take their data from their own database table, where they record the last time they added those values in the queue. (See the comment that says Add timestamp to avoid queueing item more than once.)

  $result = db_query('SELECT * FROM {aggregator_feed} WHERE queued = 0 AND checked + refresh < :time AND refresh <> :never', array(
    ':time' => REQUEST_TIME,
    ':never' => AGGREGATOR_CLEAR_NEVER
  ));
  $queue = DrupalQueue::get('aggregator_feeds');
  foreach ($result as $feed) {
    if ($queue->createItem($feed)) {
      // Add timestamp to avoid queueing item more than once.
      db_update('aggregator_feed')
        ->fields(array('queued' => REQUEST_TIME))
        ->condition('fid', $feed->fid)
        ->execute();
    }
  }

  // Remove queued timestamp after 6 hours assuming the update has failed.
  db_update('aggregator_feed')
    ->fields(array('queued' => 0))
    ->condition('queued', REQUEST_TIME - (3600 * 6), '<')
    ->execute();

You could implement a queue class that checks the value has been already inserted, and use that as default queue class, but a module cannot rely on such implementation details.


Assuming D8

If this is part of a "BaseFieldDefinition" of your own entity, you may set a lot of options like so:

// create photo
$fields['photo'] = BaseFieldDefinition::create('image')
    ->setLabel("Photo")
    ->setDescription('Ein Photo')
    ->setSettings(array(
        "file_directory" => 'profilbilder/[date:custom:Y]-[date:custom:m]',
        "file_extensions" => 'png gif jpg jpeg',
        "max_filesize" => '600 KB',
        "max_resolution" => '600x800',
        "min_resolution" => '30x40',
        "alt_field" => false,
        "alt_field_required" => false,
        "title_field" => false,
        "title_field_required" => false,
    ))
    ->setDisplayOptions('form', array(
        'type' => 'image_image',
        'weight' => 5,
    ))
    ->setDisplayOptions('view', array(
        'type' => 'image',
        'weight' => 1,
        'label' => 'hidden',
        'settings' => array(
            'image_style' => 'thumbnail',
        ),
    ));

As you see, you can use tags in the file_directory setting.
If you craft your fields using the Drupal 8 field UI, you can also use tags in the UI field.

If it's D7, you should change to D8 :-)


Firstly I would suggest having a hard think about whether you actually need a menu that deep and why.
Then try to think of an alternative way to structure your data to achieve what you need to do.

The reason is that this is not an easy thing to change (and 15 levels of menu suggests possible information architecture issues).

There is a drupal.org issue https://drupal.org/node/274270 relating to this that has some examples on how you can make the change.
The example is for drupal 6 but pretty much the same thing applies to drupal 7.

The problem is that each level has it's own column in the menu links table, so you have to alter the menu links database table to add new columns and then make some changes to drupal core to use these new fields.

As a side note, there is a module called menu depth limit that allows you to set a lower limit but not a higher one.


How to prevent closing CTools modal window with ESC during AJAX?

Try this one

/**
 * Override Ctools modal content function to prevent closing the modal with
 * the escape key.
 */
Drupal.CTools = Drupal.CTools || {};
Drupal.CTools.Modal = Drupal.CTools.Modal || {};
var modalContent = Drupal.CTools.Modal.modalContent;
Drupal.CTools.Modal.modalContent = function(content, css, animation, speed, modalClass) {
  modalContent(content, css, animation, speed, modalClass);
  $(document).unbind('keydown', modalEventEscapeCloseHandler);
}


Uncaught exception thrown after moving my website to localhost

I solved the problem this way: set max_allowed_packet = 4M to the file php.ini


I wrote a module to do this, you can probably modify it to suit your needs. http://drupal.org/sandbox/jrowny/1281972 I was using this for 'casetracker' type functionality.

Basically you install this and check for each field "this field is editable by comments."


You can add a button to the node form, with a submit function for that button, using hook_form_alter()

function hook_form_alter(&$form, &$form_state, $form_id)
{
  $content_type = 'page'; // change as necessary
  if($form_id == $content_type . '_node_form')
  {
    $form['actions']['my_button'] = array
    (
      '#type' => 'submit',
      '#value' => t('Do something'),
      '#submit' => array('my_submit_function'),
    );
  }
}

function my_submit_function($form, &$form_state)
{
  // Do stuff here
}


How to set a default controller if no other routes match

Go to /admin/config/system/site-information and set Default 404 (not found) page to the path of your custom controller.

In the controller place a typecasted $request in the argument list. Then get the path from the request and either build a custom 404 response or redirect to another page:

use Symfony\Component\HttpFoundation\Request;

  public function myController(Request $request) {
    $path = $request->getPathInfo();
    if ($path === '/abc') {
      return ['#markup' => 'Path "abc" does not exist!'];
    }
    else {
      return $this->redirect('<front>');
    }
  }

To answer the deleted comment. The controller can't set a status code 200, because it responds to a sub request and the master request is set to 404 no matter which 2xx status you set in the controller. For this you need an event subscriber: Does not redirect in EventSubscriber.


Taxonomy term fields are entity reference fields. They only store the reference to the entity, which usually a number that is the ID for that entity. In case of Taxonomy the reference fields store the TID (taxonomy term ID) which is the number you can see in the path when you edit the term in the admin area.

When you sort your table using the reference field, it will follow the number sort of the term IDs.

But you want to sort alphabetically using term names.

Term names aren't stored in node tables in the database, taxonomy module has its own tables. You have to pull the term data into your node views in order to use it as a sorting criteria.

To pull related data into views use Relationships.

In your case you have to add the Relationship for the Manufacturer taxonomy term field. After you add that Relationship you will be able to add a new field to your views called Taxonomy term: Name. You will be able to sort your table using that field, and the results will be sorted alphabetically!

Remove your original Manufacturer field if you don't need it for anything else, the Term name field should be able to work as a full replacement while also providing the alphabetic sort criteria.


Will the PHP filter prevent SQL injection attacks?

It will not, in any way shape or form protect you from injection. Quite the contrary, using the PHP filter is generally a horrible security problem, because it enables arbitrary code to be executed.

Do not use the PHP module, at all.

Greggles mentions the Paranoia module in his answer, which is awesome, consider using it. However, if you have enough control over your server, you could take it one step further, by disabling the eval function all together.

In your php.ini: disable_functions = eval


Set up varnish, but is the content really from cache?

Your content is not from cache.

See the X-Varnish header;

X-Varnish: 658699528

If the content was served by Varnish, you'd have two numbers there. Not just one.

Have you looked at using the Varnish module? I'm not sure what version of Drupal you're using though.


How to load a taxonomy term with case-sensitive?

To retrieve result with sensitive case, you can use binary in where clause:
Like this sql query.

SELECT name FROM taxonomy_term_field_data WHERE binary name='test'

For Drupal you can use \Drupal::database()->select with where conditions take a look here .

Try this:

 $result = \Drupal::database()->select('taxonomy_term_field_data', 't')
    ->where(
      'binary name = :term_name',
      ['term_name' => 'test']
    )
    ->fields('t', ['name'])
    ->execute()
    ->fetchAll();


How to have different style files in multilingual website using Drupal?

you can do this in template.php:
you have to copt css file in themefolder/css.

    function yourtheme_preprocess_page(&$vars) {
        global $language ;
        $lang_name = $language->language ;
        if ($lang_name=='en')
        drupal_add_css(path_to_theme(). '/css/en-style.css');
        elseif ($lang_name=='sp')
        drupal_add_css(path_to_theme(). '/css/style-sp.css');
        $vars['styles'] = drupal_get_css(); //  use drupal_get_css() to add new css
}

so you have one of css files related to current page language.


How to add my html code so as to design the page generated by a view using drupal 7?

In your view on the right-hand side there is an 'advanced' link.

When you click this it will display a number of advanced options.

The option you want is 'Theme : information".

Click on information and you will presented with a number of template suggestions to help you theme your view.

To determine what template to use you basically need to think what level you want to theme at.

Example:
If you click the link 'Display output' and copy/paste the code into one of the suggested file names i.e. views-view--[YOUR_VIEW].tpl.php, this is the top level you can theme at.

If you wanted to theme a particular field you will find that further down in the suggestions.


I am not sure this can help you, but I don't think $node->field-address or $node->field-longitude-temp are valid syntax by $node object, you should use $node->field_address['und'][0]['value'] or with entity_metadata_wrapper function, eg:

$nodeWrapper = entity_metadata_wrapper('node', $node);
$nodeWrapper->field_address->value()


When you select a Views "Page" type display, it must have a URL. And that URL is where this page will be accessed from.

There's a separate views display that's dedicated to be inside Panels, and that one is called "Content Pane" display inside views. This display doesn't take URL, but also has a lot more options for panels configuration such as argument input from panel, settings overrides such as pager, fields, items per page, base URL etc (need to explicitly allow each from the Views display "Pane settings").

So to answer the question, either use Content Pane display, or you can also use a Block display (as suggested by @JayendraKainthola) which is less flexible inside panels.

Once you've created the display Content Pane, it will be available in the "View panes" category when you're adding it to the panel.


How to get the node id before saving the node in drupal 6?

You can use hook_nodeapi presave option to get node content before saving the node.

Example :

function MODULENAME_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'presave':
      print $node->nid;
      exit;
    break;
  }
}


Upgrading to core 8.8 results in a path alias error

Pathauto 8.x-1.6  is the only version working with both Drupal 8.7 and 8.8. So first update Pathauto to this version, then update core and then update Pathauto to the current version. Run drush updb in each step. See the change record http://drupal.org/node/3089457.


How can I remove the hardcoded menus from the Navin subtheme?

<?php
  $main_links = menu_tree_page_data(variable_get('menu_main_links_source', 'main-menu'));
  $main_links = menu_tree_output($main_links);
  $secondary_links = menu_tree_page_data(variable_get('menu_secondary_links_source', 'user-menu'));
  $secondary_links = menu_tree_output($secondary_links);
?>

Get rid of that bit for starters.

If you're not using that, then you can probably also strip out the following:

<?php if ($main_links): ?>
    <nav class="navigation">
      <?php print render($main_links); ?>
    </nav>
    <?php endif; ?>
    <?php if ($secondary_links): ?>
    <nav class="navigation-secondary">
      <?php print render($secondary_links); ?>
    </nav>
    <?php endif; ?>

Which (for reference) should just leave you with the following:

<div<?php print $attributes; ?>>
  <div<?php print $content_attributes; ?>>
    <?php print $content; ?>
  </div>
</div>


Update user fields programatically resets password

If you look user_save there special code at the top, that prevent updating password if pass not provided on $updateUserParams. So please check your other modules or Rules, that possibly resetting password each time, then user_save called.


How to implement view with nodes grouped per taxonomy term

You must use the group option in the style display. In group option you must select the field taxonomy term. And then you must Exclude from display the field taxonomy term.


Ok can you go to drupal8/admin/modules

and see :

Your:

walker.info.yml is correct
your Walker.module id fine (however i would use (walker as the dir and walker.module aka non caps)
your block looks fine

Thinking Rename all to
./modules/walker/walker.module
./modules/walker/src/Plugin/Block/WalkerBlock.php
./modules/walker/walker.info.yml

as could be Name space issue as "Drupal\walker\Plugin\Block" vs "Drupal\Walker\Plugin\Block" ?

but really every thing looks fine
When you install the module you should be able to place the block in
admin/structure/block


Using SimpleTest to test an image upload

There is a base image field test class in image.module, which has a uploadNodeImage() method. You can either re-use that by extending from that class or steal the code there.

See testStyleReplacment() for an example of how it is used.

Edit: The "Upload" is optional and only necessary if you want to upload multiple files. You can always just save the node directly and any selected files will be uploaded and processed.


How customize update interval of aggregator module

The update interval values for an Aggregator Feed is hardcoded into the Entity definition for the refresh field. You'll need to alter the definition to allow different values.

In a custom module, you can evoke hook_entity_base_field_info_alter() to alter the Feed definition to accept shorter intervals:

function MYMODULE_entity_base_field_info_alter(&$fields, $entity_type) {
  if ($entity_type->get('id') == 'aggregator_feed') {
    $definition = $fields['refresh']->getItemDefinition();
    $intervals = $definition->getSetting('allowed_values');
    $intervals = array(
      120 => '2 min',
      300 => '5 min',
      600 => '10 min',
    ) + $intervals;
    $intervals = $definition->setSetting('allowed_values', $intervals);
    $fields['refresh']->setItemDefinition($definition);
  }
}


How to setup multisite to multisite rsync with drush?

On Drupal 6, your sites folders must be the same.  Since you are using Drupal 7, they can be different, but it is more convenient if they are the same.
You do not need to copy all of your multisites to your dev server.  The drush rsync option you are looking for is --exclude-other-sites.  This will cause rsync to skip everything in the sites folder except for sites/all, and the site you are syncing from.
sites/all is where sites/all/modules and sites/all/themes go, so you typically need these.  With some effort it might be possible to move your contrib modules elsewhere (if everything was in a profile, or if you hand-modified your registry), but this would be an unusual setup.  sites/default is not needed.