How to alter combined filter value programatically?

The example on the hook_views_query_alter page should get you started. Whet they do here is changing the node title into the node id, by redefining the $condition variable.

function hook_views_query_alter(&$view, &$query) {
  // (Example assuming a view with an exposed filter on node title.)
  // If the input for the title filter is a positive integer, filter against
  // node ID instead of node title.
  if ($view->name == 'my_view' && is_numeric($view->exposed_raw_input['title']) && $view->exposed_raw_input['title'] > 0) {
    // Traverse through the 'where' part of the query.
    foreach ($query->where as &$condition_group) {]

// Run through all conditions and pass them by reference.
// (Altering the value here will change it for all things later on.)

      foreach ($condition_group['conditions'] as &$condition) {
        // If this is the part of the query filtering on title, chang the
        // condition to filter on node ID.

//If there is a condition on the title field

        if ($condition['field'] == 'node.title') {

// Overwrite the condition

          $condition = array(
            'field' => 'node.nid',
            'value' => $view->exposed_raw_input['title'],
            'operator' => '=',
          );
        }
      }
    }
  }
}

You should be able to copy quite a lot of this function, tweak the initial if statement a bit so it does not filter on title, and substitute your own values.

I have not used a combined filter, but the Views API converts into similar to this. If you add some debug code to find out what the initial array is, you should be able to substitute that.


Only allow 1 discount using commerce_discount

Your version of Commerce Discount is too outdated to support discount compatibility. However, it's so old, that the upgrade process may be complicated. Drupal Commerce itself is also currently at version 1.15, so that will need to be updated, too.

I'd recommend creating a copy of your website and bringing those modules up to date, maybe even one version at a time, running update.php in between each upgrade. (Theoretically, it should work fine to run update.php all at once, but Commerce Discount has to do a lot of field manipulation in its update functions, and I just worry about the potential for things to break...)

Once you do that, you'll have discount compatibility settings that will allow you to enforce a discount being incompatible with any other discount, and by adjusting the sort order on the discounts you can identify which discounts should apply first to ensure the restricted one applies first when possible.


How to add the Terms and Conditions to custom form,not using any profile 2 or webform module?

You can just add another element to the form like so:

$form['terms'] = array(
  '#type' => 'checkbox',
  '#title' => t('Terms & Conditions'),
  '#prefix' => "
Your terms go here
",
  '#required' => TRUE,
);

That will just stick the text before the checkbox, and then use CSS to position it however you want.

You might also want to put a validate hook in there and remove the #required attribute so you can write your own text in the form_set_error.


On AJAX-Enabled Views the "Add to Cart" button does not work properly

Yes, it is. This module will be usefull for you:Commerce Ajax Cart


Is there a Drupal API function to get the list of nodes by type?

Depending on the version of Drupal :

drupal 6:

$nodes = db_query('SELECT nid FROM {node} WHERE type="%s"', $type);

drupal 7:

$nodes = node_load_multiple(array(), array('type' => $type));

drupal 8:

$nids = \Drupal::entityQuery('node')
  ->condition('type', 'NODETYPE')
  ->execute();
$nodes = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->loadMultiple($nids);


According to Drupal 7.50 released, Emojis were added as a new feature in 7.50

  Support for full UTF-8 (emojis, Asian symbols, mathematical symbols)
  is now possible on MySQL

  If content creators on your site have been clamoring to use emojis,
  it's now possible on Drupal sites running MySQL (it was previously
  possible on PostgreSQL and SQLite). Turning this capability on
  requires the database to meet certain requirements, plus editing the
  site's settings.php file and potentially other steps, as described in
  the change record.


Sometimes the v= parameter is added to the product URL

This is because you've got more than 1 variation on a product. The v  parameter allows you (and drupal commerce) to directly link to the product page with the correct variant set as the selected one

For example you have "t shirts" product with variations for colour. You might want to link directly from the product listing page/cart/anywhere else to a specific colour tie.


Conflict between package requirements when updating to Drupal 8.4

So, I've found a solution. I had to go into my composer.json file and specific these versions under require:

"drupal/core": "~8.4",
"drush/drush": "~9.0",

Once I updated those lines, I deleted the composer.lock file as well as the vendor directory. After that, I was able to install Drupal 8.4 using composer update --with-dependencies.


How to print parent taxonomy term name in a block?

I had to create a new question to get the answer (PHP is not my strong point).

$parent is actually an array, so it's output is a little different.  There's likely many ways of doing it, but

echo reset($parent)->name;

worked for me.


Handle permission based on both person and role?

I suggest first to use the Rules module to fire an action on your workflow transition : from 'in moderation' to 'in-review'

Second try to use the Node access user reference module or the Nodeaccess module to use an API method inside your a custom PHP code or as a rule's action to grant the referenced user


How to display content for a Taxonomy Vocabulary?

You need to look at creating views you can start by watching
as many as the following to get the idea:

https://www.google.com/search?q=drupal+8+how+to+create+a+view&source=lnms&tbm=vid


You can try the Computed Field module.

  Computed Field is a very powerful CCK field module that lets you add a custom "computed fields" to your content types. These computed fields are populated with values that you define via PHP code. You may draw on anything available to Drupal, including other fields, the current user, database tables, you name it. […] You can also choose whether to store your computed field values in the database with other content fields, or have them "calculated" on the fly during node views.


How to apply a Views filter to show fields if a radio button is not FALSE?

Often these kind of things come back to deciding how best to bend your requirements to suit the available logic. If I understand correctly, you have a radio button with the value of true, but no other options.

My immediate thought is to change it from a radio to a checkbox and set a default value as false (unchecked).

That way you just need to check for if true or if false and you don't need to concern yourself with if not false which does get tricky.


Views module error after migrating to new server

Are you sure all the modules are same in your local environment and live site?..There might be cases, if one of such module is missing, views will show missing handlers and will through these kinds of errors. Please try and see if some required module is missing.

This seems a database migration issue. Did your database migration go smooth?..It is strongly suggested you use Backup & Migrate module to deploy database to produciton. You can try to migrate your database through the module once. In the past this had helped me in fixing similar issues.


Limiting allowed HTML tags in comments only

You need to create two "Filtered Text" formats, one that is used by people with the access to post nodes and one for comments.

If you can't separate the two forms by access control (e.g. users are allowed to post nodes and comments, but shouldn't be allowed to post videos in comments), you could use hook_form_alter() in a custom module to limit the allowed filters for the comment form.


Overriding nodes of a certain type with a view

You cannot do this because your view has now taken over the path "node/%", which is all node pages.

This means that hitting any node page will load your view, not the default Drupal node page and when your view loads, the contextual filter will either show the node if it is one of your 3 selected types, or it will display no results found for any other node type.

You can only override like this if you want to override the same for all nodes.

There are alternatives though, like (in no particular order - an there are almost certainly more ways not listed here):

The panels module to override the node display.
Custom code in your theme to print the view in your node template. You could use views_embed_view() for this.
Custom code in a module to override the display of the node.
Display suite - Using dynamic fields or block fields and changing your node display to show your view field and hide all other fields.


How can I upload files with the form element type file?

I had the same problem with the file form element. Solved this by using managed_file and providing the upload location and validators in the form element:

$form['test_CERTIFICATE'] = [
  '#type' => 'managed_file',
  '#title' => $this->t('Certificate'),
  '#upload_location' => 'private://certfiles',
  '#upload_validators' => [
    'file_validate_extensions' => ['pem'],
  ],
];

Then in submit:

use Drupal\file\Entity\File;

$form_file = $form_state->getValue('test_CERTIFICATE', 0);
if (isset($form_file[0]) && !empty($form_file[0])) {
  $file = File::load($form_file[0]);
  $file->setPermanent();
  $file->save();
}


Filtered html with class attribute not being stripped?

I found way of implementing of filtering system:
http://definitivedrupal.org/node/90

but I still hope there's easier way like just a checkbox [x] don't filter class attribute.


Actually found a great tutorial which explains in detail how to do this: Using Views Contextual Filter and Relationship to display reference on referenced node.

Now, I have another, related, question: What if I want to include the Classes taught by the Instructor on the "list of instructors" page (which is a View)?


One thing to check is if there are still fields using this field? Take a look at admin/reports/fields to see if there is anything using the relation fields.

Once you are certain...

If you are certain that there are no dependencies relying on this module, then you can open phpmyadmin, and look at the system table.

Look for /sites/all/modules/relation.info and change the status from "1" to "0". Do the same for relation endpoints as well.

This will disable the module manually.

I would recommend doing a good backup, or even better, recreate your environment away from your production site and test there.


Drupal 8 places the page title in its own block (called Page title). You can control when and where that block displays on the block layout page: /admin/structure/block


Exporting Custom Display Suite View Modes With Configuration

Found the answer.  It is under the strongarm variables.  The setting you have to click is field_bundle_settings for that particular content type.  You must have the strongarm module enabled for this to work.


What way should I use to load a file from a module?

module_load_include() is a wrapper around require_once, with some sugar, so those are essentially equivalent. In the Drupal world, it would make sense to use the Drupal-specific function.

The files[] directive is for class autoloading - you don't use it to include files as such, just to make classes in those files available automatically when you need them.

You shouldn't use module_load_include() at the top of a module (or any other) file, it should be used only after Drupal has been bootstrapped. From the docs:

  Do not use this function in a global context since it requires Drupal to be fully bootstrapped, use require_once DRUPAL_ROOT . '/path/file' instead.


How do I programatically create a Bean 'instance' in code?

Creating bean instance programmatically.
https://drupal.org/node/1436186

<?php
  $bean = bean_create(array('type' => 'my_bean_type'));
  $bean->label = 'Administrative Label';
  $bean->title = 'Bean Title';
  $bean->delta = 'bean-machine-name';
  $bean->field_block_content = array(
    'en' => array(array(
      'value' => '
Text
',
      'format' => 'wysiwyg_editor',
    )),
  );
  $bean->save();
?>


How to test the existence of a file in a webform email twig template

The solution is to do this

{% if webform_token('[webform_submission:values:file:clear]', webform_submission) %}
  FILE UPLOADED
{% else %}
  NO FILE UPLOADED
{% endif %}

Solution given first here : https://www.drupal.org/project/webform/issues/2969437


Programmatically create alias using pathauto for node

Basically to generate URL aliases in code using the pathauto module you would have something like this:

module_load_include('inc', 'pathauto'); // include the inc file for Pathauto module

/*
   pathauto_create_alias($module, $op, $source, $data, $type, $language)
   @param $module: Your module name
   @param $op: The operation (insert, update, return, bulkupdate)
   @param $source: Internal Drupal path (i.e.: node/1)
   @param $data: Addition data used to generate a pathalias, in this case the node object
   @param $type: Type of content that will be used to match a pattern, defined in the backend url alias patterns
   @param $language: If you have a multlingual website, you need to pass the language for which you want to generate the url alias
*/

pathauto_create_alias('your_module_name', 'insert', 'node/1', array('node' => $node), $node->type, $language->language); // Language is optional


Need to be able to disable taxonomy term, but maintain legacy

Depends where you wish to add the term. If you need to add it to a Node creation page, you could always, instead of adding the field as a term reference, add it as an entity reference, select Taxonomy Term as target, select the correct bundle, and in ENTITY SELECTION, select Views: Filter by an entity reference view.

In order to do that you will beforehand need to create a view on the taxonomy terms that you wish to display and hide (ie filter out those terms that should not be displayed), then add this view to the dialog that will appear when you select Views: Filter by an entity reference view


Perhaps you could just use a Serial field

  This module provides an auto-increment (serial) field.

  Unlike Drupal's built-in auto-increment node ID, which is global and
  shared by nodes belonging to all content types, serial fields are
  managed per content type (D6) / entity (D7). For example, the serial
  field of an Invoice instance will generate a unique sequential number
  (starting at 1, then 2, etc.) exclusively for Invoice instances.

  The allocation of serial numbers by this module is atomic. In other
  words, the serial values are unique even when multiple instances of
  the same content type / entity are created simultaneously.


In my opinion the best thing to use for file search is the http://drupal.org/project/apachesolr module along with the http://drupal.org/project/apachesolr_attachments module.
I probably wouldn't do file searching without solr.

You would then turn off the basic drupal search page and just use the solr one.

It will require a bit of extra setup though and you might not be able to do it if you are on shared hosting.

There is an issue for combining the search files and search pages here - http://drupal.org/node/368195

Unfortunately there isn't a proper patch to use but there is some code in there.
You will just have to do a bit of work yourself to get it going.


Why is this code to programmatically create a content type failing?

You have node_type_save and node_add_body_field in the wrong order. You can always steal ideas from http://api.drupal.org/api/drupal/profiles--standard--standard.install/function/standard_install/7


to center the title: find the appropriate css file, and change:

.title, #page-title
{
...
}

to include

.title, #page-title
{
  text-align:center;
}

It could be listed as either the class title, or id, depending on the theme. This is basic CSS.

to include the other fields:

1) you can alter the page.tpl.php file for theme, but if modules are out,  I assume most any php is out, so this is probably not suitable.

2) reassign your block if it otherwise worked, but in the block set up, change the Block Title to <none>


They're identical. loadByProperties() actually converts your conditions to an entity query internally.

I'd acually recommend to do an entity query yourself, directly. It's more readable and loadByProperties() might get deprecated in the future.


It seems to be similar to D7. Just use a render array:

$list = array('apples', 'peaches', 'pears');
$render_array = array(
  '#theme' => 'item_list',
  '#items' => $list,
  '#title' => t('Argument Information'),
);
return $render_array;

I searched '#theme' in core\modules to find examples. Not sure if this is the 'correct' way though?


Accessing values of unknown field types when using entity_metadata_wrapper

Here are a few suggestions to make this process a little easier.

$wrapper->field_something->type();

will return the type of the field, ie node, taxonomy_term, integer, text etc. You could then handle the value returned from $wrapper->field_something->value() correctly.

Also

$wrapper->field_something->raw()

will return the raw value of the field. Which will either be an array in the case of multi valued fields of just the value. For instance an entity_reference will be the nid (or entity id) of the referenced entity, or an array of referenced entity id's.


How can I automate the site setup process during installation?

I recommend you take a look at NodeStream for examples. With a combination of install profile and Features, you do a great deal of setup during the actual install. You could either build on top of that, which is what we do at work, or you could use it for examples.


How do I use views to override a taxonomy term page for only terms with a single vocabulary?

I ended up using the Taxonomy Views Integrator module.

The TVI (Taxonomy Views Integrator) module allows selective overriding of taxonomy terms and/or vocabulary with the view of your choice. Using TVI you can easily create custom views to output all terms in X vocabulary.


Any D7 modules similar to the Project Issues module?

There is a 7.x-2.x branch of the module in git.


You have to configure a filter for the language in the the view:

FILTER CRITERIA

"Content: Translation language (= Content language selected for page)"

Btw. you have a big security problem in the node template, it is not allowed to apply the raw filter on a field that contains user input. You should use

{{ content.field_custom_body }}

instead to print the field.


Well, I found a solution from here:
http://www.zyxware.com/articles/3424/solved-drupal-boost-drupal-site-not-working-in-chrome-and-getting-a-blank-white-screen-when-boost-is-enabled

I added the following line to my .htaccess file:

Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"

Still occasionally getting the same error message in the console, but at least now the site is loading :)


Can computed fields be added to a custom entity?

Yes, I found that entities can take computed fields.

A very easy way to achieve that, is by the 'data' module. It takes any extra database table. Can expose that table as an entity automatically. That entity can take normal fields, in addition to it's database table field. It does all the heavy lifting in place of entity API.


You can look into this :
https://api.drupal.org/api/drupal/includes!database!database.inc/function/db_query/7#comment-7019

https://api.drupal.org/comment/51338#comment-51338

https://api.drupal.org/comment/16974#comment-16974

And check if you made change in your taxonomy vocabulary, deleting any fields that the search would index in the views.

You can also re-index your user.


How do I update customers cart prices and add discount and then let them checkout?

There aren't many good solutions here, because you're hitting up against the limitations of the pricing system. You have two basic options: custom line item fields that contain special pricing paired with a pricing rule that overrides the default product price or some combination of discounts that adjust product prices solely for that user. The former may be a challenge, because I can't remember if we ever fully got Inline Entity Form to manage line items, and the latter would be a pain for orders with a lot of different products.

The Commerce Price List module was ultimately developed to handle situations like this, where price lists can be assigned on a per user / quantity basis. It appears the same feature set works in D7 as in D8, but it would give the customer access to that pricing on any order while the price list was active, not just a single one. If that's no problem, then that's probably your solution.


How to use jquery to show divs based on select box?

you ommited the drupal.behavior, that s probably why it doesnt do anything.
And i would suggest working with classes instead changing style. In your css you create a style with visibility:hidden, apply it to each element and then remove it on click. (and add it again once you clicked on something else ...)

document.getElementById doesnt make much sense there ... you can write it better like this :

