Drupal 8

Drupal CMS: Change user profile title & tab title

Since I needed some time to find out how to change the user profile tabs title and page title, I'd like to share that information with you.

Drupal 8 Media: Format file size output / display

If you'd like to output Drupal 8 Media file size (mapper field) output in human-readable format, this snippet may help you!

in MYTHEME.theme file:

  1. function MYTHEME_preprocess_media(&$variables) {
  2.   /** @var \Drupal\media_entity\MediaInterface $media */
  3.   $media = $variables['elements']['#media'];
  4.  
  5.   if ($media->bundle() == 'document' && !empty($media-> field_document_size)) {

Drupal 8 Backup-Migrate running into out-of-memory Error? A large key_value_expire table may be the cause!

On a customer page we were running into problems with backup_migrate aborting with out of memory errors. In contrast to other similar websites we found out that a bug ([#2931611]) in the honeypot module caused the key_value_expire database table to grow up to 2,3 GB of (useless) data.
This bug in detail is being targeted in this issue: [#2997609]

Drupal 8 on-demand error display with disabled cache via URL Parameter

Have you ever wanted to disable Drupal 8 cache and enable error reporting only for a specific page or to quickly debug a problem?
Here's a simple solution how to enable debugging and disable caching for a single call using a URL debug parameter

Drupal 7 / 8: Lightweight set / exchange domain specific front page (e.g. for landingpages)

Would you like to create a Landingpage for a specific topic in Drupal 7 / 8 on a separate landingpage domain (https://www.my-landingpage-example123.com/) as specific frontpage without using complex modules like Domain Access or multisite?
Then here's the lighweight way to go for you!

Drupal 8: Override views row (views-view-fields.html.twig) in views style plugin

In the last days I developed the ZURB Foundation Views integration module for Drupal 8. To match the markup required by foundation accordion we first had to write a views style plugin in our module.

Drupal 8 Bug: The module standard does not exist. in Drupal\Core\Extension\ExtensionList->get()

We just ran into the Drupal 8 CMS Error message:

Drupal 8 Bug: The module standard does not exist. in Drupal\Core\Extension\ExtensionList->get()

Snippet: Drupal 8 Commerce: Show SKU in product variation inline entity form table

Before our modifications to the IEF table

Today I'd like to share a little snippet with you on how to add or remove fields from the inline entity form line items table in a product edit form.

By default that inline entity form table contains

  • Weight
  • Product variation title
  • Price
  • Status
  • Operations

What we'd like to do in our example is to

Open Drupal 8 Webform in Modal

Creating a webform modal is quite simple and straight forward in Drupal 8.

We only need the Webform module and some classes for the modal opening button:

  1. Download and install https://www.drupal.org/project/webform
  2. Create a webform

Drupal 8: Load current entity from controller dynamically *updated*

Today I'd like to discuss a little Drupal 8 snippet to dynamically load an entity from the controller by the current path.

This acts a bit like a Drupal 8 replacement for Drupal 7's menu_get_object().

Use case / example: