{% set url = file_url(content.field_books_theme_pic['#items'].entity.uri.value) %}

"file_url" needs a URI to convert.

Another options is to go to that fields display settings and change the display option from image to "URL to image". Then you can just render the field value:

{{ content.field_books_theme_pic }}

If you are working in twig template files, the only thing that changes is context. content.something, fields.something, paragraph.something...

If this is a field of type image, what you are looking for is the array key "URI".

I always use {{ dump(whatever | keys) }}. For your case try pasting this into your twig file:

{{ dump(fields.field_books_theme_pic | keys) }}

and see if you can trace down to the uri key (you must have devel enabled and the usual config in local files). If you cant find the uri key in your current setup via the twig template file, then you know you probably need to do some preprocessing to make it available to your template.

Personally, if I feel I need granular markup I would go after the field template itself: "field--field-name.html.twig" for example, and control my markup there. That way, whether I use that field in a view, or a content type, or anywhere, it will always render the same. Plus all I have to do then is print that field in other template files to get the same results.


Trouble getting a drupal 7 view template to render for a machine readable block

Click on "Theme: Information" under "Advanced" on the right hand side of the View edit page.

All the available template suggestions for the View and its displays are listed in the resulting modal.


how to create a static view page which gets result from a content type?

Looks like you need to look at some of the typical "page layout" modules, such as these ones (excerpts from their project pages):

Display Suite.

... allows you to take full control over how your content is displayed using a drag and drop interface. Arrange your nodes, views, comments, user data etc. the way you want without having to work your way through dozens of template files. A predefined list of layouts (D7 only) is available for even more drag and drop fun!

Panels.

... allows a site administrator to create customized layouts for multiple uses. At its core it is a drag and drop content manager that lets you visually design a layout and place content within that layout. Integration with other systems allows you to create nodes that use this, landing pages that use this, and even override system pages such as taxonomy and the node page so that you can customize the layout of your site with very fine grained permissions.

Not sure if Display Suite will be sufficient for all your needs, but Panels will pretty sure be helpfull. Possibly also with 'mini-panels' added to that.
Be prepared however to invest some time in learning about these amazing modules. A great resource for learning about Panels is the (free) video training about Learn Page manager. Panels uses 'Page manager', which is one of the sub-modules of Chaos tool suite (ctools)).
And after you become familiar with these modules, you may want to consider using Forena to create special (mini?) reports to be shown in (eg) a block on your page. Possibly also using Forena's integration with the BEAN module (another module to add to your list of modules to be reviewed ...). For more details about this integration, refer to Forena's Site Building Guide.


You should use the following code, if you want to avoid outputting something when the overlay is visualized.

if (module_exists('overlay') && path_is_admin($_GET['q'])) {
  // The overlay is visualized.
}

path_is_admin() is used from overlay_init(), which contains the following code.

  // If this page shouldn't be rendered inside the overlay, redirect to the
  // parent.
  elseif (!path_is_admin($current_path)) {
    overlay_close_dialog($current_path, array('query' => drupal_get_query_parameters(NULL, array('q', 'render'))));
  }


How to generate feature containing date types and date format?

There is another option: hardcode the date format in the preprocessor. And print it in the node you are using. In this way it is in your code base and you do not need to have it in your feature.


Allow users to email a file and create a new post

You have two options. The less efficient (but easier) way is to keep it in Drupal

The more efficient (and more difficult) way is to do a bit of this outside Drupal and hack at your MTA and/or use something like Amavis to do it.

Since you're on a Drupal site, I'll give you a quick rundown of how I might do this if I had to keep it in Drupal.

What you need to do is have the random generated email checked by Drupal regularly.

Create a module that periodically (via cron) logs in to each user's associated email address (these should be IMAP accounts!).  If it finds a message that has the right subject line to trigger a new content post, then download the attachment and save it to the file system.

Keep in mind, this could be a crazy thing to do if you're dealing with a lot of users.  The better option would be to have the emails processed outside of Drupal, and then use something else to trigger the Drupal content creation.

No matter which way you go, you're looking at quite a bit of programming. I have never seen a module that does this.


Book navigation - how to customize outline to show progress and enforce serial navigation

The Course module has the facilities needed to implement these features.  With a few code and css tweaks and otherwise standard Drupal content and block configurations I was able to satisfy these requirements to a large degree.

I should have explained in the original post that my site is actually a series of training modules.  I had originally planned to make this a book with the pages being the training modules.  With the Course module I instead created a book for the top level container and then added the courses (using the course content type) to this book.  Inside each course was another book that held the actual content pages.  I forced the user to navigate the pages of the course using the navigation links at the bottom of each page by hiding the outline until they had finished each course.  They could also see their progress by navigating through the courses to see which ones they had completed (with a large green check mark).  This is not a perfect solution but it works.


How to use Ubercart product SKU as a condition in Rules?

This answer does not use Rules, but rather hard-coding inside of the cart template.

As the message should be displayed each time the user is on the /cart page, something like this might work. If page--cart.tpl.php doesn't exist, create it and add ...

$items = uc_cart_get_contents();
foreach($items as $item) {
    if($item->model == 'ABC123') {
        drupal_set_message('Item ABC123 is in the cart');
    }
}


Commerce PayPal commerce_payment_transaction PDOException[23000]

Duplicate entry '' for key 'name': INSERT INTO {users} (uid, created, data)

This is incorrect code, since no name value defined for inserting, so user name is empty and name should be unique - you cann't insert second user with empty name.

Try find this code INSERT INTO {users} (uid, created, data) on your drupal files (modules), if no success, investigate your Rules for custom code.


By Default Drupal front page shows the list of Contents you create, the number of contents you can list is controlled in Site Configuration. To answer you particular scenario would be too much of an answer here, I'd recommend you to read some Beginner Documents or watch some Videos in the net. Good place to Start is Drupal documentation

To displaying content in front page go-to UR-URL/admin/config/system/site-information and change the default front page to node/1 (in your case). This will display static front-page when your created the Basic page.

Be aware this is not the best bet, so, I'd suggest you to explore Drupal bit more before actually starting the site building.


AJAX returns response code 200, and displays error messages in callbacks

Thanks to some brilliant and generous help from @thedotwriter, I believe I have found the cause of this problem and a solution.

In turns out that the root of the redirection to the user profile page, which meant that the AJAX response text was the code of that page, was some PHP code similar to the following, in one of my nodes:

if(!user_is_logged_in()){
   drupal_goto("user");
}

At first, this seemed odd because the node was in no way related to AJAX. To complicate the issue further, if the line was removed and then re-added once the node had  been updated, AJAX worked again... for a few hours.

Looking in the log, I noticed that just before the error returned Cron had run. This made sense - sort of  - because then I found that when I ran Cron manually it never completed but ended up on the user page, which can be explained by the fact that Cron would have evaluated the above code due to the fact that it runs as an anonymous user.

Here my answer falls down a bit because I'm not quite sure how this all affects AJAX. I'm assuming that it's due to caching and/or the fact that part of Cron indexes the site so therefore because Cron was being redirected the index was corrupt/incomplete. I don't have any solid evidence, but it can be backed up by the fact that before the site would only ever get up to being 82% indexed, but without that code it is now 100% indexed. If anyone would like to offer there thoughts on this answer however, please feel free to do as I really would like to confirm 'the missing piece of this puzzle'.

There are a few ways to avoid this issue. One would be to check to see if the script that is accessing the node is cron so that you know not to do any redirects (see here). However, the method I chose was to move this 'functionality' into a rule. I do so for many reasons, but most importantly because it is not recommended to use PHP codes in nodes at all and I think that this incident illustrates why.


How to hide some administer option from all users?

User #1 is special.  This user bypass all access control, so the only way to make sure that no user have access at this level is to disable user #1.  However, disabling user #1 is not a good idea.  At one point, you may need to have access to a special user account that can access all areas in order to fix some serious problem with your site - and in some cases, the all-powerful user #1 is the last resort.

However, you can approach this by creating a second admin user account (name it lesser_admin) and give this user account all the administration rights except Administer users and other rights you want to withhold.  You then stop using user #1 as admin and instead log on as lesser_admin when you (or someone else) want to perform admin tasks.

To make sure, you may give user #1 as very long and impossible to remember password and  write this password down and put in a sealed envelope in a bank vault.  That way, neither you or anyone will have access to the user #1 account.  However, when the day comes when you regret doing this, you can go to the bank vault and retrieve the envelope.


How can I echo a views object ($data->nid) into javascript?

If I understand well your case, you can test if $data indeed is loading your desired data. you can do this with <?php print_r($data); ?> (or if you use Devel module, is best use <?php dsm($data); ?>). if you see the list of values, you also will see the respective keys's names of each value.

If you do not see values, you can load the respective node informatation with $data = <?php node_load($IdNode) ?> where $IdNode is the ID of your node. Remember <?php dsm($data); ?> to see the data of your node.


How do I determine the values to use in the payload for the add to cart method in the Commerce API

I eventually located these using the path https://mydomain.com/jsonapi/product-variations/default.
A call to https://mydomain.com/jsonapi exposes the end-points you can use, based on your product configuration. Mine looked like this:
        "product--default": {
            "href": "http:\/\/mydomain.com\/jsonapi\/products\/default"
        },
        "product-attribute": {
            "href": "http:\/\/mydomain.com\/jsonapi\/product-attributes"
        },
        "product-attribute-value--rate": {
            "href": "http:\/\/mydomain.com\/jsonapi\/product-attribute-values\/rate"
        },
        "product-type": {
            "href": "http:\/\/mydomain.com\/jsonapi\/product-types"
        },
        "product-variation--default": {
            "href": "http:\/\/mydomain.com\/jsonapi\/product-variations\/default"
        },
        "product-variation-type": {
            "href": "http:\/\/mydomain.com\/jsonapi\/product-variation-types"
        }


Hook_enable vs hook_install [granting permissions to user role]

It should work on install. Are you actually uninstalling the module? Disabling and uninstalling is not the same thing in Drupal 7. Uninstall at admin/modules/uninstall, once the module is disabled. You can use drush pm-disable/pm-uninstall module_name.

test.module

function test_permission() {
  return array(
    'test permission' => array(
      'title' => t('Test permission title'),
    ),
  );
}

test.install

function test_install() {
  $test_perm = array('test permission');

  $perms = module_invoke_all('permission');
  // We can find the 'test permission' in $perms.

  $role = user_role_load_by_name('administrator');
  user_role_grant_permissions($role->rid, $test_perm);
}

The above gives administrators the test permission on module install.


I can't go into a lot of details, as I've not used either module for ages (I build all my sites with Context from the word go and I've not picked up responsive on something I haven't built for a while, so I've not had this problem before), but I think you should be able to put something together with Mobile Tools and Spaces.

Spaces

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

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

Mobile Tools

  The Mobile Tools module provides Drupal developers with some tools to
  assist in making adjustments to your site based on the visitor's
  device.

The project page for MT does say it's not ready for production though, which might be a problem - it depends when  it was last updated, as the last commit was this month.

*EDIT

I COMPLETELY FORGOT ABOUT THESE!

Browscap

  Browscap provides an improved version of PHP's get_browser() function.

Browscap block

  Browscap Block adds visibility options to block configuration settings
  to allow you hide or show blocks in mobile devices.

Browscap does depend on your server setup, but if you can use it then the second module gives you extra visibility settings for each block on the block edit page.


drupal commerce conditional checkout panes

It's surely too late for your project... Anyway, you may use Commerce Rules Extra,  it adds the exact features you need :

  Rules conditions : Total product of type quantity comparison : Total
  of products of specified type and with a specified quantity
  Rules actions : Change pane properties : Change visibility, page,
  weight of a pane

Once you installed it, in checkout settings , set your pane as disabled by default and create a new rule

event: Process checkout pane
conditions: Total product of type quantity comparison

Parameter: Order: [commerce_order]
Product Type: YOUR PRODUCT TYPE
Operator: >, Quantity: 0

action : Change pane properties

Parameter: Id of pane to change: YOUR PANE
Enabled: true
move to : checkout


7- OG 'og_users_roles' table doesn't seem to update on Group creation

I fixed that by hooking on node creation and updating the table myself.
I'll let the thread open in case anyone have a better solution.


It's likely that you need to set your news 'body' field's text format to 'Full HTML' instead of 'Filtered HTML'.

For more info on your current setup head to admin/config/content/wysiwyg to see which Text Formats have the WYSIWYG editor applied.


Different approval for different user accounts

I have not used any module that can provide this kind of control.  What you can do is for the  second option create your own form and from backend create the user on form submit after proper validation.


Add custom content to custom layout Panels

You could place the images in a mini panel. Changes to the images would be done in the mini panel and would affect all nodes.

In Panels you can activate the Node view variant and create a panel (with a selection rule for the content type: Stuff). then use your Panel layout and place the mini panel in the column you want the images.

All nodes of the type stuff, should now use your layout with a mini panel holding your images. You can easily change the content of the mini panel and reuse it on other parts of your site.

Hope I understood your problem correct.


How should the view data be defined when adding a custom filter to a field?

You get the error Error: missing group.

You should be able to fix it by adding the group property, like this:

$data['node__contact']['active_contact'] = [
  'title' => t('Active contact filter'),
  'group' => t('Contact'), // Add this line.
  'filter' => [
    // ...
  ],
];


Most of the cases in drupal will have a class called as not-logged-in in the body. Make use of this and write

.not-logged-in .tab-class{
display: none
}

This will hide the registration and login form tabs. It is the easiest way to achieve the need.


Making custom database text fields available for search

You can use

hook_search_info
hook_update_index

To define your own search type and add the required data to the index.


How can i allow users to give different responses to content types other than comments?

You could try any of these modules (with quotes included from their project pages):

Fivestar:

  ... adds a clean, attractive voting widget to nodes and comments and any entity.

Rate:

  ... provides flexible voting widgets for nodes and comments ("The cck model for voting with Drupal").

Vote Up/Down:

  ... allows votes on some Drupal entities and provides the base for implementing votes on other entities.


How to bring custom block theme suggestions into the right hierachy?

What you need is simple array manipulation. Basically split of the original suggestions add the the suggestions and merge the suggestions again.

Some like this should work (untested).

function oeb_theme_suggestions_block_alter(array &$suggestions, array $variables) {
  ...
  $first_sugestions = array_slice($suggestions, 0, 2);
  $last_sugestions = array_slice($suggestions, 0, 2);
  $first_sugestions[] = 'block__' . $blockType . '__' . $bundle;
  $suggestion = array_merge($first_suggestions, $last_suggestions);
}


What are some php cache related modules for drupal 7?

For opcode caching APC, Zend Optimizer, and OpCache are totally transparent to the application.  If you have them installed and enabled, Drupal will use them whether you like it or not.  There are some configuration tricks you can do to use them better, but this is really system specific.  For example, to help save memory, some users will filter out .admin.inc files from APC so they never get cached.

I am using OpCache on my PHP 5.5 servers.

To confuse matters, APC and Zend provide user caches which can be used as alternate cache backends to replace and/or supplement the database cache mechanism.  I would not recommend APC for this.  Memcache and Redis are the go-to solutions for these.  MongoDB can also be used, too.

My PHP 5.5 servers also have APCu installed just in case there is anything that may be using it.  Last time I checked, the Performance module would use APC user cache for stats.


Exclude nodes referenced from another content type's node

In content type B (basic page), I named the refence field field_ref_article
1) Create view of content type A (article)
2) Add relationship "Content Using [field_name]"

3) Leave require unchecked

4) Add FILTER CRITERIA of [field_name]

5) Set relationship to [field_name] and operator is empty (null)

Overall should look like this


Change Default Value of XML sitemap enable/disable flag

You seem to be asking 2 things.

The default inclusion status for nodes is set on the node type's edit page (admin/structure/types/manage/MYTYPE). The XMLSiteMap settings are stored as xmlsitemap_settings_node_MYTYPE in   keyed array (status key) if you'd rather drush vset the setting.

As for bulk inclusion, the xmlsitemap table stores all items index for inclusion/exclusion in your site map. A drush sqlq command can bulk update these settings.

#Set all XMLSiteMap node entries as included
drush sqlq 'UPDATE xmlsitemap SET `status` = 1 WHERE `type` = "node"'
drush xmlsitemap-rebuild


What is the risk of using number in image style preset name (imagecache in D6)

I have never seen the term "alphanumeric" refer to anything other than a combination of letters and numbers.

Since the style name gets used in the URL, the restriction to "Use only lowercase alphanumeric characters, underscores (_), and hyphens (-)" likely has to do with avoiding any escaping issues with URLs and for portability across filesystems that may not support the full range of characters in filepaths.

Personally, I have never (nor have my clients) run into any issues with using numbers in image sytles, though as a best practice I lean towards using descriptive names for use, rather than size, in the sytle name.  So, I will try to use "thumbnail_square" instead of "thumbnail_90x90", in case I end up changing the size at some point.


Pages in Drupal are largely composed of content types with fields attached to them, and sometimes, blocks (which can be created from Views).

You do not need to create custom routes and controllers for them, the core Node module takes care of this for you.

The core Path module will allow for custom aliases, and Pathauto will let you create automatic aliasing rules.

It would be a fairly rare thing to need to implement a route and controller just to display basic content in Drupal. 99% of the time it can be achieved with content types, Views, or panels.

You will probably want to review some of the material on Drupalize.me to learn Drupal content management.


Assuming your SQLite dump is complete, your best bet is probably to try and properly convert it to MySQL format and then restore to an empty database.

There's a good thread over at stackoverflow with information on SQLite to MySQL conversion: https://stackoverflow.com/questions/18671/quick-easy-way-to-migrate-sqlite3-to-mysql

I would paste a solution from there here, but as it's a sibling site, probably ok to just pop over and try some of those solutions.

Good luck


How to remove a file from a "Choose file..." dialog?

I guess you are refering Drupal 7, as Drupal 8 has by default that option.

D7

What Drupal (D7) Provides,

Step-1: File/Image uploading option in node.

Step-2: Example Case: Suppose I uploaded wrong image instead of IMG_0065.jpg, I want to upload IMG_0068.jpg.

Step-3: Just Re-upload the file on the previous file, the new file will be loaded and the previous file will be removed.

Step-4: Image file uploaded and now als0 you can remove as Remove Button is there.

So, In short you want REMOVE button at Step-2, But the default file uploaded do not have that option. That is the fact. But if you manage, Drupal provide the option of replacing, which is quite similar option of removing.

Solution using other file uploader Module

Now, instead of using Drupal's Default File uploaded feature, you can download new module called, Drag & Drop Upload.  Installation: For this also like default file uploaded, you have to create add a field in content type and in widget option you need to choose Drag and drop instead of file.

Now, following is the image of drag and drop in action, now you can see after just browsing, you can see X mark besides file. Which is the the Step-2 option which was missing in above default setup.

Further Reading: On this link there is a detailed comparison of all type of File Uploading Modules, you can refer more from there:
Multiple file upload for node

D8

By default Drupal 8 has this option as shown in following image.


how to change taxonomy term fields before being created first time

In Drupal 7, you can achieve this by using the following taxonomy APIs

hook_taxonomy_term_insert : Act on taxonomy terms when inserted.
taxonomy_term_load : To load the taxonomy by using term ID
taxonomy_term_save : To update the taxonomy by using term ID

/**
 * Implementing hook_taxonomy_term_insert
 */
function hook_taxonomy_term_insert($term) {
  $vid = 2; //User your vid
  if (is_object($term) && $term->vid == $vid && isset($term->parent)) {
    //get parent tid using $term->parent array
    foreach ($term->parent as $ptid) {//check image for each parent, if image exist assign and exit
      if ($ptid > 0) {//except root
        //get parent image WHERE field_data_field_image_vocab_image is the parent image field
        $pfid = db_select('field_data_field_image_vocab_image', 'pimg')//change field_data_field_image_vocab_image with your field name
            ->condition('pimg.entity_id', $ptid, '=')
            ->fields('pimg', array('field_image_vocab_image_fid'))//change field_image_vocab_image_fid with your image fid name
            ->execute()->fetchField();
        $update_taxo = taxonomy_term_load($term->tid); //load created taxonomy
        if ($pfid > 0 && empty($update_taxo->field_image_vocab_image)) {//image exist for this parent $ptid and image is not assigned yet
          $update_taxo->field_image_vocab_image[LANGUAGE_NONE][0]['fid'] = $pfid;
          taxonomy_term_save($update_taxo); //update taxonomy after assigning image
          break; //break after saving the image
        }
      }
    }
  }
}

Note :

Change the field names
Go through the comments for explanation.


You are probably a bit confused.

Variables are only available in specific templates. So the value of a field which is attached to an entity (like a content type) is only available in the template for that entity.

To make the body class field value available in a different template you need to

make a preprocess function for the template.
fetch the entity that has the field
expose it to the template.

For you it could look something like this.

function theme_name_preprocess_page(&$variables) {
   // Define {{ body_class }}  in the template.
  if (!empty($variables['node']) && !empty($variables['node']->field_body_class)) {
    $variables['body_class'] = $variables['node']->field_body_class->value;
  }
}


Webform Select Element Optgroup / hierarchy

@jrockowitz suggested I look here;
drupal.org/project/webform/issues/2783937

This solved my question. Thank you jrockowitz.


How do I create a bundle under my custom content entity type in Drupal 8?

Yes, you declare a config entity type to store the bundle definitions. For example that for Custom Block Types (bundle of block_content):

Drupal\block_content\Entity\BlockContentType

namespace Drupal\block_content\Entity;

use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
use Drupal\block_content\BlockContentTypeInterface;

/**
 * Defines the custom block type entity.
 *
 * @ConfigEntityType(
 *   id = "block_content_type",
 *   label = @Translation("Custom block type"),
 *   handlers = {
 *     "form" = {
 *       "default" = "Drupal\block_content\BlockContentTypeForm",
 *       "add" = "Drupal\block_content\BlockContentTypeForm",
 *       "edit" = "Drupal\block_content\BlockContentTypeForm",
 *       "delete" = "Drupal\block_content\Form\BlockContentTypeDeleteForm"
 *     },
 *     "list_builder" = "Drupal\block_content\BlockContentTypeListBuilder"
 *   },
 *   admin_permission = "administer blocks",
 *   config_prefix = "type",
 *   bundle_of = "block_content",
 *   entity_keys = {
 *     "id" = "id",
 *     "label" = "label"
 *   },
 *   links = {
 *     "delete-form" = "/admin/structure/block/block-content/manage/{block_content_type}/delete",
 *     "edit-form" = "/admin/structure/block/block-content/manage/{block_content_type}",
 *     "collection" = "/admin/structure/block/block-content/types",
 *   },
 *     ...
 * )
 */
class BlockContentType extends ConfigEntityBundleBase implements BlockContentTypeInterface {

Which is then referenced in the content entity type:

Drupal\block_content\Entity\BlockContent

*   bundle_entity_type = "block_content_type",

If you use Drupal Console to generate a custom content entity type and you say yes to the question if you want bundles, this config entity type is set up for you automatically.


How to select a custom block and region according to a view

When dealing with a page view you can use the views_get_page_view() function, to get the view object for the current page, like this:

/**
 * Variable preprocessor for the block template.
 */
function MYTHEME_preprocess_block(&$variables) {
  // If we are on a views page display.
  if ($view = views_get_page_view()) {
    // If we are on the MYVIEW view.
    if ($view->name == 'MYVIEW') {
      // Add the view object to the variables for use in the template (if you need it).
      $variables['view'] = $view;

      // Use a custom block template for this specific display (if required).
      $variables['theme_hook_suggestions'][] =  "block__{$view->name}";

      // Add your block customisations for this specific view (if required).

      // If we are also on the MYDISPLAY display of MYVIEW.
      if ($view->current_display == 'MYDISPLAY') {
        // Add your block customisations for this specific view and display here (if required).

        // Use a custom block template for this specific display (if required).
        $variables['theme_hook_suggestions'][] =  "block__{$view->name}__{$view->current_display}";
      }
    }
  }
}


There is a combination of modules listed on the site HOW TO INSTALL & SETUP VIEWS SLIDESHOW MODULE ON DRUPAL7? that will allow you to do that.

Effectively the modules work together to give you:

A content type where you can store your banner and the URL
A view that has some nice JQuery slideshow options for displaying rotating banners that will link to their included URL


/**
 *  Implements hook_form_BASE_FORM_ID_alter.
 */
function mymodule_form_node_form_alter(&$form, &$form_state, $form_id) {
  $form['#attached']['js'][] = drupal_get_path('module', 'mymodule') . '/js/custom.js';
}

In your case would be:

/**
 *  Implements hook_form_BASE_FORM_ID_alter.
 */
function add_js_form_node_form_alter(&$form, &$form_state, $form_id) {
  $form['#attached']['js'][] = drupal_get_path('module', 'add_js') . '/js/custom.js';
}

Note: This will add the JS to all of your content types node edit pages.

If you need to target a specific content type, all you gotta do is add an if statement, see:

How can I find the form ID of a form?

/**
*  Implements hook_form_BASE_FORM_ID_alter.
*/
  function add_js_form_node_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'my_form_id') {
      $form['#attached']['js'][] = drupal_get_path('module', 'add_js') . '/js/custom.js';
    }
  }

and I believe you could alternatively do this, put the my_form_id directly in the hook:

/**
*  Implements hook_form_BASE_FORM_ID_alter.
*/
  function add_js_form_my_form_id_alter(&$form, &$form_state, $form_id) {

      $form['#attached']['js'][] = drupal_get_path('module', 'add_js') . '/js/custom.js';

  }


How to enter incomplete or partial date with date module? (Day-Month-Year / Month-Year / Year)

It is not possible with one date field. But you can achieve it by adding two different date fields with different configuration i.e.:

Date, Month and Year for Date1 field.
only Month and Year for Date2 field.


Content type export with drupal console not working

Drupal console will create a new module for you and export the content type as configuration in new module under config folder.
Eg.  drupal config:export:content:type slider \
--module="new_module"


Views block for content that is older than current node created date

You'll need to create a block which accepts the node created date as an argument. Then you'll need to set the condition to only show nodes which have a created date < the argument value.

To pass on the node's created date as an argument, I think it's easiest just to embed the View block into the node's template using a PHP snippet. So you'll be looking at something along the lines of:

<?php print views_embed_view('my_view','my_block_machine_name', $node->created); ?>

You might have to check for the correct variable name for the created date of the node, but I think "created" is correct.

hope this helps!


Trying to get content type from a node entity

You're not loading a node there, you're loading an entity of type entity_synclist. Its bundle key might be type, but it depends on what's defined in the module's implementation of hook_entity_info().

To be sure, you can get that information from the entity definition and use it to get the bundle like so:

$info = entity_get_info('entity_synclist');
$bundle_key = $info['entity keys']['bundle'];

$synclist = entity_load_single('entity_synclist', $qid);
$bundle = $synclist->$bundle_key;


Facebook Comment Social Plugin - Get Comment Count on Nodes and Views

This might be late to answer, but do checkout Social Stats module.

This is a statistics module. It provides data from various social media sites. The data which is saved per node. It includes data from:

Facebook : likes count, shares count, comments count & total count.
Twitter : tweets count.
LinkedIn : share count.
Google Plus : plus one count, share count & total count
Total Share Count : total across all available social networks

It has an view integration. So, it would serve your purpose exactly.
P.S - I am the author and maintainer of the module. If you find any issues please feel free to report using the issue queue, and I'll be glad to help.


The login block is "a" way to get logged in. Another solution to get loged in is to navigate to an URL like /user/login.

So try that, and see what happens then. Of course, if you get logged in, hurry to move that disappeared block to some region that for sure you now is OK. To QA test it, use another browser before logging out again ...


how to get the original entity on hook_entity_presave?

Use $entity->original to get the original entity:

function hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {

  if ($entity->getEntityTypeId() !== 'content_moderation_state' ) {
    return;
  }

  $moderation_state = $entity->get('moderation_state')->getString();

  //code to get the original entity moderation state
  $moderation_state_original = $entity->original->get('moderation_state')->getString();


array_shift() expects parameter 1 to be array, boolean given in include()

How do you mean by "that doesn't work"? The problem is likely because field_get_items returns FALSE if the field doesn't exist on that node. Checking if $foo is empty (using empty) should work.  So something like:

$foo = field_get_items('node', $node, 'field_foo');
if (!empty($foo)) {
  $foo_shift = array_shift($foo);
  $foo_value = $foo_shift['value'];
}

Alternately, because field_get_items returns false when it doesn't have a value to return, you could just put the $foo = ... line in the if statement itself:

if ($foo = field_get_items('node', $node, 'field_foo')) {
  $foo_shift = array_shift($foo);
  $foo_value = $foo_shift['value'];
}

The problem with isset is that it's just checking if the variable has a value attached to it. FALSE doesn't ping it as not being set, whereas FALSE is included in the list of values that are considered empty for empty.

The "Just to Remind" section of this posts: http://alexchernomaz.com/2014/10/14/php-empty-isset-is_null/ provides an excellent table of what values are considered empty/null/set for each function (empty, is_null, and isset), if you're interested in learning more.


How to query only specific id's in a custom source plugin

This was quite easy by adding a $query->condition() to public function query() using IN and NOT IN in dynamic queries
This worked to exclude certain id's:
$products = [1, 2, 3,];
$query->condition('product_id', $products, 'NOT IN');

This worked to include only certain id's:
$products = [1, 2, 3,];
$query->condition('product_id', $products, 'IN');

I was then able to clean up the yamls, and only query the stuff I wanted.


How to setup "drush @mysite.env ssh" command?

Pantheon does not support ssh access to your server. Write your own Drush command, place it in the drush folder at your repository root, and call it with drush @mysite.env mycommand.


If you don't want to validate that field, then remove the following function

function test_mail1_validate($form, &$form_state) {

  if (!(is_numeric($form_state['input']['field_abc']))) {

    form_set_error('field_abc','ERROR');

  }
}

And remove the following line from test_mail1_form

$form['#validate'][] = 'test_mail1_validate';


Commerce - how do I set a discount to a specific user's next order only?

Generic solution

I think you need to write some custom code to get a solution that will work automatically. This could be handled by a custom Rules condition - meaning hook_rules_condition_info() implementation. After you add the code below, make sure to add this condition through Rules interface as well. Here's example code that would go in YOUR_MODULE.rules.inc:

function YOUR_MODULE_rules_condition_info() {
  return array(
    'YOUR_MODULE_rules_condition_check_next_order_discount' => array(
      'label' => t('Sample condition'),
      'parameter' => array(
        'order' => array(
          'label' => t('Order')
          'type' => 'commerce_order',
        ),
      ),
      'group' => t('Custom'),
    ),
  );
}

function YOUR_MODULE_rules_condition_check_next_order_discount($order) {
  // Perform any checks you want here, load the owner, see previous orders, etc.
  $customer = user_load($order->uid);
  if ($whatever) {
    return TRUE;
  }

  // I recommend doing this the other way around: by default visitors shouldn't be
  // able to have the rights for this discount, but they can get it IF they fulfill
  // your rules above.
  return FALSE;
}

Note: the YOUR_MODULE.rules.inc file would be loaded automatically, and you don't have to include it in the .info file of your module.

One-off solution

In case I misunderstood your question, here's how to configure the discount to have this work only once:

"Apply to" fieldset, add "User" and there select the target user.
Set the value of "Maximum usage per customer" field to 1.

Hope this helps.


Access to preprocess variables in a custom block

It won't work.
If you use a preprocess function, the variables will be available in the template of the block.

I think that, in your case, you should edit the settings.php file and add the following line:

$GLOBALS['email1'] = 'example@email.com';

You'll be able to use the variable $email1 through the whole site.

Have in mind that it's not a good Drupal practice.


How to make group visible, but content hidden?

Steps:

Go to Configuration > Organic groups > OG field settings
Under Bundle, select your group content type
Under Fields, select Group visibility and click Add field
Under Fields again, select Group content visibility and click Add field

Now these settings will add two fields into your group node which are Group visibility(Public or Private) and Group content visibility(Public or Private).

If I understood your comment requirements right, to achieve requirement:

No. 1 - Set group visibility to public and content visibility to public
No. 2 - Set group visibility to public and content visibility to private
No. 3 - Set group visibility to private and content visibility to private


you can load a image from a node.

 $prev_node = node_load($prev->nid);
    $image = field_get_items('node', $prev_node, 'field_image');
     $img = field_view_value('node', $prev_node, 'field_image', $image[0], array(
      'type' => 'image',
      'settings' => array(
      'image_style' => 'thumbnail',
      'image_link' => 'content',
     ),
   ));

then if you get the image, linking image to a certain url can be easily done by

 $options = array(
            'html' => TRUE,
            'attributes' => array(
                'title' => $prev_node->title
            )
 );
 $output = l($img, "your url", $options);
 print render($output);


Am I able to remove unneeded field/migration tables from the database manually?

Yes, use

drush migrate-deregister --orphans

This should get rid of all migration tracking tables that are not longer being referred to.


Retrieve taxonomy terms with EntityFieldQuery for a given parent term

Using only the EntityFieldQuery class, you cannot because the information about the taxonomy hierarchy is not contained in the database table used for the entity data, but in the taxonomy_term_hierarchy table.

You would need to first get all the taxonomy term IDs having $parent_id as parent, from that table, and then use the EntityFieldQuery class for the other part of the query. Truly, the EntityFieldQuery class is excessive, in this case, since its purpose is to make a query involving the values of field attached to an entity. It also slower than a normal query done with db_select(), and you would not get any benefit, in this case.


Migration: Combine Profile2 and file migration

This is not a complete working example but is still more an answer than a comment.

I'm assuming you're familiar with migration code in general.

I also assume you are using Migrate extras, which provides profile 2 support and has an example of a profile2 migration.

Because files are a separate entity from profiles you have to first have a file migration, which migrates the files into Drupal.
In that linked example the first part of code is the file import and the second part is the node import that then uses those files in a file field.
In your case the second part will be very similar but will be in your profile2 migration.

I haven't actually done an import that pulls in images from the web like this so this is an assumption.
I would say set your source directory for your file import to the directory that you intend to download the remote files into.
You can specify your directory like this and make it anywhere on your server: 'source_dir' => '/var/www/my-downloaded-files',

Then after that you import your profile2 profiles.

Unfortunately I have only done file migrations from Drupal to Drupal so I'm not sure off the top of my head what you specify for the source field when you add your field mapping (I will have a look into it when I get some free time but I'm not sure when that will be).

As far as the actual pulling in of the files goes a possible, relatively straight forward way to get your files from the external source might be to implement one of the migration methods like prepareRow() (see Commonly implemented Migration methods) and have it download the file (you could use drupal_http_request() or cURL or similar) for use in your file migration.

Be sure to handle the case of rollbacks and either remove the local files or before downloading, check if you already have the file then only download if you don't.


Full archive configuration export doesn't work

Firstly, What is the version of drush?

I advise that you use the console bundle(add it via composer:  "drupal/console": "~1.0")

and then execute this command

drupal config:export  --directory="modules/custom/import_export_config/config/install/"


Update a view page content without refreshing the page

I've been trying to find the answer to this for some time and I don't think I can improve on the previous answer.... but I think it is not really correct.

The way I would approach it is to put more of the Views formatting functionality in some JQuery Javascript so that the Javascript fetched the data for the View from the Drupal server via JSON and not HTML.

Then periodically - rather than using Views Hacks autofresh - it would say "give me all the records for this view which are newer than this datetime"

Unfortunately this would require hand coding for now as I have not seen this in any contributed module.


Using multisite for a ReSTful API and Auth Strategy

This can certainly be achieved without any multisite. Meaning you could always house the API on the same site and proxy the path api.mysite.com to mysite.com/api thus allowing it to be invisible to the user. (Make sure your webhost supports mod_proxy or you have some external proxy you can use for this task)

As for the actual authentication, I don't bother with tokens. Use credentials. This way people can get and keep a session (in line with however long you want them to based on session_lifetime in your settings.php) - After an initial call to a log in path, they can then subsequently call the API over and over again by passing the unique session they are assigned.

Go with the single site approach and use web proxy magic to make it look like a different domain. Easy enough.


Is it possible to make manual teaser breaks work with "Filtered HTML"?

This comes down to being a problem of DomDocument and its childNodes property that does not include DomComments. Specifically, Drupal\filter\Plugin\Filter\FilterHtml::getHtmlRestrictions() will not consider any comment-like tags that are added in the 'allowed HTML tags' list. This is due to these lines in that function's code:

$html = str_replace('>', ' />', $this->settings['allowed_html']);
// Protect any trailing * characters in attribute names, since DomDocument
// strips them as invalid.
$star_protector = '__zqh6vxfbk3cg__';
$html = str_replace('*', $star_protector, $html);
$body_child_nodes = Html::load($html)->getElementsByTagName('body')->item(0)->childNodes;

This loads the text of the 'allowed HTML tags' text as an HTML DomDocument and retrieves the list of the children. Only 'proper' HTML tags will be listed as part of the childNodes property and therefore, the Drupal 7 workaround will not work for Drupal 8.

In order to solve this, one could override the FilterHtml plugin in order to allow <!--break--> to remain in the text.

One attempt following this approach exists here:

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

which was in turn inspired by

https://medium.com/@djphenaproxima/how-to-bend-drupal-8-plugins-to-your-nefarious-will-94da0c31f095

Good luck!

P.S.: Also available on GitHub https://github.com/stefanospetrakis/drupal8breaks


Is it necessary to clear site caches after putting site into maintenance mode?

As you stated that 'The actual display of the maintenance page is not really important' hence it is not necessary to clear the site caches in this case.

But it is best practice to do so, because if any user interactions like forms are there, user will be getting error messages!!


