Drupal 8

Drupal 8 views set exposed filter (default) programatically with auto-submit

Setting a dynamic views exposed filter can be done via hook_form_FORM_ID_alter() regularly if it's just a prepopulation of the views exposed filter form.

But if you wish to immediately run the filters using better_exposed_filters auto-submit when the view is loaded you have to use hook hook_views_pre_build(). Otherwise setting the #default_value is just too late.

Use the following code:

Einordnung:

Snippet: Drupal 8 Commerce: Product variation assign in DB

Short snippet to restore product variation assignments (references) in Drupal 8 Commerce after an SQL error has occured on product save, which left product variations orphaned.

Fix all product variation relationships having no parent product and set the correct product ID (here "10"):

Drupal 8 Field Type Schema column add / change / delete HOOK_update

As heavily discucced in this years old issue: [#937442] there isn't a good solution or helper in Drupal core currently to change the schema of a custom field.

Modules like

  • field_collection
  • dynamic_entity_reference (#51)
  • address
  • viewsreference
  • ...

Drupal 8: Looping through EntityReferenceItem(s) / EntityReferenceRevisionsItem(s) to get Target Entities is wrong

I just had the case to iterate over EntityReferenceRevisionsItem's which are similar to EntityReferenceItem to get the target entities,

My code snippet was (WRONG EXAMPLE):

  1. $subParagraphsER = $paragraph->get('field_paragraphs_paragraphs');
  2. foreach ($subParagraphsER as $subParagraph) {
  3. ...
  4. }

Drupal CMS + Google Analytics gaOptOut Datenschutz

Typischerweise wird in Datenschutzerklärungen Deutscher Websites ein JavaScript-Link zum OptOut aus Google Analytics angeboten, wie Websites wie folgende erläutern: https://die-netzialisten.de/wordpress/google-analytics-um-einen-optout-l...

In Kombination mit dem Google Analytics Drupal Modul

Drupal 8 solving composer problems like "Can only install one of ..."

I've been running into problems with composer several times now in combination with Drupal 8 projects. This blog post shares my problem solving solutions.

"Can only install one of ..." when updating

In many cases this can be resolved by clearing all folders from the "venor" directory and running

Einordnung:

Linktipp: Create custom fields in Drupal 8

Guide on how to create custom field types in Drupal 8

Drupal 8 Entity reference blocks: restricted access (Eingeschränkter Zugriff)

You're referencing a Drupal 8 block via block reference but after saving the entity reference input field says "restricted access" (German: "Eingeschränkter Zugriff")? That's simple to solve... and "works as designed".

Linktipp: 6 Modules to avoid before Drupal 8 arrives

The name says it all. No more comments required.
I don't think you should take the points too serious but some tips are good. For example I didn't know the smart url.module before.

It's worth to have a look!