Weblogs

Create Config Entities in Drupal 8 with a dragable list

Download an install the Config Entity Example module 8.x-1.x-dev Examples for Developers. Apply the patch Dragable-Entity-List-#2715179-#3.patch.

git apply -v Dragable-Entity-List-#2715179-#3.patch

Done!

Zwahlendesign:

Adding HTML tags in the <head> in Drupal 8 with a module

Step 1
Create a MODULNAME.libraries.yml file with: dependencies: - core/drupalSettings"!

MODULNAME:
version: VERSION
dependencies:
- core/drupalSettings
- core/drupal

Step 2
Add this hook_page_attachments() function in your module (MODULNAME.module):

/**
* Implements hook_page_attachments().
*/
function MODULNAME_page_attachments(array &$page) {
$description = [
'#tag' => 'script',
'#attributes' => [

Zwahlendesign:

Add a class to the <body> in Drupal 8 with a module

Step 1

Create a MODULNAME.libraries.yml file with: dependencies: - core/drupalSettings"!


MODULNAME:
version: VERSION
dependencies:
- core/drupalSettings
- core/drupal

Step 2

Add this hook_preprocess_html() function in your module (MODULNAME.module):


/**
* Implements hook_preprocess_html().
*/
function MODULNAME_preprocess_html(&$variables) {
$variables['attributes']['class'][] = "BODYCLASS";
}

Zwahlendesign:

Seiten

Subscribe to RSS-Feeds