I would implement this by first creating a Book Product (Non-Fiction) and issuing a specific sku number for each separate Book Title that I would introduce as a specific product. Combining this with the http://drupal.org/project/commerce_stock module might be useful in allowing unique skus per book but than also having quantity of books in stock for multiple copies.

Ender's Game (10 copies according to commerce_stock) SKU #00000001
Dune(30 copies according to commerce_stock) SKU #00000002


You can render quicktabs programmatically and where title field, you can add your descriptions. Here is link to manual: Creating QuickTabs programmatically not working


Your problem is actually the opposite of what you're thinking. A call to file_stream_wrapper_get_instance_by_scheme triggers hook_stream_wrappers() if it hasn't been called already.

However, the problem is that the stream wrapper hook was already called before your module was enabled and the information from that is statically cached. So you need to clear the static cache to get your own stream wrapper:

drupal_static_reset('file_get_stream_wrappers');


Best way to trigger multiple Feeds importers?

I had almost the exact same need where I had to import data from xml files usinf HTTP fetcher. I had 5 importers and had to run one after the other.

I declared a function that triggered the importers programmatically one after the other.

For triggering each importer this is what I did -

$feeds_source = feeds_source($importer_id);
$feeds_config = $feeds_source->getConfigFor($feeds_source->importer->fetcher);
$feeds_config['source'] = $url;
$feeds_source->setConfigFor($feeds_source->importer->fetcher, $feeds_config);
$feeds_source->save();
$feeds_source->startImport();

where $importer_id is the machine name of the importer; you can find it in the table 'feeds_source' and $url is the url where you have your xml file. feeds_source()

And there's this awesome cron module - Elysia Cron which gives in its own words 'a fine grain control over each task and several ways to add custom cron jobs to your site'.

With Elysia's hook_cronapi() you can set up a cron job which calls your function at your set up intervals.

Though it seems really a long since your question.....I hope this is of some help.


Did you double-check that your Text Format (under /admin/config/content/formats) was set to allow the HTML5 tags for this? (See below) If you haven't then the filtering will remove those tags and replace them with <div> tags.

<figure>
<figcaption>


How to render field attribute in foreach

As I understand your question, I recommend you to use for statement, you can do this:

<?php $slide_link = $node->field_slideshow_link['und']; ?>
<?php for ($i = 0; $i < count($slide_link); ++$i): ?>

<?php print render($slide_link[$i]['title']); ?>

<?php endfor; ?>

This will print all your titles...


How to disable modules using config split?

The core.extension.yml should only be put into the default, shared config. As it only holds those modules, that are enabled across all your different environments.

$config_directories['sync'] = '../config/sync/default/shared';

This default Drupal config sync directory also has the config_split.config_split.local.yml in it, which defines which modules apart from the ones in the core.extension.yml should be enabled additionally when the local split is active.

uuid: abc123456-7890-abcd-906d-abc123456
langcode: en
status: false
dependencies: {  }
id: local
label: Local
folder: ../config/sync/default/local
module:
  browsersync: 0
  devel: 0
  features_ui: 0
  field_ui: 0
  kint: 0
  link_css: 0
  masquerade: 0
  views_ui: 0
  webprofiler: 0
theme: {  }
blacklist: {  }
graylist: {  }
graylist_dependents: true
graylist_skip_equal: true
weight: 0

Then, inside each environment's settings.local.php you have to define which split in addition to the default, shared config should be active and which not. Here's how it may be configured on your local machine:

$config['config_split.config_split.local']['status'] = TRUE;
$config['config_split.config_split.dev']['status']   = FALSE;
$config['config_split.config_split.stage']['status'] = FALSE;
$config['config_split.config_split.prod']['status']  = FALSE;

The core.extension.yml only holds those modules that are shared among all your different environments.


Passing $form_state data into \Drupal::entityQuery('user')

Does $selectesRole have the expected value? I'm pretty sure you want to use $form_state->getValue('bulk_perfplans_roles') instead. Details here.

Also is it a single value field? You may need to pass an additional IN parameter to your field condition and do some additional prep if the result from getValue is an array.

Also make sure you're passing the machine name of the role and not the label.


How to keep my Bootstrap sub-theme without using the CDN?

You will need to switch the module you are using - Bootstrap Library is not suited to be used without CDN. The main function this module provides is connection to a CDN of your choice - not provide a theme (or css) itself.

The module you will want to use is the Bootstrap Theme. This one provides a sub-theme you can expand upon.

To get the Bootstrap Theme going:

Disable your old Journal theme + move it from the theme folder - that's important. (Maybe make a backup somewhere).
Download the Bootstrap Theme from the Drupal site and put it in your theme folder. (And leave it there)
Create a subtheme following the instructions for the less-starterkit (you wont need to touch less no worries) here: Sub-Theming Bootstrap. Basically you copy the bootstrap_subtheme folder from the bootstrap theme into your theme folder and rename the folder to journal (your theme name). You also rename  ./journal/less.starterkit to ./journal/journal.info.
Open your new .info file and change name + description. (You can copy it from your old theme.)
Download the latest 3.x.x version of the of Bootstrap Framework Source Files into your new sub-theme. After it has been extracted, the folder should read ./journal/bootstrap. (Don't modify the files in this folder, this folder allows you to later update Bootstrap without overwriting your changes.)
Download the journal theme css from bootswatch. Copy it into your journal/css folder. (This is the file which was previously provided by the CDN.) It should now read journal/css/bootstrap.min.css
Open your .info file again, find the line stylesheets[all][] = css/style.cssand add a line right above it: stylesheets[all][] = css/bootstrap.min.css. This will load the default journal css.
Now you need to copy your custom changes into the new theme. Copy your custom css into css/style.css and your template files (if you have any custom template files) into the journal/templatesfolder.
Enable your new Journal theme.

Glyphicons

Check your subtheme... there should be a folder fonts. If there is no such folder create one. Then navigate to the bootstrap source files you put in the bootstrap folder of your theme, find the font folder there and copy all font files in your own font folder. (This is needed because the default css looks for the fonts under ../fonts/font-name)

Headermenu

Have you checked the settings of your new theme in the UI? It has a couple of menu bar settings, maybe you are just using the wrong one. Generally bootstrap works nicely with the admin menu, at least on all sites I have it on. It is possible, that some of your custom css is interfering with the default bootstrap theme setup. In that case you would need to do some debugging on your custom css. From what I see though it might be enough for the front end to give the main-container a top margin of 60-70px.


Add programmatically exposed filter to view without removing the existing ones

The hook function used was wrong. I had to use hook_views_pre_build(&$view)
so I have now the following (and the other exposed filters don't get messed up):

 function music_m_views_pre_build(&$view) {

$view_filters = $view->display['default']->handler->options['filters'];

 $current_latter = arg(1);

 if($current_latter)
 {
    $view_filters['title']['value'] = $current_latter;

 }
$view->display[$view->current_display]->handler->handlers['filter']['title']->value = $current_latter;

}


How to make Imagefield slideshow display full width

I have not used the field slideshow module, but if it allows you to select the image style, then you could use the Lightbox2 module http://drupal.org/project/lightbox2. Lightbox 2 is not the only option for displaying the image in an overlay/popup type thing, there are many, here is a comparison of some of them http://drupal.org/node/266126. I just mention lightbox2 specifically as it is the one I usually use.


I have achieved this on a node before using Fancybox by setting up an image preset for your thumb size that opens with Fancybox. For the image to link to Fancybox you need select a Fancybox image preset under display settings for full node within your content type.

Make sure you initialize the plugin before activation using the appropriate jQuery selector.


How to upgrade my Zen sub-theme so that navigation and most of the blocks are no longer missing?

The issue about How to upgrade Zen theme from 6.2 to 7.3 contains quite some info (and links to other resources) about such Zen upgrade. However it also includes these suggestions about possible alternatives to consider:

Something like "maybe you should just consider restarting from scratch".
Swap from the Zen theme to the Omega theme (by creating an Omega sub-theme from scratch).

For more in depth documentation, you might want to look at Upgrading 6.x themes to 7.x.

Based on the current (further edited) content of your question, these are some of the topics to be sorted out (at least):

Navigation:

The navigation items shown in D6, possibly correspond to your primary and/or secundary menus (though they may also come from some "custom" menu that got added). Check which technique was used to actually display that menu in D6. Possible options I can think of: (a) some block makes them show up or (b) some theme settings is turned on (enabled checkbox) to make them display. Depending on which option was used, try to find the corresponding D7 options to do the same there.
Blocks:

For any of the blocks shown in the D6 version, in which theme region were they displayed? Head over to the D7 version to verify where probably "most of these blocks" will be shown within the "disabled" list of blocks. For any such block you find, in the D7 version start experimenting with moving those disabled blocks to what you think will be the most appropriate region in D7.

Keep repeating this for each of your blocks that are missing (= iterative process). In doing so, little by little most (if not all) of your blocks should start showing up).

If sorting out the above topics appears to be too complicated and/or turns out to take too long, then I'd really consider going the route of either possible alternatives mentioned above, because creating a "sub-theme" from the most recent Zen or Omega theme might simplify further maintenance of your "custom" theme also.


Node display based on conditional view [NULL] field entry or a Rules expression

you will need flag module make a global user flag: user_has_content, make a rule: react on event: after saving new content of your special type, add a condition: user author is NOT flagged, inside rules action: flag it, only once your user author will be flagged, then on your view, add relationship to author & one more relationship on the new flag on author, and display content if user is flagged, make another view, display whatever you want if user is NOT flagged, this works also on D8, done.

EDIT: since you are using panels, it's easier, make 2 panes as explained, and in panels add this 2 panes, make your rules inside panels UI, display pane 1 if user is flagged, display pane 2 if user is not flagged.


Overview & help with drupal files and folders on Win 7

The confusion is probably resulting from things that differ from the Windows environment compared against the traditional multi-user LAMP environment that Drupal is usually built against.

To explain what those directories are in the order you listed them:

The DevDesktop application code
Your sites you're managing with Acquia
Acquia application configurations
Drush application configurations

This data is separated mostly to accommodate a multi-user environment. So that...

All the data for the DevDesktop application is isolated so multiple users can use the app.
The sites you manage are separate from other users.
Your Acquia application configurations are separate from other users (e.g. your login info).
You Drush application configuration is separate from other users (e.g. your site aliases).


I have managed to solve this issue by changing the permissions for the Checkout module. I went to People/Permissions/Checkout and enabled 'access checkout' for both anonymous and authenticated users. Previously it was just enabled for Administrator. Hope this helps anyone else with the same issue.


You can use https://www.drupal.org/project/services_rules . It creates actions (usable in rules) for the services module. It's in beta because it has a limited amount of features. It is stable though.


Watermarking an image that is not in the Drupal filesystem using image_style

As you've probably already seen about theme_image_style():

  This function does not work with images outside the files directory nor with remotely hosted images. This should be in a format such as 'images/image.jpg', or using a stream wrapper such as 'public://images/image.jpg'.

There's a beta release of a module called Imagecache External which claims to solve the problem:

  Imagecache External is a utility module to allow you to use imagecache(D6)/image derivatives (D7) with external images.

With that module installed your use of theme_image_style() would be replaced with something like:

print theme('imagecache_external', array('path' => $path, 'style_name'=> 'thumbnail'));


Using view result as an input filter for another view

Say, the term reference field in the product content type is called "field_ref_producer". You need to have this block of code, and a view that accepts a contextual filter for "term reference producer ID" ready.Let this view be called "other_products_producer"

$node = menu_get_object();
$output = '';
if(is_object($node)) {
  $producer_id = $node->field_ref_producer['und'][0]['tid'];
  $output = views_embed_view('other_products_producer', 'default',$producer_id);
}
echo $output;

Basic idea is, grab the node object from URL, get the producer tid from it and then embed a view passing the producer nid as contextual filter to the view.

Update:

Code to put in views PHP (default value of contextual filter):

$node = menu_get_object();
if(is_object($node)) {
  $producer_id = $node->field_ref_producer['und'][0]['tid'];
  return $producer_id;
}

Please replace the name of the field to what you have in  your content type.


How to redirect before page processing along with all the sent data?

My suggestion (experimental) is something like this (but NOT RECOMMENDED):

function MY_THEME_preprocess_page(&$variables) {
  if(arg(0) == 'node' && is_numeric(arg(1))) {
    $nid = arg(1);
    if($nid == '23423') {
      drupal_goto('node\45644');
    }
  }
}

function MY_THEME_node_view($node, $view_mode, $langcode) {
  if($node->nid == 45644) {
    $old_node = node_load(23423);
    $old_node_view = node_view($old_node);

    $node->content['body'] = $old_node_view['body'];
  }
}


Does Drupal have a system for noticing and logging changes to records?

There is the Track Field Changes module which appears to have little support. And also a -dev version of Node Changes module with many more contributors and more recent updates.

Both modules allow you to track field level changes on Nodes essentially. From Node Changes:

  This module stores the changes of a node into a field attached to
  comments allowing to display a kind-of activity stream on the node
  much like on drupal.org issues just with a lot less custom code.

I don't believe either makes use of database triggers.


You didnt say what version of Drupal your using, but if you are using D6
check this out Views Search

If not then check out Views

Then I guess you just have to get the node titles and make them as a exposed filter.  So you will need to expose 1 Filter, one for the node title and then also check out Autocomplete Filter

This link can also help you Views Exposed Filter Search

Update :

You might also wanna take a look on this, if your not to happy about using Views
, Its more integrated to the Search API
 Custom Search Module


Add followers' list at the end of discussion

You can do this using Flag module.

  Flag is a flexible flagging system that is completely customizable by
  the administrator. Using this module, the site administrator can
  provide any number of flags for nodes, comments, users, and any other
  type of entity. Some possibilities include bookmarks, marking
  important, friends, or flag as offensive. With extensive views
  integration, you can create custom lists of popular content or keep
  tabs on important content.

Creating Following & Followers


Cannot replace html.tpl.php with new template in a single module

To create your own template override in a module is not the same as doing it in a theme. Look at Overriding a template file (.tpl.php) from a module.

Put this code in your module, and put the template file in a sub-directory 'templates'. Clear the cache.

function MODULE_preprocess_html(&$vars){
  $vars['theme_hook_suggestions'][]  = 'html__print';
}

function MODULE_theme_registry_alter(&$theme_registry) {
  $path = drupal_get_path('module', 'MODULE') . '/templates';
  $templates = drupal_find_theme_templates($theme_registry, '.tpl.php', $path);
  foreach($templates as &$template) {
    $template['type'] = 'module';
    $template['theme path'] = path_to_theme();
  }
  $theme_registry += $templates;
}


The latest version of Acquia Dev Desktop (released on May 21, 2020) is compatible with Drupal 9: It added support for MySQL 5.7 and Drush 10; PHP has been updated to versions 7.2.28 and 7.3.15.
Since Drupal 9 requires PHP 7.3 or higher, you need to select version 7.3.15 for Drupal 9, or you will get the error message you saw.
References

The release notes for Drupal 9

The download page for Acquia Dev Desktop


The contents of your tables are not stored in the encoding that is specified for those columns. So you need to find out how the characters are stored and what the specified encoding is, e.g. using phpMyAdmin. It seems the characters are stored in UTF-8, but the columns are identified as latin1. If I recall correctly I've used this conversion script successfully in the past for a similar situation. Of course, always backup your database before attempting such operations! Or try it on a copy first.

You can also drop all tables and fully reimport the old database, this time choosing the correct character encoding. (It's best to have everything in UTF-8, so if the old database dump is not in UTF-8, you could convert the .sql file first and then import it as UTF-8).


How to add a counter about the total number of nodes visited by a user?

Have you checked the Node view count module: Node View Count module allows to count node views.

  Unlike statistics module, this module records each view of node with
  user uid and timestamp.

I guess at max. you only would have need to write the correct database query to get the count of total number of nodes visited by a user as rest of the things are being done by this module.


I don't think any easy solution exits. But you can connect to another database by adding below lines into your settings.php file.

$db_url['mydb'] = 'mysql://user:pwd@localhost/anotherdb';

and use db_set_active() function in appropriate places to query other database while your existing database index. You may need to have a deep look in to the Search module for that.


How do I modify a node's body (or any field) on display as `hook_node_view`?

This should work, you are changing $build, which you don't need to return:

function textreplace_node_view(&$build, $node, $display, $view_mode) {
  // your code for $text
  $build['body'][0]['#text'] = $text;
}


Yes you can save comment dynamically using comment_save() function, a working example is given below

<?php

$comment = new stdClass();

$comment->nid = 28; // nid of a node you want to attach a comment to
$comment->cid = 0; // leave it as is
$comment->pid = 0; // parent comment id, 0 if none
$comment->uid = 1; // user's id, who left the comment
$comment->mail = 'email@example.com'; // user's email
$comment->name = 'User name'; // If user is authenticated you can omit this field, it will be auto-populated, if the user is anonymous and you want to name him somehow, input his name here
$comment->thread = '01/'; // OPTIONAL. If you need comments to be threaded you can fill this value. Otherwise omit it.
$comment->hostname = '127.0.01' ;// OPTIONAL. You can log poster's ip here
$comment->created = time(); // OPTIONAL. You can set any time you want here. Useful for backdated comments creation.
$comment->is_anonymous = 0; // leave it as is
$comment->homepage = ''; // you can add homepage URL here
$comment->status = COMMENT_PUBLISHED; // We auto-publish this comment
$comment->language = LANGUAGE_NONE; // The same as for a node
$comment->subject = 'Comment subject';
$comment->comment_body[$comment->language][0]['value'] = 'Comment body text'; // Everything here is pretty much like with a node
$comment->comment_body[$comment->language][0]['format'] = 'filtered_html';
$comment->field_custom_field_name[LANGUAGE_NONE][0]['value'] = 'Some value'; // OPTIONAL. If your comment has a custom field attached it can added as simple as this // preparing a comment for a save

comment_submit($comment); // saving a comment
comment_save($comment);
?>


Disable /Enable a multivalued paragraph field on Ajax calls

Your issue arises, as the paragraphs widget(s) itself do a lot of Ajax calls and you disable the field(s) in your browser only. So your paragraph form will be reloaded and re-rendered without knowing that the field has been disabled before.

To have the field(s) disabled on consecutive reloads, you need to make your changes more permanent.

You could e.g., save a flag to the $form_state using the FormStateInterface::set() method:

  FormStateInterface
  [...] it may be used to store information related to the processed data in the form, which will persist across page requests when the 'cache' or 'rebuild' flag is set.

This means, after you stored a custom flag in the $form_state and an ajax request to reload this form is made, it will be available within the $form_state of your hook_form_alter() implementation as well.

So all we have to do now, is checking for this flag in hook_form_alter() using the FormStateInterface::get() method and ensure the field will be disabled, if it has been set before.

A less abstract example:

/**
 * Callback for disabling field_htext.
 */
function _my_ajaxcallback(array $form, FormStateInterface $form_state) {
  $response = new \Drupal\Core\Ajax\AjaxResponse();

  // Disable field_htext of paragraph field.
  $response->addCommand(new \Drupal\Core\Ajax\InvokeCommand('.field--name-field-htext input', 'attr', array('disabled', 'disabled')));

  // Set a 'disabled' flag in form state.
  $form_state->set('field_htext_disabled', TRUE);

  return $response;
}

And in your form alter:

/**
 * Implements hook_form_alter().
 */
function hook_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  // Better use the form ID here and check, if you are at
  // your form in question, or even use a more specific hook as
  // hook_form_BASE_ID_alter() or hook_form_FORM_ID_alter().

  // Check our custom disabled flag.
  if (
    !empty($form_state->get('field_htext_disabled'))
    && isset($form['field_htext'])
  ) {
    // Set the 'disabled' attribute.
    $form['field_htext']['widget'][0]['value']['#attributes']['disabled'] = 'disabled';
  }

  // Add ajax callback on change event.
  if (isset($form['field_link_type'])) {
    $form['field_select_sample']['widget']['#ajax'] = array(
    'callback' => '_my_ajaxcallback',
    'event' => 'change',
   );
  }
 }


How to send after filtered views result in mail in drupal 7?

I'm not totally sure what you mean by

  I need to send after filter view result in mail with ajax views

If you need to send to the list of items (e.g., the items are members with email addresses), then you should install Rules, and set up Views Bulk Operations as described in this Drupalize Me (i.e., Lulabot's teaching videos) series. Parts 18 through 21 describe how to take a view, and use Rules to make it do something like send an email.

If you'll expand a bit about what you're trying to do, I can be a bit more specific about this.


How to define an internal link as parent in mymodule.links.menu.yml?

I think changing from url to route_name is the solution, you normally use url only for external links.
You don't find entity routes in static yml files because they are created dynamically. You could use the Devel module and visit
/devel/routes

or from the command line with Drupal Console:
drupal debug:router

See https://drupalconsole.com/docs/en/commands/debug-router
Then when you have found the route name you have to add the entity id as route parameter.
Example:
mymodule.links.menu.yml
mymodule.node7:
  title: 'Node 7'
  route_name: 'entity.node.canonical'
  route_parameters: { node: '7' }


Install sub-theme without creating blocks

They're not really "copied". They're the same blocks from your theme, but moved to the available regions of your subtheme after enabling it (iirc, they move to similarly named regions, disabled if none found).

What you could do is export the configuration. Drupal also keeps track of the active theme and block positions in the config. You could position blocks in the old theme and export the config for that. Then when you move to the new theme, you reposition the blocks and export again. Whenever you feel like switching over, you simply reimport the config you like.

I'm not so familiar with the config management in the UI, but this can be done with Git and Drush cex/cim quite easily.


How to grant User Points to viewing user when user has viewed content?

Interesting question, worth to be considered as a great question for a Drupal site building exam!

Have a look at this rule:

{ "grant_user_points_after_content_view" : {
    "LABEL" : "Grant user points after content view",
    "PLUGIN" : "reaction rule",
    "ACTIVE" : false,
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "userpoints_rules" ],
    "ON" : { "node_view--article" : { "bundle" : "article" } },
    "IF" : [
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "2" : "2" } }
        }
      }
    ],
    "DO" : [
      { "userpoints_action_grant_points" : {
          "user" : [ "site:current-user" ],
          "points" : "1",
          "tid" : "0",
          "entity" : [ "node" ],
          "description" : "View of node with id \u0022[node:nid]\u0022 and title \u0022[node:title]\u0022",
          "operation" : "NodeViewed",
          "reference" : "Viewing of [node:content-type] \u003Ca href=\u0022\/node\/[node:nid]\u0022\u003E\/node\/[node:nid]\u003C\/a\u003E",
          "display" : "1",
          "moderate" : "default"
        }
      }
    ]
  }
}

