Drupal Dump

Drupal Snippets, Hacks and more....

398 posts since 2011

Find the class responsible for a particular field type

$field_type_manager = \Drupal::service('plugin.manager.field.field_type');
$class = $field_type_manager->getDefinition('entity_reference')['class'];

this will show you info

Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem
so you can check there settings and code for this field type.

Changing(moving) modules path in drupal 8

In drupal 7 when you moved modules from one directory to other, usually running drush rr (registry rebuild) would work, maybe you would need to clear caches. In drupal 8, this wont help. Paths are saved in APC and you will probably need to restart server.
For someone maybe

Tips for New Selenium IDE 2019 and Drupal

As it is often referred online as "new selenium IDE 2019" lets sum up some tips how to use it. It can record your actions and put them in its UI, but you will often need to change it and refine it to get something useful.

Add JS code to header tag of html

Reading docs about drupal_add_js you might think you can add JS to header of html, but only thing you can choose is header or footer of your theme (as region), to add JS to header tag, you need to use

How many database tables do nodes and entities produce depending on settings

In this post I will determine how many DB tables does each option you choose make.

Lets start with NODE, make a basic node, with just title and body, when we enter data for it, it will populare 6 tables.

1. node
2. node_revision
3. node__body
4. node_revision__body
5. node_field_data
6. node_field_revision