(function($){
Drupal.behaviors.taxdescGetDesc = {
  attach: function (context) {
    $("").click(function(event)){
    option = $(event.currentTarget).val();
    $('#'+option).removeClass("hidden");
  }
}


Contextual filter in path for block view display, alongside pathauto aliases in Drupal 8

So I was able to get my functionality by changing the Contextual Filter to a query parameter:

So in my widget block, I changed the link values from /press-releases/2015 to /press-releases?year=2015. Now the functionality works as wanted. Both urls /press-releases/ and /press-releases?year=all show all the press releases, and the node urls still work.


How can we uninstall a module directly from the database?

You can use

drush pm-uninstall.
If you have entities in your module, write a query in your module to first delete all entities of your particular entity type. Once deleted, remove that file where you have written annotation for your entity, create a backup for use later. Except .info.yml file and .install file, remove all files.

Now you can easily un-install that module. Once un-installed, put all your backed up files into your module folder again, install your module and go!


How to return node object on programatically node creation

It's Entity::save() that returns the integer, so:

$node = Node::create([
  'type'        => 'article',
  'title'       => 'Druplicon test',
]);

$node->save();

return $node;


Try looking at Content > Content Types.  If there is only one content type listed on this page, then it means you probably deleted all other content types.  This may be your problem.


Drupal commerce: How to retrieve VAT number from order ID?

It took me a while to figure it out, but now I've found an answer myself:

$profile_id = $order->content['commerce_customer_eu_vat_rc']['#items'][0]['profile_id'];
$profile_wrapper = commerce_customer_profile_load($profile_id);
$vat_id = $profile_wrapper->commerce_vat_number['und'][0]['value'];


i18n http://drupal.org/project/i18n provides "Multilingual variables"

As the site_name is a config variable, presumably it can be translated.

See also: http://drupal.org/node/313272

settings.php

/**
 * Multilingual settings
 *
 * This is a collection of variables that can be set up for each language when i18n is enabled.
 * These are the basic ones for Drupal core, but you can add your own here.
 */
$conf['i18n_variables'] = array(
  // Site name, slogan, mission, etc..
  'site_name',
  'site_slogan',
  'site_mission',
  'site_footer',
  // Different front page for each language
  'site_frontpage',
);


How do I enable dynamic favicons in a custom theme?

Unless your theme allows for functionality to add further icons you'll need to add head link tags yourself with something like this using template_preprocess_html:

function YOURTHEME_preprocess_html(&$variables) {
  $icon = [
        '#tag' => 'link',
        '#attributes' => [
            'href' => '<url to your icon-52x52.png>',
            'rel' => 'shortcut icon',
            'sizes' => '52x52'
        ],
    ];
    $variables['#attached']['html_head'][] = [
        $icon,
        'icon52x52
    ];
}

Or if you want to avoid adding code the metatag module as a sub module of "Metatag: favicons" to allow you to add them from the CMS
https://www.drupal.org/project/metatag


Redirect to a content page after login only from that page

Hope this will give you,

In Drupal 7, you can achieve it by using destination parameter.

Just add the destination parameter in the URL where you want to redirect it.

For example if you are in login page and after login if he want to redirect to some node say about page then

YOUR_DOMAIN/user/login?destination=about

Just add the destination parameter in "To create content, you must first log in" link. On click of this link it will redirect to User login page with the destination parameter. After login it will redirect to the path you have specified in the destination value.


Is there a suggested approach to altering the field schema for already populated fields?

I have no idea if this is a "suggested way out," I'm tending to think not, but, with your site offline, you should be able to use phpmyadmin and:

Add a field to the database table (your float field),
copy all of the data from the original column/field to this new one (something as simple as UPDATE "tablename" SET "newfield" = "oldfield" would probably do it),
drop the original integer field from the table,
rename the new field with the old field's name, and

then take drupal online with the new schema and code that is expecting a float in there instead of an integer.

You could also just rename instead of dropping the original field so you could quickly go back if this screwed up, but I would definitely back things up before trying this in any case :)


RDBMS-independent way to get table primary key?

For non-Drupal tables

I don't think there is a cross-db drupal way to do this currently.

It would have to be added to the database schema class for each database type.
For example, see the mysql database schema class and look at something like addIndex.

Something similar could be done for showIndex().
If it is added for all the different database handlers, it would then be able to be safely used.

Then a database API function would have to be added for easy calling.

For example you would need a db_show_index() function in database.inc like db_add_index().

For Drupal defined tables

You can use drupal_get_schema() and get the schema for a table; then, get what you need from that. It will return a schema as defined in hook_schema().

You might also be interested in some of the other schema API functions.

The schema will only be what was defined in hook_schema though. It won't pick up anything that has been added or changed outside of that.


How do I execute functions on a custom module?

You can call specific functions for testing using drush (drush ev "command();") or using the devel.module block/page (at /devel/php or so).

However, apart from some quick tests, in 99% of the cases, Drupal is going to take care of calling the functions of your module, through hooks and callbacks.

E.g., to have your module display something in your site, you need to implement hook_menu(), define a page callback then simply visit the defined path.


Fetch values from Field Collection or Multifield on Node to Entityform

The best way to do this is hook_form_FORM_ID_alter().

Modules can implement hook_form_FORM_ID_alter() to modify elements and values in the form before it is rendered. You'll have to look quite deep into the form array but it should be possible to set the #default_value for the required elements.


style.css doesn't refresh while Bootstrap sub-theming

The mangled file comes from aggregating CSS files. You will need to clear/flush the cache in order to see changes.

You can turn CSS caching off by going to /admin/config/development/performance and unchecking aggregate CSS files. Now you don't need to clear the cache to see CSS changes.

PS: Remember to turn this back on when your website is ready for production/going live.


Is it possible to have all content types as dropdown field in one content type in drupal 7?

I can suggest four different solutions:

Using Bundle Name Reference module , of course I haven't used this module and I'm not sure if it presents the same functionality as you desire.
Easy but not always working , Create a taxonomy vocabulary and add terms having same name as your content type does , then you can add a taxonomy reference to your content type targeting that vocab.
The problem in solution 2 is that when a new content type is added you manually must add a term for that in your vocab , to overcome that problem you can write a simple module then implement hook_node_type_insert and there you can add term to your targeting vocab programmatically so you wont need to manually add new terms any more.
The last and the most complicated solution , maybe you can write it as a module so others can use it in future. You will need to write a module to implement a new field type , you will need to implement hook_field_schema to add new table for your field type (there you can store bundle ID of selected content type) , a field widget which must be Select type and its options can be filled using this function : node_type_get_types.


Links continue to point to live server - Drupal Live to localhost

Make sure you updated the $base_url to reflect to you local server name in settings.php. Also check if your menu system is using absolute path.


Sub level menu in sidebar (but in specific pages)

This is exactly what Menu block does. You can set up blocks showing menu items according to the start level and depth you desire/configure. Those blocks show only up when there are menu items in that range so you even don't need to configure your blocks to only show up on certain pages. See the documentation for further information.

To be more concrete, your menu (main_menu for instance) should looks like:

Page 1

Subpage 1.1
Subpage 1.2
...

Page 2

Subpage 2.1
Subpage 2.2
...

Page 3

Set up a menu block that shows the second level and configure that block to show up in second sidebar. With this configured you'll see a menu showing Subpage 1.x when on Page 1 or on one of its subpages. The same counts for Page 2. When on Page 3 you won't see the menu in the second sidebar.


How to avoid caching of fields in Entity View?

You can not do it per field, that would defeat the purpose. The whole entity is cached.

You can disable render caching for your entity by setting render_cache = FALSE in your annotion and you can do it per view mode.


Only create taxonomy terms on node approval?

As far as I can see, this would require a custom module. You would have to do something like this (tailor to your needs; I don't know if you're using publishing status to represent approval status).

    <?php
      function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
        switch ($op) {
          case 'presave':
            if (!empty($node->taxonomy) && $node->status == 0) {
              // Write some logic to save the data to your module's DB table, e.g.
              // _mymodule_get_taxonomy_temp() would contain a database query or
              // something to get the record.
              $record = _mymodule_get_taxonomy_temp($node->nid);
              $record_exists = !empty($record);
              $taxonomy_temp = ($record ? $record : new stdClass());
              $taxonomy_temp->taxonomy = $node->taxonomy;
              $taxonomy_temp->nid = $node->nid;
              if ($record_exists === FALSE) {
                drupal_write_record('mymodule_taxonomy_temp', $taxonomy_temp),
              }
              else {
                drupal_write_record('mymodule_taxonomy_temp', $taxonomy_temp, 'nid'),
              }
              unset($node->taxonomy);
            }
            elseif (!empty($node->taxonomy_temp && $node->status == 1)) {
              // Retrieve the saved taxonomy and put it back into the node.
              $record = _mymodule_get_taxonomy_temp($node->nid);
              // We append it to any changes made during the approval process.
              $node->taxonomy = array_merge($node->taxonomy, $record->taxonomy);
              // Clean up the database record
              _mymodule_delete_taxonomy_temp($node->nid);
            }
            break;
        }
      }
    ?>

Note that this is strictly sample code. You might want to retrieve the terms using hook_form_alter instead and show them in the tags box as if they had been added. In any case, the key is not to have them in $node when taxonomy_nodeapi() runs and saves them.


When using Services after login request in response You should get a X-CSRF-Token. You have to use it in header of next requests to keep "being logged in".
It should be in header for second (and all possible future) requests like:

headers: {
    "X-CSRF-Token":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    "Content-Type":"application/json"
}


What if I don't want node pages for content type?

You are looking for Internal Nodes

  Some content/nodes should never be viewed directly; only visible be
  through something else such as Views or Panels. This module denies
  access to node/[nid] URLs while allowing the content to stay published
  and otherwise viewable. Try the demo!


How to inject postal address into user entity via custom registration form

I managed to figure out the problem. Apparently you can't load the new user array with the position of the array where the address fields are located. Instead you have to load the address array into a new variable, and pass THAT into the "field_postal_address" entity field.

So, in my solution, I loaded the address array into the $ary_address array. Then I passed that into the postal address array.

$ary_address = $form_state['values']['address']['address'];

$edit = array(
    'name' => $form_state['values']['name'],
    'field_fname' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_fname']))),
'field_lname' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_lname']))),
    'pass' => $form_state['values']['password'],
    'mail' => $form_state['values']['mail'],
    'init' => $form_state['values']['mail'],
    'field_postal_address' => array(LANGUAGE_NONE => array($ary_address)),
    'status' => 1,
    'access' => REQUEST_TIME,
);
$newUser = user_save(drupal_anonymous_user(), $edit);


drush omega-export
drush omega-revert

or

omega-export --revert

See: http://friendlymachine.net/posts/getting-started-omega-4


You must give a value for Default front page, and since you don't want to use node, you need to give another value for that setting.

Enable the Path module that comes with Drupal 6 core, from admin/build/modules

Create a Page node, from node/add

Add the path alias you want to use to the node being created

Save it
Change the default front page, and put the path alias you assigned to the node you just created, on admin/settings/site-information

Save the settings

Now Drupal will use that node as front page.

If you installed the Vertical tabs module, the node edit page would appear different. In this case, you can find the path alias text-box under the URL path settings tab.

I used a Page node for the front page, but you can use any content type you want.


Rule to delete other node of same type before saving content

Daniel,

What I think is happening is that you're trying to delete the actual node that the user is about to save (it hasn't been saved yet)!

It doesn't look like you're finding the user's PREVIOUS node to delete first, you're just trying to work with the current one.  :-)

Of course - since this current node hasn't even been saved yet (your event is prior to saving), there is nothing to be deleted.

The rule will have to be more complicated, with your finding an existing node by the current user first...

Hope this helps.


if you would like to display it programmically
This might be helpful. put it inside  page.tpl.php. best of luck!

$elements = drupal_get_form("user_login");
$form = drupal_render($elements);
echo $form;


Why the system enter two times in an hook_node_presave?

Remove node_save($progetto); from alterator_node_presave and try. Because hook_node_presave is called just before the node_save. It can be reason of saving the field twice.


SymfonyTestsListener does not exist on PHP Unit Test

Had a similar issue:
Solved it by adding the "symfony/phpunit-bridge": "^3.4.3" library.


Practical concerns for changing text on the "add to cart" in Drupal Commerce to use it as a "wishlist"

So, upon conducting a lot of research, modifying the existing architecture in DC is possible, but appears to be non-trivial to apply. The checkout process has many hard coded titles and elements that, while instructive to research and attempt to modify lead me to believe that this implementation as a work-around is probably more effort than just throwing together a custom module for the functionality I'm looking for. If anyone reads this from the Drupal Commerce team: the internet is LOADED with requests on how to modify this stuff through the admin functions of DC, great work and much appreciated, but this noobs head hurts.

function bartik_form_alter(&$form, &$form_state, $form_id){
dpm($form_id);
dpm($form);
if (commerce_form_callback($form_id, $form_state) == "commerce_cart_add_to_cart_form"){
    $form['submit']['#attributes']['title'] = $form['submit']['#attributes']['value']=t("Add to Inquiry List");
    }
if(strpos($form_id, 'views_form_commerce_cart_form_default')===0){
    $form['actions']['submit']['#value'] = t("Update List");
    $form['actions']['checkout']['#value'] = t("Submit List");
}
if(strpos($form_id, 'commerce_checkout_form_checkout')===0){
    $form['buttons']['continue']['#value'] = t('Proceed to final list submission.');
    }
if(strpos($form_id, 'commerce_checkout_form_review')===0){
    $form['buttons']['continue']['#value'] = t('Submit your inquiry list');
    }

}


You can use Menu Block Module. It will display your menu as a block.

1) Create a new menu block.

2) Select parent menu as a "About".

3) Select its region and page visibility to about page url (and inner pages urls too if you want to display it on inner pages.)

4)Click on save.


You can introduce functions fields into your productions views by adding a Relationship through the Entity reference field.

Add a new Relationship Content referenced from field_production_content
Add a new Field field_date_functions and set it to use the Relationship field_production_content
Add a new Field field_tiket_link_functions and set it to use the Relationship field_production_content

If I understood your structure correctly you'll see functions fields on their related functions nodes in Views results.


How to use leanModal for loading a node or content in Drupal 7?

The leanmodal javascript plugin specifically states that it does not include AJAX support. That means that whatever content you want to appear in your modal needs to be already included on the page content when the page initially loads.

If you want to load a different page's content in the modal, then you will need to use an approach that includes AJAX support. I would recommend one of the many Drupal options that provide this sort of functionality, such as Simple Dialog or cTools Auto-Modal.

The exact implementation will depend on the specifics of what content you are trying to load and in what context.


How can I show only webform content by excluding header,footer?

If your lightbox/modal behavior can target just a section of HTML markup on the page. Some modal plugins only open full webpages, others allow targeting sections of your DOM.  It sounds like you're currently using the latter.  Here's an example of a lightweight modal plugin that allows targeting html embedded on the page as opposed to an entire webpage (but if you're comfortable with javascript, you could implement this yourself too):  https://robinparisi.github.io/tingle/

If you need the webform available on multiple pages, you could set the webform to be available as a block and then target that block to load in the modal.

To enable showing the webfom as a block, go to the Form Settings subtab/page of the webform, scroll down and expand the ADVANCED section and check the checkbox (shown below).


How to create entity reference field from custom entity to specific content type

You're looking for the handler_settings setting, which provides configuration for the handler you've chosen, in your case, you want:

$handler_settings = [
  'target_bundles' => [
    'project' => 'project',
  ],
];

As always with fields, widgets and formatters, just create a configurable field in the UI, export it and look at the settings there. You can always copy the settings and other things almost 1:1 from the exported YAML files to a PHP array.


How to use Open Atrium 2 for document managment

The 2.30 version of Open Atrium supports folders out-of-the-box through the oa_folders module.

On earlier versions I have used a customized news section type and calling it Folders or Filesharing. With a clear workflow established with the people working on it, you can then have each document page being a folder, where all space members can add or remove further documents. It was obviously a limited solution, but made the purpose. Now we have a better OA world :)


Can I move distribution profile modules from profile folder to sites/all/modules?

If the modules in question are not enabled you can move the modules.

The paths to their location in the system table in the database will be updated when you visit /admin/modules.

However, If they are enabled you may run into issues.

See http://drupal.org/node/183681


How to get the revisions list of a node and delete them all?

Yes, as you says there is a list of modules that can do this in Drupal 7 like:

Node Revision Delete

  The Node Revision Delete module lets you to track and prune old
  revisions of content types. Define the max amount of revisions to keep
  per content type. Run on Drush, cron run or on a different period
  (daily, weekly, etc).

Node Revision Restrict

  The Node Revision Restrict module allows you to restrict revisions of
  node for each content type. This module has an admin interface to
  specify node revision threshold for each content type available. The
  possible setting include node type with corresponding revision limit,
  provided on the Node Revision Restrict configuration form. Note that
  this module does not and cannot delete the current revisions of a
  node.

Node Revision Cleanup

  Node Revision Cleanup is designed for really big databases. And site
  administrators who are comfortable with Drush. The concept behind this
  module is to be able to run multiple invocations at the same time, via
  Drush to maximize the number of node revision deletions per second.

Revision Deletion

  This modules enables the ability to mass delete aging node revisions.
  Possible settings include node type, the age of node revision before
  being deleted, along with a Cron frequency setting. The revisions may
  be deleted after review on an administer page as well. This module
  will NEVER delete the current revision of a node, nor will it allow
  you to do so.

And for Drupal 8, well at this moment there is not module for do that, but you can use:

To get the revision list of a node:

$vids = \Drupal::entityManager()->getStorage('node')->revisionIds($node);

See Nodes now have a storage controller; node_revision_list() removed.

To delete a revision revision you can use the node_revision_delete() function, but at the end see the function code:

function node_revision_delete($revision_id) {
  \Drupal::entityTypeManager()->getStorage('node')->deleteRevision($revision_id);
}

So, is better if you just use:

\Drupal::entityTypeManager()->getStorage('node')->deleteRevision($revision_id);


What properties does a custom cck_phone form field need to work?

I was unable to find an exact answer to this question, but I was able to find a work around to get the extensions to load.

using form_alter, after the field is partially built in a form function

//set value for office extension
  if(
    isset($form_state['storage']['$profiles']['personal_information']->field_phone_office[LANGUAGE_NONE])
    &&
    $form_state['storage']['$profiles']['personal_information']->field_phone_office[LANGUAGE_NONE][0]['extension'] != NULL
  ){
    $field_phone_office_ext_value = $form_state['storage']['$profiles']['personal_information']->field_phone_office[LANGUAGE_NONE][0]['extension'];
  }
  else{
    $field_phone_office_ext_value = '';
  }

  $form['user-information']['user-information-fieldset']['profile']['phone']['field_phone_office']['extension'] = array(
    '#type' => 'textfield',
    '#title' => t('Ext.'),
    '#default_value' => $field_phone_office_ext_value,
    '#value' => $field_phone_office_ext_value,
    '#size' => 10,
    '#maxlength' => 10,
    '#weight' => 2,
    '#attributes' => array(
      'class' => array(
        'phone-extension'
      )
    )
  );


Initiate file download and redirect to loged-in home page

Try to use any of these modules. I hope below modules helps you to solve your issues :

LoginToboggan

  Allow users to login using either their username OR their e-mail address.
  Allow users to login immediately.
  Provide a login form on Access Denied pages for non-logged-in (anonymous) users.
  The module provides two login block options: One uses JavaScript to display the form within the block immediately upon clicking "log in".
  The other brings the user to a separate page, but returns the user to
  their original page upon login.

Login Destination

  The Login Destination module allows you to customize the destination
  that a user is redirected to after logging in, registering to the site
  (7.x), using a one-time login link or logging out (7.x). The
  destination can be an internal page or an external URL. It is possible
  to specify certain conditions like referring pages or user roles and
  make the destination depend upon them. You may use PHP snippets to
  provide custom conditions and destinations. It is also possible to
  keep users on the currently visited page after logging in or out.

Anonymous Login

  This is a very simple, lightweight module that will redirect anonymous
  users to the login page whenever they reach any admin-specified page
  paths, and will direct them back to the originally-requested page
  after successful login.

OR

You can do this by using Rules module.

  The Rules module allows site administrators to define conditionally
  executed actions based on occurring events (known as reactive or ECA
  rules).


Redirect user to language other than default

This might be the answer you're looking for:
Install profile with variable default language messes up translations

If the strings were originally written in english and not translated since you'll need to set the i18n_string_source_language variable to en rather than the site default (which is no longer en)


Showing term description on terms page that are displayed using views

1: Create a view much like this one (It is a term view using the term ID as a contextual filter then showing an unformatted list of the description field):