Some details about this rule, which you should be able to import in your own site if you have the Rules UI, and Userpoints Rules (a sub-module of Userpoints), enabled and after you enable the rule also:

Rules Event: a Node of content "Article" is viewed (adapt the machine name of the used content type to any type that fits).
Rules Condition: user is authenticated (to be able to grant user points).
Rules Action: grant 1 point to the user viewing the article. And use some of the available tokens to add some more details to the actual User Points transaction (description, operation, reference) ... just for fun.

Easy, no? Sorry you had to wait for 2 years ...

PS: The previous answer is not really an answer to the question here I think.


How to list duplicate nodes based on title with views

The filter should be on content:nid. Set it to aggregate on COUNT, and 'Is greater than' value 1.

Then check all of your fields that you have added. None of the fields for nodes with the same title should output a different value. Title for instance, can be unique, depending on how you output it. If you for instance output it as a link (the default), then for each title that is the same, but that belongs to another node, the link is unique, therefore you view won't perform the way you want it to. So deselect 'Link this field to the original piece of content' and it should work.


This can be done with Views Tree module. Install the module and read the readme.txt file to implement the same. Do get back in case of any doubts.


The wysiwyg module is tied to the input format system.

Use '#type' => 'text_format' when defining your text area.


Multiple aliases per node (and active trail)

A simple solution is to create Content Type, say 'delegated', with a single node reference field. Then, configure the reference field to point nodes of the content you want to be duplicated. Configure this field to show the referenced node as full node view (or whatever View mode you prefer).

This way:

You can create independent pages with their own title, breadcrumb, alias, metadata, etc, but same content (if they reference the same node).
Editors are able to update/create those 'delegated' node easily (they are just a node).
As reference field can be limited by a View, you can narrow the contents available to be referenced in a powerful way.

As all are nodes, you can even create admin views to see with contents are related, or any other node available operation.

The main drawback is if you have configurations in referenced nodes that you want to be in the referencer node (say metatags). This could be solved using a custom module (updating referencer metatags when referenced node is updated) or manual copy-paste (ugly).


Why don't calls to drupal_set_message() show up after a drupal_goto()?

I tried in my test site, and the message appears, even using drupal_goto(). I used the following code.

function code_testing_date_form($form, &$form_state) {
  $form['expire'] = array(
    '#type' => 'date_select',
    '#title' => t('Expire Date'),
    '#default_value' => date('Y-m-d H:i:s'),
    '#date_format' => 'Y-H:s',
    '#date_year_range' => '0:+20',
    '#required' => TRUE,
  );

  $form['weight'] = array(
    '#type' => 'weight',
    '#title' => t('Weight'),
    '#description' => t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'),
    '#default_value' => 5,
    '#delta' => 10,
    '#access' => FALSE,
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );

  return $form;
}

function code_testing_date_form_submit($form, &$form_state) {
  drupal_set_message('You have been redirected.');
  drupal_goto('user');
}

What could cause the issue you are seeing could be:

There is code that clears the content of $_SESSION['messages'], used to contain the messages set with drupal_set_message().
There is code that invalidate the current session. In this case, the logged-in user should be logged out.
You are rendering the form in a template file.
The template file for the page to which the users are redirected doesn't have code to handle the $messages variable. The default node.tpl.php file contains the following code; if the template doesn't print $messages, the messages set with drupal_set_message() will be not seen.

<?php if ($breadcrumb): ?>

<?php print $breadcrumb; ?>

<?php endif; ?>
<?php print $messages; ?>


JWPlayer in Drupal has container ID starting with Numeric Character

While you're at it, here is a quick solution to it.

Since this is a fix for Drupal JWPlayer Module, do the following:-

Go to jw_player module folder and open theme folder.
Open jw_player.tpl.php and add the following line on top (probably where PHP declaration starts).

$html_id = "myvideo". $html_id;

It kinda does the job but I am sure you guys have better solutions than this. Please feel free to comment.

Found a better solution

Don't do upper suggestion. Paste the following code in jw_player.module instead.

Find this line $variables['html_id'] = md5(rand()); (I guess line 308) and uncomment it before pasting the following code instead.

while(1) {

      $variables['html_id'] = md5(rand());
      if (ctype_alpha(substr($variables['html_id'], 0, 1))) {
        //echo "First Digit is Alphabet";
        break;
      }

  }

Thanks.


Change URL of site, server and folder remains the same

Seems the website was coded using absolute paths, which is not really good practice from Drupal coding standard's perspective. Please read the discussion on Absolute or relative URLs?. Your case is covered by the accepted answer:

  When moving a site from dev > staging > production a Wordpress site's
  URLs and image references have to be replaced in the DB, this can
  create an absolute mess.

Though Wordpress is mentioned, that concerns any type of websites, including Drupal.

Anyway, to address the issue you need to do two things:

Look for and replace all the instances of your old domain in the active theme's template folder. This is easier part as any decent text editor has Find&Replace feature.

Check the website again and if everything is working then you are lucky. If not proceed to the second step.

Search and replace all the instances of your old domain in the database tables. You can do it either using drush or UI like phpMyAdmin. The query is pretty simple:

UPDATE table_name SET field_name = replace(field_name, 'old-domain', 'new-domain');

To do so you first need to figure out the tables where your old domains could be stored. Most probably those are 'node' and 'comment' tables and their last revisions, however if content types have additional custom fields then more tables are involved. You could perform quick search for the old domain in the database to find all the tables where it is stored.

If step 2 is involved, then I would also suggest, using the opportunity, to turn all your paths from absolute to relative. In that case, you would run:

`UPDATE table_name SET field_name = replace(field_name, 'old-domain/', '/');`

instead.

I hope this helps.


login programmatically with remember me feature

This is how I accomplished the remember me feature. Since I didn't find any specific resources on this matter, the proposed solution may or may not be optimal and correct, although it works fine.

You use the following code to login a user programmatically:

$user = user_load($uid);
$login_array = array ('name' => $user_first_query->name);
user_login_finalize($login_array);