$view = new view;
$view->name = 'catalog_taxonomy_term_descriptio';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'taxonomy_term_data';
$view->human_name = 'Catalog Taxonomy Term Description';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Catalog Taxonomy Term Description';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '1';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Taxonomy term: Term description */
$handler->display->display_options['fields']['description']['id'] = 'description';
$handler->display->display_options['fields']['description']['table'] = 'taxonomy_term_data';
$handler->display->display_options['fields']['description']['field'] = 'description';
$handler->display->display_options['fields']['description']['label'] = '';
$handler->display->display_options['fields']['description']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['description']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['description']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['description']['alter']['external'] = 0;
$handler->display->display_options['fields']['description']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['description']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['description']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['description']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['description']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['description']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['description']['alter']['trim'] = 0;
$handler->display->display_options['fields']['description']['alter']['html'] = 0;
$handler->display->display_options['fields']['description']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['description']['element_default_classes'] = 1;
$handler->display->display_options['fields']['description']['hide_empty'] = 1;
$handler->display->display_options['fields']['description']['empty_zero'] = 0;
$handler->display->display_options['fields']['description']['hide_alter_empty'] = 1;
/* Contextual filter: Taxonomy term: Term ID */
$handler->display->display_options['arguments']['tid']['id'] = 'tid';
$handler->display->display_options['arguments']['tid']['table'] = 'taxonomy_term_data';
$handler->display->display_options['arguments']['tid']['field'] = 'tid';
$handler->display->display_options['arguments']['tid']['default_action'] = 'empty';
$handler->display->display_options['arguments']['tid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['tid']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['tid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['tid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['tid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['tid']['break_phrase'] = 0;
$handler->display->display_options['arguments']['tid']['not'] = 0;
/* Filter criterion: Taxonomy vocabulary: Machine name */
$handler->display->display_options['filters']['machine_name']['id'] = 'machine_name';
$handler->display->display_options['filters']['machine_name']['table'] = 'taxonomy_vocabulary';
$handler->display->display_options['filters']['machine_name']['field'] = 'machine_name';
$handler->display->display_options['filters']['machine_name']['value'] = array(
  'catalog' => 'catalog',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'catalog-taxonomy-term-description';

2: Go into your taxonomy term view (I'm assuming you have already edited/overridden this) and set the Header in the Page Settings section to Global: View area. In the settings for that you will be able to select your view description view. This will cause the term description to show up the top of the page while displaying the related nodes below it.


Why are my search results not showing when I input any body text?

Core search indexes titles and body content but in order to actually be able to search the nodes have to be indexed.

Search indexes nodes on batches and each batch starts on a cron run.  You can run cron manually by going to your /admin/reports/status but ideally you want to setup a cronjob to do this for you automatically.

Search admin page (admin/config/search/pages) reports on what percentage of the nodes have been indexed.

Only after the search admin page says you have 100% of the nodes indexed you can be sure that what you search can be found.


Client-Side form validation issue with Fivestar module?

Perhaps you are using the wrong $form_id

One way to check is to use Database Logging, also known as the Watchdog or Recent Log Entries, to log the $form_id. After you add this code, execute the form by performing a submit, and then check your Reports > Recent Log Entries area for the result. This may require enabling the Database Logging core module before the messages are logged and/or visible.

<?php
/**
 * Implementation of hook_form_alter()
 */
function rishihrvalidate_form_alter(&$form, &$form_state, $form_id) {
  // Log the $form_id to the watchdog
  // in this example, 'form_id' is just the log entry name. I commonly use 'wtf'
  watchdog('form_id', $form_id);

  if ($form_id == 'comment_form') {
    $form['#attributes']['onsubmit'] = 'return comment_cs_validate()';
  }
}
?>

For more information about watchdog, visit http://api.drupal.org/api/function/watchdog


How can I display a user avatar in Drupal 7?

The code used from user_user_view() is the following one:

$account->content['user_picture'] = array(
  '#markup' => theme('user_picture', array('account' => $account)),
  '#weight' => -10,
);

For example, if you want to output the HTML code to show the picture associated with the currently logged-in user in a form, you could use code similar to the following one:

$form['user_picture'] = array(
  '#theme' => 'user_picture',
  '#account' => $GLOBALS['user'],
);

This is similar to the following code used in node_admin_nodes(), which uses a different theme function.

$form['nodes'] = array(
  '#theme' => 'table',
  '#header' => $header,
  '#rows' => $options,
  '#empty' => t('No content available.'),
);

The content of "#header," "#rows," and "#empty" are used to populate the content of the $variables array that is passed to the theme function ("#header" becomes "header," etc).

theme('user_picture') works even when the Image module (the one that defines theme_image_style()) is not enabled; in that case, it uses theme_image() instead. When the Image module is enabled, it uses the default style as contained in the Drupal variable "user_picture_style." In both the cases, the user image is a link to the user profile.

As the theme function is using a template (user-picture.tpl.php), the relevant code is in template_preprocess_user_picture(); if you look at the code for theme_user_picture(), you would see there is no code.


How to show a RSS feed button for aggregator node page

The RSS icon should already appear automatically on the page. If not, check your theme's page.tpl.php file and make sure it has this line on it:

<?php print $feed_icons ?>


Drush command to check if Drupal is installed?

$ cd /path/to/drupal6or7or8
$ drush status bootstrap | grep -q Successful

Then, $? will be 0 if Drupal has been installed, or 1 if there is no site, or it does not have a database, or the site has not been installed.


Is it possible to use a view as a field in another view?

The title of your question and the body of your question seem different to me.

To use the results of a view as a field in another view, you would use Views Field View.

To display two views at the same time, make one a page display and the other an attachment display attached to the page display.


You can define your own template.

For example as inline:

$link = array(
    '#type' => 'inline_template',
    '#template' => '{{ title }}',
    '#context' => array(
        'url' => $url,
        'title' => $title,
        'fa_icon => 'fa-pencil',
    ),
  );

If you are working on a theme or module you should define a template with its own name like link_fa, so that it can be overridden by other modules or themes.


Restrict Anonymous Users from accessing/viewing a Customized Form

The access callback element used in hook_menu() takes a string has a value, you're supplying it the output of myid_print_user_access() which return a boolean. It should be:

'access callback' => 'myid_print_user_access',


Upload a flash based banner as easy as image

Use the Media module for your requirement.


Is there a module or method for processing and generating codes for music download cards?

Well I'm unaware of a turn-key (Drupal Distribution) for a Dropcard ecommerce site per se. The components exist to make such a site using some custom code. Some example modules that fit your use-case are:

TokenAuth

  Token Authentication provides a token for use in the URL to
  authenticate users to your site. It only works on paths configured in
  the settings page.

Commerce File

Ability to limit access to the file with limit settings
Default limits: duration, download count, IP address count
Limit default values can be inherited at the product level such that the product always uses the current default value
After purchase of a file, limits are statically recorded to the line item so that they do not reflect any changes to the product's file limits.
A user's limits reflect changes to an order, even after order is completed.
Order deleted, canceled
Line item deleted, update
Utilizes Rules to control workflow for:

File download access: controlling access and reacting to access denied
Order workflow: issuing access licenses and revoking access licenses in the order

Views Data Export -- export your authentication links to paper cutouts.

  This module is designed to provide a way to export large amounts of
  data from views. It provides a display plugin that can rendered
  progressively in a batch. Style plugins are included that support
  exporting in the following types:

  CSV, Microsoft XLS, Microsoft DOC, Basic TXT, XML.

Commerce Module

  uhh make an eCommerce site using drupal.

Many of these modules likely make use of Drupal core concepts for Entities, Cron Jobs and likely Queues. You may find the Queue API useful to build the authentication tokens for example every hour for new audio content.

The ingredients exist for a developer to create what you're asking for, good luck.


I suggest you look into the Services Module. The entire concept is based upon 'programmatic remote users' logging into a Drupal site and accessing whatever portion of the 'out of the box' site API you enabled for your remote users to access. Additionally, Services offers a well designed means of creating your own API routines that your selectively expose to different remote users.

The out of the box API calls enable you to create users, nodes, comments, and so on. Most of the basic operations a user can do are available.

Check out: http://drupal.org/node/1070066


There aren't any functions in Drupal that I am aware of. You'll need to query the database.

$time_active = db_query("SELECT timestamp FROM {sessions} WHERE uid = :uid ORDER BY timestamp DESC LIMIT 1", array(":uid" => $uid))->fetchField();

That will fetch the last time that the user was active if they have a current session open.


How to safely remove fields from create content - project

Normally I would suggest just hiding the unwanted field via a hook_form_alter, either by setting $form['unwanted_field']['#access'] = FALSE, or by using the hide() on that element. If the field is a required field, you'll want to alter that property as well, or set a value before hiding it or setting '#access' to false.

if you want to actually delete the field, you can use drush to run field_delete_field(). For example, drush eval 'field_delete_field("unwanted_field")' should work (untested).


How to create a name-surname structure for taxonomy terms?

This definitely worked for me:

Inline Entity Form + Automatic Entity Label + Token.
I added an entity reference field to my content type, pointing to a Taxonomy Term entity and selected "Inline entity form - Single value" as the widget.
What works great is that every time you edit the term from the node edit form, the term's label changes automatigally.

Here are some snapshots.

Add/Edit Node:

Newly created term (vocabulary list):

Node view:

Hope it works for you too!


Assign previous migration destination id in prepareRow

In your site 2 content (Node) migration you probably want to use the prepare() function.

  function prepare($entity, stdClass $row)

  The Migration class prepare()
  method is called by the destination class prepare() method, after it
  has called all field-level prepare() methods and immediately before
  the destination object is saved. The $entity argument is the
  destination object as populated by the initial field mappings and
  manipulated by the field-level methods; the $row argument is an object
  containing the data after prepareRow() and any callbacks have been
  applied. The prepare() method is the last chance to manipulate the
  destination object before it is saved to the Drupal database. It is
  important to remember that, since it is called after the field
  handlers, fields will be in their fully-expanded forms (i.e., in
  Drupal 7 a text field value will be at
  $entity->field_textual_data['und'][0]['value'] rather than simply
  $entity->field_textual_data).

Within your Migration prepare function you want to set the UID of the content to whoever you want to be the creator of that piece of data.

As an example:

public function prepare($entity, stdClass $row) {
  $query = /* Query to figure out UID from site 1, from a UID in site 2 ... for current node NID*/;
  $desired_uid = db_query($query);
  $entity->uid = $desired_uid;
}


How to change the default search button value in awesome zymphonies free theme?

How to override the search text string

For how to change the text of the search box, you'll need to do a string override.  See the answer to this question on how to write your own custom module to do this.

Drupal also has a String Overrides module so that you don't have to write your own code, but it's not ready for Drupal 8 yet.  There is a test version here but it's not safe for production sites.

A third way to do this-- and perhaps the easiest approach if you will be changing lots of Drupal interface text-- is to add "English" as a translatable language on the language settings page (admin/config/regional/language) and then disable the original "English."  What this allows you to do is "translate" any text that appears in the Drupal UI.

How to show the search box on other pages

The search box is (most likely) a block that can be controlled on the block administration page: /admin/structure/block.

You can edit the block settings to choose which pages it appears on.  You can also place additional search blocks and then edit the settings to show them in different places on different pages.


How to transform select options from views exposed filters to clickable link areas?

It is possible to override the template, you shall just create it in your theme and then clear the cache.

In your new template you can just change the select list to a ul

The template that you want to override may only contain {{ form }}.
Then you must find the preprocess function in the module or theme.


by hook_menu you are just registering a path to Drupal.

  Define menu items and page callbacks.

To get this printed with icon you can try contributed modules like

Menu Icons
Icon API

Icon API module is able to apply your programmatic logic


How to get a parameter value from the current URL in views-view-fields.html.twig?

You could use Twig's split filter, though I don't recommend scripting too much inside templates.

Instead I recommend to pass the value over to Twig from a preprocess function from inside your theme or a custom module via template_preprocess_views_view_fields.

/**
 * Implements template_preprocess_views_view_fields().
 */
function MYTHEME/MYMODULE_preprocess_views_view_fields(&$variables) {

  // Retrieve an array which contains the path pieces.
  $current_path = \Drupal::service('path.current')->getPath();

  if ($current_path[0] == 'questions') {
    $variables['question_id'] = $current_path[1];
  }
}

And then inside your template print it for example like so:

{% if question_id %}

Question ID: {{ question_id }}

{% endif %}


How to trigger an event when node is saved?

The parameter passed to code had syntax error.

The correct code will be

function custom_node_update(Drupal\Core\Entity\EntityInterface $node) {
  // Logs a notice
  \Drupal::logger('custom')->notice("entity was updated");
}


Taxonomy exposed filter with parent hierarchy only

I had a situation like this, i done it by giving a custom options array to the exposed filter in hook_form_alter().

 function mymodule_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == "views_exposed_form" && $form['#id']=='your-form-id' ){
 $tid_options = get_tid_options();

 $form['your-field-name']['#type'] ='select';
 $form['your-field-name']['#size'] = null;
 $form['your-field-name']['#default_value'] = '';
 $form['your-field-name']['#options'] = $tid_options;
   }
}

function get_tid_options() {
  $cc=array();
  $tax=taxonomy_vocabulary_machine_name_load('machine-name');
  $vid= $tax->vid;
  //Code to find parent terms here according to your vocabulary structure.
  $child_terms = taxonomy_get_tree($vid);
  foreach($child_terms as $values)
  $tid=$values->tid;
  $name=$values->name;
  $cc[$tid] = $name;
 }
return $cc;

}

Use taxonomy_get_parents or taxonomy_get_parents_all to find parent terms.

May be this will help you..


Are there any modules where you can import H2Database data into drupal 7 as nodes?

Your best bet is likely to use the Migrate module and a custom php H2 database driver.

This is not easy.

You can follow this to get php working with PDO and Java H2. http://www.webdevelopersdiary.com/1/post/2012/07/jamp-an-ultra-portable-php-web-server-and-database-stack-in-java.html

From there you will need to write a class for the migrate module that extends the migrate source class


I found myself a solution for this. Maybe not the perfect way to go, but it worked very well for my needs:

in .theme-file:

function MYTHEME_preprocess_field(&$variables, $hook) {
   $variables['nodenid'] = \Drupal::routeMatch()->getRawParameter('node');
}

and in .twig:

{{ nodenid }}

of course you might want to filter the preprocess hook to only add this variable to a specific field.


The answer is yes, you should break and indent.

For the more details, including exceptions to this rule, see the official Drupal coding standards on line length and wrapping and indenting.

A handy tool to check whether your source code follow the official Drupal codings standards is Coder.  It is also available as SaaS, as part of PAreview.


That error comes from file_managed_file_save_upload() (around line 638 of the core file.module file).

Just before that error is a call to watchdog() with a much more descriptive error message:

  The upload directory %directory for the file field !name could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.

So it looks like it might be a permissions issue (does your web server own the sites/default/files folder?)

In case you haven't come across it before you can see you "Recent log messages" at http://mysite.com/admin/reports/dblog, it's often the best place to look when the front-end messages are unclear.


Target different database for a single query?

From the comments above such as from @Clive, I do this alll the time:

$count_query = Database::getConnection('default', 'dew_remote_sources')
               ->select('survey', 's');
$count_query->addExpression('COUNT(DISTINCT(survey_number))', 'cnt');

For this to work you need to have various databases defined in your $databases value of settings.php (or you can add additional $databases[key] values to top of your module sometimes, or create such a connection on-the-fly using:

Database::addConnectionInfo('for_migration', 'default', array(
  'driver' => 'mysql',
  'database' => 'migration_database',
  'username' => 'username',
  'password' => 'password',
  'host' => 'localhost',
  'prefix' => '',
));

You see this pattern alot in the Migrate documentation pages, migrate examples and 3rd party modules that have implemented migrations. Because you are literally moving content from DatabaseX to DatabaseY alot and switching around with db_set_active can easily lead to confusion in such cases with the Object Oriented nature of the Migrate module.


Getting the base drupal dir in JavaScript

You should use Drupal.settings.basePath in your Javascript.


Maximum upload size for file is not working

In Drupal 7 you can achieve by using .htaccess

In your .htaccess file:

php_value post_max_size 8M
php_value upload_max_filesize 8M

Check this link for more information


Can't get the authenticated user cookie session to be used when creating a new node via Services 3 endpoint

Solved it.

I should've had checked Session authentication at admin/structure/services/list/MYENDPOINT/edit


Yes, it is possible. You can create a MY_MODULE.install file, add a HOOK_update() where you can call theme_enable and variable_set() to set it as the default theme.

Here is an example:

/**
 * Enable my_new_theme and set as default.
 */
function MY_MODULE_update_7001() {
  $themes_to_enable = ['my_new_theme'];
  theme_enable($themes_to_enable);

  // Set the theme as default.
  variable_set('theme_default', 'my_new_theme');
}


How to add file extensions while creating a field (type file) through the module installer.yaml?

Really, that's a task for the Features module. And even if you decide against fully using Features in the end, you could at least use it locally to export your content type and fields and see in the resulting installer files how the allowed file extensions needs to be defined in your own module then. As Features exports its config into ready-made modules. But going for fully using Features also will enable you to constantly sync certain config (content types, fields, image styles etc.) pretty easily across all your multisite instances.

Take one of your multisite instances where you have the content type like you want it to be on all other sites.
Go through Features' UI and create a features module from it (that's called "package", usually that goes under /modules/features/my_package).
Activate the resulting package (module) on all other instances.

Leaving the Features module and your package module activated on all instances now allows you to sync all following changes to your content type by a certain set of commands:

# In the site_foo instance export changes into its package module.
drush -y features:export my_package -l site_foo

# In the site_bar instance import the changes.
drush -y features:import:all --bundle my_bundle -l site_bar

# In the end export config as usual.
drush -y config:export -l site_foo
drush -y config:export -l site_bar

To have a file field install sample yaml:

langcode: en
status: true
dependencies:
  config:
    - field.storage.paragraph.field_dlbox_files
    - paragraphs.paragraphs_type.dlbox
  module:
    - file
id: paragraph.dlbox.field_dlbox_files
field_name: field_dlbox_files
entity_type: paragraph
bundle: dlbox
label: Files
description: ''
required: false
translatable: true
default_value: {  }
default_value_callback: ''
settings:
  file_directory: paragraphs/dlboxfiles
  file_extensions: 'pdf doc docx'
  max_filesize: ''
  description_field: true
  handler: 'default:file'
  handler_settings: {  }
field_type: file


There are a few questions here:

What was the timeline of events for the 6.30 release of core and Pressflow?

Core security release on January 15th, 2014 which had been in the works for a few days beforehand and the Pressflow maintainers are welcome to participate in that process to help them review the patch and be able to apply it quickly
January 15th, 2014: Some commits and pull request for Pressflow 6 to incorporate that change
January 21: a merge commit merging in that pull request and probably making the tag

Why isn't there news about Pressflow 6?

Well, it depends on where you want to go to get news and what your expectation is. Drupal 6 and Pressflow 6 are pretty slow in terms of news. They are stable except for these security updates. I think it's reasonable that the promotion/updates about it are minimal beyond what is necessary for development. If you want to know what's going on (including the sate of the last release) check the issues and pull requests. And if you went there on January 15th you'd see a pull request that you could try out to get the security update and help in the process of releasing the next version by providing a review.

Will there be timely updates moving forward?

Peter Wolanin (and Gabor Hojtsy, I'm told) are now able to commit changes to the Pressflow repository on github. It seems likely that they are interested in Pressflow because many of the users of Pressflow are clients of Acquias. Peter and Gabor are both Security Team members (and Gabor a D6 maintainer) who stay aware of the core security releases. So, I think it's safe to say that updates will flow more quickly in the future.


How to add Drupal Commerce to an existing Drupal site?

Option 1: Instructions from the community documentation
You saw the available community documentation about Drupal commerce, where it says (bold markup added here):

If you're installing Drupal Commerce on an existing Drupal site or on a new Drupal site without using Commerce Kickstart, you first need to install the latest packaged release of the following modules: ...

From my quote here, it sounds to me that it "has to be possible" to add Drupal commerce into an existing site.
I wonder however if it'd help to get your error resolved by taking into account this part of the community docu page:

Installing Drupal Commerce modules
When turning on the sub-modules of Commerce, you will notice that some modules are dependent on other modules. You may wish to turn them on one at a time so as to pinpoint any error messages. This is the order to satisfy dependencies:

Commerce and Commerce UI
Customer and Customer UI
Price
Line Item and Line Item UI
Order and Order UI
Checkout, Payment, Product
Product Reference
Cart and Product Pricing
Tax
Product UI
Tax UI
Payment UI

More specific: are you using all these modules? If not, could your error be caused by some dependency as mentioned in the quote above? Alse, does your error remain if you (temporarely) install/enable the modules in the list above that you don't use yet.
If you have all those modules enabled, what happens if (a) you disable them all and (b) re-enable them one at a time (as in the quote above also). It might help to pinpoint the real reason for your error message ...
Option 2: Use the Commerce Repair module
Other thoughts / approaches / attempts:

look at issue # 2312841, especially comment # 9 in it, and the suggested "Commerce Repair" module. Does this help to get your error resolved?

Could it be that you're experiencing the bug as described in the answer to Error When Create Drupal Commerce Product Display ? It refers to the same "Commerce Repair" module, a module that is "looking for a New maintainer", used in over 1.000 sites. To me it appears as your best possible alternative to consider, Unless you want to start from a fresh install.


"The service 'serializer' has a dependency on a non-existent service 'entity.manager'"

After @leymannx and @Kevin tips I could fix my problem, I will leave step by step what I have done, hope help anyone else :)

Set my sites do Drupal 8 again
Search inside my modules folder if any module use "entity.manager"
Update those modules according module page
Update D8 to D9 with composer
Run update.php (this give couple more errors about compatibility in some modules)
Update those modules

I have a couple of custom modules and custom theme, in those I replace

core: ^8.8

with

core_version_requirement: ^8.8 || ^9

Also have couple more contrib modules with the same problem, so I created a patch for those modules.
After all that could run update.php and everything works as expected.


You can maybe try something like this:

function phptemplate_preprocess_node(&$vars, $hook) {
    $language = $vars['language']->language;
    $vars['template_file'] = 'page-'. $language;
}


Programmatically executing a node search

You can achieve that with the search plugin used by the search page entity with the node_search id.

use Drupal\search\Entity\SearchPage;

// Default is the node_search page.
$id = \Drupal::service('search.search_page_repository')->getDefaultSearchPage();
$defaultSearchPage = SearchPage::load($id);
$searchPlugin = $defaultSearchPage->getPlugin();
$searchPlugin->setSearch($keywords, $parameters, $arguments);
$searchPlugin->buildResults(); // $searchPlugin->execute() works too if you want raw results


Create configuration storage programmattically for list_string

I finish by find what was the problem. When I read the config file, my allowed value are of format:

[
  [
    'value' => 'anchor',
    'label' => 'Anchor'
  ],
  [
    'value' => 'internal',
    'label' => 'Internal'
  ],
  [
    'value' => 'external',
    'label' => 'External'
  ]
]

But the FieldStorageConfig wait a format:

[
  'anchor' => 'Anchor',
  'internal' => 'Internal',
  'external' => 'External'
]

So I add a transformation before to save my new field:

$field_storage_link = \Drupal::service('config.storage.sync')->read('field.storage.paragraph.field_types_link');

$allowed_values_link = [];

foreach($field_storage_link['settings']['allowed_values'] as $value) {
  $allowed_values_link[$value['value']] = $value['label'];
}

$field_storage_link['settings']['allowed_values'] = $allowed_values_link;

\Drupal::entityTypeManager()->getStorage('field_storage_config')
      ->create($field_storage_link)
      ->save();

$field_type_link = \Drupal::service('config.storage.sync')->read('field.field.paragraph.link_tdm.field_types_link');

\Drupal::entityTypeManager()->getStorage('field_config')->create($field_type_link)->save();

It works properly.


should I use str_replace() or is there a better drupal way for that?

You can either create your own tokens in a custom module or use strtr (it's easier for multiple search and replace operations than str_replace).

To see how to create custom tokens and integrate with token module see token_example module in Examples.


Did these links not help:

https://stackoverflow.com/questions/18349048/ckeditor-strips-span-and-style-attributes

"If you are using the CKeditor module then there is an option in Advanced Options that is also mentioned in the module homepage where you should set"

or:
Prevent WYSIWYG+CKEditor from stripping html classes
"There is an issue with CKEditor 4.1+, which has a feature called Automatic Content Filter (ACF) that will automatically strip attributes not defined for the editor"


Chosen Module working on one  but not other selects

Set above code in theme.libraries.yml and it worked .

  dependencies:
    - core/jquery
    - core/drupal
    - core/jquery.once


Product variations are causing duplicates to show up in filter results

No, that's not possible, the delta=0 will remove duplicates by restricting to the first product in the product reference field. It won't apply selectively to different attributes on that referenced product.

A better option may be to use the colour filter only, then on the product display node itself, add the value to select the size in the add to cart form.

That way, customers can filter by colour, then select the size they want when viewing the product detail.


How to Group fields, and duplicate them?

You can also go for the Multifield module. More details from its project page:

  This project seeks to provide a true compound field solution for Drupal 7. As much as I love Field collection, it still has to save actual entities, and can cause performance problems due to having to load all the referenced field collection entities on node, or parent entity load.

How to use multifield check listed links :

Video demo Demo
How Creating multiple value field groups .


Too many passes with Drupal 7 test framework

Each assert()ion you have in your test code will result in a pass, fail or even an exception.  The uncaught exceptions are bad fails.

If you're running your tests with scripts/run-tests.sh, then use the --verbose flag and you'll be able to see the result of each assertion and any associated error/s.


Can I add external js and css via module info files?

External JS/CSS files can't be specified in the info file at all. You need to add them via hooks, typically I use THEMENAME_preprocess_page() for things that need to be included on all pages, or you can use drupal_add_js() in your .module file.

And you can refer to this page. Here you can see how many ways you can add script/css files.


Changing proxy settings and making them effective

Summary answer to your questions:

What operations exactly do drush dl, pm-update, l10n-update, and the UI equivalents use? Are there differences that might cause one to work and others not?

**
drush dl: donwload a module or theme
pm-update: update Core
l10n-update: update translation
**

Do both the D7 and the D8 formats in settings.php work?

No there are Some differences between D7 and D8

What is the difference between using settings.php and the variables in the database?

In Drupal 7 there is not any different. The settings store in DB. But in Drupal 8 None on Setting Configuration store in Database So there is no way to change them via DB

How do the database variables get updated? Does the fact of changing them in settings.php also update the database?

Yes, When you changed a config in settings.php  the equivalence variable in database got updated but in Drupal 8 There is no config or variable in DB to store settins.pp configuration.

you can get settings in Drupal 8 by Settings::get(YOUR_CONFING_NAME).


How to input internal CSS to content items with CKeditor

If you are using Filter HTML go to:

/admin/config/content/formats/filtered_html

add the <style> tag to the limit allowed html tags

If the above does not do it, depending on which one you are using (filter or full html) You need to go to

/admin/config/content/ckeditor/edit/Advanced (for Filter HTML)

/admin/config/content/ckeditor/edit/Full (for Full HTML)

Then under Advanced Content Filter, select disabled.


Can't edit settings.php in Drupal 7 - Premission Denied - Can't Write to File via Cpanel File Manager

As others have mentioned, you must set the permissions on the /sites/default folder. The default permissions are set to 0555, set them to 0755 for editing. Don't forget to restore the default values afterwards!


How to add a link to the CSV download to my module page, for a report created with Forena?

For any report that you create (using Forena), just add .csv as an extention to the report (output) URL. That contains the CSV equivalent of that report.

As a sample, consider the sample report located at /reports/sample.states (in your own site, one of the samples shipped with Forena). Change the URL to /reports/sample.states.csv (= just add .csv to it) to get the same report in .csv format.

If you'd adding such .csv to the URL of the Simple Table of States in the demo site, the result is like so ...

Same technique applies for other supported extensions (export formats), such as adding .html, .xls (MS Excell), .pdf or .doc (MS Word).

By the way, all data blocks are accessible directly via their url also, provided you have permission to access that block. Here are a few samples of that, for the sample report located at /reports/sample.states:

in XML format (= demo with anonymous access).
in JSON format (= demo with anonymous access).
in XML format (= demo without anonymous access).
in JSON format (= demo without anonymous access).


Integer field with unix timestamp convert to readable date in views

First you should define a suitable format- Do this in the administrative GUI:

Navigate to: Administration » Configuration » Regional and language » Date and Time
Click the tab "Formats" and click on link "Add format".
Create a new format. You use the same string as you would pass to the PHP date function, i.e.: M jS, Y. Save it.
Click the tab "Types". Click on link "Add date type".
Select the newly created format from the menu, and name it: dateonly, and save it by clicking on "Add date type".

You now have a type of date format named dateonly defined you can use anywhere on your site there is a date field to be displayed without the hour and minutes part.

To format the date in your View, you may should Drupal format_date function with 'dateonly' passed as the type of format to use (second argument). To output this in your view you may have the following in your view-view-field--fieldname.tpl.php:

<?php
$nicedate = format_date($output, 'dateonly');
print $nicedate;
?>

IMHO, there is a big advantage in first defining a standard type of date format and giving it a name.  This ensures that dates are displayed consistently throughot the site.

However, if you can't be bothered to first define the dateonly type of format, you can use custom as your second argument to format_date and then, as your third argument, pass a string that can be passed on to the PHP date function:

<?php
$nicedate = format_date($output, 'custom', 'M jS, Y');
print $nicedate;
?>


How to Add Previous/Next Navigation on Teaser based on Views?

I think you're looking for a Pager, there are standard paging options in Views or you might need something more complicated like Pagerer or perhaps Views Simple Pager


Copy blocks from one drupal installation to another

Blocks are considered content, like nodes are. So basically you want to migrate content? You could work with Migrate or Block Export Import.


Drupal installed with Drush doesn't display home page

I think your true problem is that clean URLs aren't working (as evidenced by index.php?q=user does work).  It may also suggest another Apache configuration problem.

Make sure your httpd.conf is configured to read .htaccess

AccessFileName .htaccess

I don't know the last time I saw a system that didn't have this (sometimes was different on older WAMP installs).

Then, browse to http://example.com/index.php?q=admin/config/search/clean-urls

Set clean URLs if you can.

If you can't set clean URLs, then you have an Apache configuration problem.

If browsing directly to http://example.com/index.php works, but http://example.com/ doesn't, then I suspect your configuration doesn't allow Apache overrides for that DOCROOT.  That would also explain why clean URLs aren't working.  The general option you need to set is AllowOverride.  My general setup looks like:

<VirtualHost *:80>
  ServerName example.com
  ServerAlias *.example.com

  DocumentRoot /var/www/example/docroot

  <Directory /var/www/example/docroot>
    Options -MultiViews
    AllowOverride All
  </Directory>
</VirtualHost>

The AllowOverride line will

disable index listings for directories
allow the htaccess to reset the index order to use index.php first
override other options that may be set in your httpd.conf


How to create username with firstname and lastname using feeds and tamper?

Depending on your source data, you want to use the "Rewrite" plugin of Tamper to combine the fields. More described in: https://drupal.org/node/1973776


How can I stop Drupal from sending e-mails of any kind?

As another, quicker, option, you can add the following lines to your site's settings.php file (if you have the Devel module installed, which you certainly should if this is a dev site).

$conf['mail_system'] = array(
  'default-system' => 'DevelMailLog',
);

That will replace the default mail system with Devel's development mail system, which writes emails to a file log rather than sending them to a recipient. By default the files are stored in temporary://devel-mails, but you can alter that by setting another variable, eg.

$conf['devel_debug_mail_directory'] = '/path/to/folder';


Can you give more details ?

For example for an aggregator RSS :

In your test.routing.yml :

test.rss:
  path: '/rss'
  defaults:
    _title: 'rss'
    _controller: '\Drupal\test\Controller\RssController::content'
  requirements:
    _access_test: 'test'

And in your controller :

<?php

namespace Drupal\test\Controller;

use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\Response;

class RssController extends ControllerBase
{
    public function content()
    {
        $response = new Response();
        $response->setContent('<?xml> My flux </xml>');
       // kint($response);
        return $response;

    }

}

  You need the HttpFoundation\Response component.


I figured it out. Even though I closed the command line window, I never cleared the drush cache. Running "$ drush cache-clear drush" fixed the issue.


Have you tried doing this through the Views UI? You can use the Rewrite results as per the image below. In the rewrite output you should be able to add your font-awesome div.
You might need to use the output this field as a link option to make it clickable (you can use the replacement token of your link field) but that dependends on the field, so I am not sure if it is required.

Source: https://www.drupal.org/node/1578524


Mass Node Update (e.g., disable comments for all nodes of a given content type)

There's a module called Views Bulk Operations.

I never tried to do it, but I think you can write your own operations for this module pretty easily.


Limiting Views diplays to a role — two displays are stuck together

When you set the persmissions for a display, the following popup box shows up

below the title, there's an option that allows you to change the access restrictions to "All displays" or "This page(override)"


Use another token value if the first one is empty

Seems like there was Token Logic module, once upon a time, and it got abandoned: https://drupal.org/node/354039

You can try and wrote your own token to fill that niche, or contact original's authors.


How do I include coffeescript and sass compilation steps into managing Aegir platforms?

We do our own automation of the drush provision and drush hosting commands that Aegir does, plus we add a couple of extra steps to do the sass and coffeescript compilations before migrating a site to a new platform automatically.

So we still have the benefits of the Aegir front end but also augment the power of the drush backend with our required extra steps. Plus, by tying it in with Git tags we make generating new Aegir platforms an integral part of the site-development workflow.

It was quite a big step to augment our reliance upon Aegir with automating the running of drush provision steps from our own Fabric tasks. However, at the cost of one or two limitations, our solution is giving us much more flexibility in the resulting automated workflow.

These are the components:

A Git post-receive hook that triggers a Jenkins job
A Jenkins job that runs the Fabric tasks
Fabric tasks that drive drush provision and drush hostmaster steps
A YAML configuration file.
A drush .make template file

The solution took quite a bit of effort initially but should be straightforward to copy.
It is a bit lengthy to describe in detail here but a detailed description can be seen here which should give you enough information to tailor our solution to your similar needs using the Fabric program here on GitHub


Change Form Single Select element to Multi Select for JS enabled users

Looks like someone made a module for this: http://drupal.org/project/chosen, maybe he can provides some support for views.

Some details from the module's project page:

  Chosen uses the Chosen jQuery plugin to make your <select> elements more user-friendly.


Avoid username output as a class of an article tag

I think you can blame Omega for that one, in omega_alpha_preprocess_node() you'll find this:

$vars['attributes_array']['class'][] = drupal_html_class('author-' . $vars['node']->name);

I think you've got two options:

Remove that preprocess function altogether, using hook_theme_registry_alter(), and duplicate it into MYTHEME_alpha_preprocess_node(), minus the offending line.
Implement MYTHEME_alpha_preprocess_node(), search through the $vars['attributes_array']['class'] array, and remove it from there.


What better way to add new features on a project already in production?

I think you are looking for what KiamLalluno is answered in the comments.
I would just like to supply it by saying
These module have been helpfull for me when I was in your situation

Deploy Module

GO live checklist

Drush

Feeds Module

Features Module

Enviroment Indicator

Hope it helps


Edit tab available to anonymous user on some but not all pages?

We finally found out what was happening.  Drupal was configured so that when an authorized user account was deleted, the owner for all their content was changed to Anonymous.  Modified the setup so that the owner of all "orphaned" pages is set to Admin.


AJAX checkboxes in Views to change node values

If you can "do it easily enough by creating a table and manually filling the cells," you can easily leverage Views' global custom text field along with rewriting to create whatever you need.  For example, create a view with whatever you want in the fields, just make sure one of them is nid. Then add a global custom text field after all of them and craft up whatever AJAX divs or spans or ids etc you need to call your functions, substituting the nid token where necessary in the markup.  Make sure that javascript is including on your page and you should be on your way.


How to display taxonomy term reference field as a rendered entity?

The function taxonomy_term_view is for displaying a taxonomy term as a rendered entity. If not specified explicitly with an extra parameter, it uses the view mode full, which displays all fields, one after the other. But you can adapt that in the admin backend, and also define other view modes. So in your case, the code would be like:

$term = taxonomy_term_load($entity->field_term_reference);
$term_view = taxonomy_term_view($term);

This generates a Drupal render array. In case you want to use this in a theme context, add one more line:

drupal_render($term_view);


How to add a placeholder field to Entity Forms

You should use  Field placeholder
module.

  Field Placeholder module gives support to add HTML5 placeholder
  attribute to field widget forms.

  By default, this module integrates text, number and mail modules, but
  any other widget type can be added through
  hook_field_placeholder_info().

  Field placeholder adds a new option in field settings page to enter
  the placeholder value, which is included automatically when the widget
  is rendered.


Automatically shorten URLs on website with other domain name that I own

Found this module, Yourls, that works exactly like I described above.


Drupal way of storing data related to a node

Create a custom content entity with entity_reference fields relating each "email" entity to a node and a user.
The information you're saving is neither part of the node's content nor part of the node's metadata. It is metadata about an email that has been sent. Since the email records aren't related to any particular revision of the node, you want the email records to remain even if the node is reverted to a previous revision. So you shouldn't put the email records in a node field of any kind.
Creating a custom content entity is more useful than creating a custom table, because - as you have pointed out - you can make use of the built-in Entity API, which allows you to add field bundles, but also makes it easy to relate your records to node and user entities, and optionally do cleanup if those users or nodes are deleted. If you generate your custom entity using Drupal Console then it will work out of the box with views.


It happened to me also.

After hours of trying, I removed the records in the database:

VIEWS_VIEW > remove the view (remember the 'vid' value of the view)
VIEWS_DISPLAY > remove all the displays with that vid


Is it possible to get node alias during hook_node_insert()

A couple of options there, if drupal_lookup_path isn't returning the alias yet.

Get the alias using pathauto_create_alias without the _pathauto_set_alias save part ( update: can use the 'return' option)
Add the node id to a cron queue defined with hook_cron_queue_info and get/process the alias in a worker_callback a little later.


Field validation error on nodereference field during D6 to D7 migration

It doesn't look like there's support for migrating nodereference fields in D2D migrate. You'll need to write a custom migrate class. In general, I haven't had much luck with the D2D GUI; it's only useful for super-simple migrations.

Writing a custom migration class (especially if you're using migrate_d2d) is really quite easy to do and a worthy exercise. Take a look at the migrate_d2d_example code. The nice thing is that migrate keeps track of the mapping between the old NIDs and the new so that you need only write one line of code in your constructor to ensure the reference field has the right value.

See: Migrate D6 node reference to D7 entityreference