After that you have to decide whether to persist the login or not using the provided check box in the login form:

//at this point we need to persist the login by saving the user again
//with the remember_me data. But doing so, resets the user picture.
//So we need to preserve it somehow.
$user_picture_id = $user->picture;
if($_POST['remember_me']) {
    user_save($user, array('data' => array('remember_me' => (int)$_POST['remember_me'])));
}
else {
    unset($user->data['remember_me']);
    user_save($user, array());
}

//restore the user picture id
db_update('users')
    ->fields(array(
         'picture' => $user_picture_id,
    ))
    ->condition('uid', $uid)
    ->execute();

For the part where I have done unset($user->data['remember_me']); I have made sure that the rememeber_me data does not exist from a previous login. I think this should be done in the modulename_user_presave() hook but I couldn't implement it there.

Remember that since the main question is how to persist a user login, I have not provided a full login procedure, for example you should authenticate the user's credentials using the user_authenticate() function.


Metatag images don't work anymore after updating

This issue is documented here : https://www.drupal.org/project/metatag/issues/2994433

For the moment (21/09/18), there are two solutions :

add :entity:url at the end of the token
downgrade to Metatag 1.5 instead 1.6

Using first solution, change [node:field_image_article:entity:field_image] for [node:field_image_article:entity:field_image:entity:url] did the job for me.


I was running into this issue as well. I ended up using EntityFieldQuery to pull my nodes. Then also went into my php.ini file and set my resource limit params to what I have pasted below.

max_execution_time = 1024     ; Maximum execution time of each script, in seconds
max_input_time = 2048   ; Maximum amount of time each script may spend parsing request data
memory_limit = 5048M      ; Maximum amount of memory a script may consume (8MB)

I've included my php module code below for your reference as well.

// go through player names and search
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'content_type_name_to_pull')
  ->propertyOrderBy('title', 'ASC')
  ->propertyCondition('status', 1);

$result = $query->execute();

if (!empty($result['node'])) {
  $nids = array_keys($result['node']);
  $nodes = node_load_multiple($nids);

  foreach ($nodes as $node) {
    // do what you want with the node
  }
}


Will empty hook definitions slow down a site?

I suspect I have been guilty of deploying code with empty hooks.  Often, I will stub out hooks for debugging purposes, so I don't have to clear cache in order to dpm() something at the point I need.  Ideally, though, dead code should be removed.

If you remove an empty hook, you will

Save a small amount of database space from the hook being saved in the registry.  I think it will save one row.
Save a small amount of memory in APC.
Save some query memory and some PHP memory from reading in that row from the registry
Save a few CPU cycles from having a module_invoke_all() call something that does nothing.
Potentially save you some headache of having dead code in a file.

If you have the time, and have a site that works, there should be no harm in removing these hooks.  Just test it to be positive.

Whether you have a meaningful performance impact is really debatable.

In the case of cached pages, the only hook that fires is hook_boot().  There will be some overhead from the bootstrap process reading in an extra hook from the registry.  I seriously doubt this is measurable, though.

For authenticated access, or non-cached pages, the hook may run if the invoker runs.  In other words, a hook_init() will always run, but a hook_node_insert() will only run if you actually save a new node.  Even in this case, I doubt that you will have any meaningful impacts.  Actually profiling this would be an interesting exercise, though.

TL;DR, there should be no harm in removing them, but you will probably not notice them gone.


add link to edit content in admin top bar

That looks like the "shortcuts" menu tab which comes natively in a D8 installation but if you're looking to add your own custom shortcut menu (& menu items) you might want to look into the hook_toolbar: https://api.drupal.org/api/drupal/core!modules!toolbar!toolbar.api.php/function/hook_toolbar/8.2.x

You can build a quick custom module to establish your own links and configurations. Hope I answered your question!


how to count results in a Calendar view?

Finally, I get it working.
After I turn on View's setting "Show the SQL query", I notice there is an unnecessary GROUP BY field "nid" in the Calendar view, then I unset this field in a hook_query_alter(QueryAlterableInterface $query) as below:

if ($query->hasTag('views_' . $view_name)) {
    $fields =& $query->getGroupBy();
    unset($fields['nid']);
}


Creating a module arguments page with a shorter URL

My suggestion is concatenating arguments by a dilemma (something like -) and in callback function explode them simply by Php Explode function.

/**
 * Implements hook_menu().
 */
function my_module_menu() {
  $items = array();
  //general page
  $items['my_module'] = array(
    'title' => 'My Module List',
    'description' => 'My module list Page',
    'page callback' => '_my_module_page',
    'access callback' => 'user_access',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
      );
  //single event page
  $items['my_module/event/%'] = array(
    'page callback' => '_my_module_arguments',
    'page arguments' => array(2),
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );

  return $items;
}

function _my_module_arguments($args){
 $items = explode("-",$args); // you can use another dilemma instead -
  //$items[0] first arg
  //$items[1] second arg
}


This could indicate that your site was hacked due to drupalgeddon bug. If you have not updated from 7.30 it is likely that an attacker changed the version numbers. Check here: https://www.drupal.org/node/2357241


Where do these version numbers come from "module-name-1.0-alpha1+13-dev" with plus?

-dev versions, are regularly built from the latest source code.

To differentiate between todays -dev release, and yesterdays, the number you've indicated counts the number of changes between any two dev releases.


Products discount pinned at the top of the lists

Unfortunately you cannot do this with a rule. Whether or not something is sticky depends on how Views sorts a list of products, and there is no sort handler that I'm aware of that would show discounted products first. The closest you could come to would be an extra field on your products that you set when you enable the discount to identify a discounted product. You would then be able to sort by that field value.


Views page redirect to current page with parameter

Don't send a response in custom code. Use an event subscriber to set the response, so that it can be returned by Drupal:

mymodule.services.yml:

services:
  mymodule.event_subscriber:
    class: Drupal\mymodule\EventSubscriber\MymoduleSubscriber
    tags:
      - {name: event_subscriber}

src/EventSubscriber/MymoduleSubscriber.php:

namespace Drupal\mymodule\EventSubscriber;

use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class MymoduleSubscriber implements EventSubscriberInterface {

  public function checkForRedirection(GetResponseEvent $event) {
    if ($event->getRequest()->query->get('redirect-me')) {
      $event->setResponse(new RedirectResponse('http://example.com/'));
    }
  }

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

}

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

Example to check the current path and that the query parameter is not present yet:

public function checkForRedirection(GetResponseEvent $event) {
  $request = $event->getRequest();
  if ($request->getPathInfo() == '/example' && !$request->query->has('name')) {
    ...


How to list nodes in a view as checkboxes?

You'll have to test that particular combination yourself, but there are modules that seem the best fit to try first.

To be able to select individual views results and perform actions on them you need Views Bulk Operations (VBO). You don't need to look further than that module for this part.

The tricky part is the PDF. Views PDF and Printer, email and PDF versions might have helped in D7 but they don't seem to be ready in D8.

In D8 Entity Print seems to be the rightful heir so try that one. Also I don't know how far you can get without custom code. You will probably need to use Rules to create the action that would be executed with VBO.


Hook into Web-Form POST to send another POST request to 3rd Party Server?

There's the Webform Remote Post module that does exactly this.


Create two views or one view with two displays
Configure Parent view or display
Configure Child view or display and add context. filter by parent node title (this can be provided by Relationships). You can test it by passing one of Parent node title to Preview textfield.
Open parent view or display, add Global:View field, choose your child view and display in settings.. Important part: you need to provide parent node's title as an argument to Contextual Filters input of Global:View settings, for that expand Replacement Patterns, find Title pattern, it should be somthing like [!title], copy it and past it into Contextual Filters input of settings form.

I didn't test it but you can correct it by your needs.


Migrate D2D UI - Source field missing from dropdown menu when editing field mappings

I found the cause of the problem, and a solution:

I had cloned my old D6 site, then performed the core and CCK upgrade to D7 as described in Drupal's documentation, during which I mistakenly converted the above-mentioned field to a Boolean type when it should have been (based on the old site's field) converted to the List (text) type. I manually deleted the field and recreated it as the proper type, ran the migration, and the nodes were imported as expected.


How do you display the 'Title' field on display/page for custom content type?

In D8 the title is not handled as a normal field. As example for nodes the title is displayed in two ways:

Block: There is a block "Page Title". You can place this block in any region, it' possible to place it multiple times and the visibility can be configured so that it does not appear on every page.
Template: If the node is not displayed as page, then the title is displayed inside the node template.

You can use the same methods for your custom entity.

The first method should work with any custom entity. If you have a route to the entity and you place the block "Page Title" on your site, then the block should be able to resolve the title of the entity.

For the second method you have to put the title in a variable in preprocess and place it in the twig file.

Edit: You have no custom entity, it is a custom content type. So the title is there already as variable "label" and can be used right away:

node--custom-content-type.html.twig

      {{ label }}

This example is the linked title, but you can simply use {{ label }} if you don't need this.


How to theme simplenews unsubscribe page?

I am going to answer this just so that people that are looking for the answer will see it.

As @AgA said:

You can install the Themer Module, you will require the Devel Module.
Enable these modules and go to the path that you would like to theme.

The Themer module will give you suggested naming conventions that you can use to override that page's theme.

In your case it was the content type newsletter, coming to the suggested name of page-newsletter.tpl.php but there will be more suggestions which you can use to override an already overridden more general tpl.


My data content type does not appear as an option on my 'Add content' page

It sounds like there is a problem with your menu system.

This is an (educated) guess but rebuilding your menus may help.

Install the devel module and then click on Rebuild menus: