New answers tagged

0

Ended up with something in the middle. Problem is: Without the template my JS code will end up escaped with HMTL entities. /** * @file css_color_variables_ie11/css_color_variables_ie11.module */ /** * Implements hook_theme(). */ function css_color_variables_ie11_theme($existing, $type, $theme, $path) { return [ 'css_color_variables_ie11' => [ ...


1

You can alter the drupalSettings with the hook "hook_js_settings_alter": function hook_js_settings_alter(array &$settings, \Drupal\Core\Asset\AttachedAssetsInterface $assets) { // Add settings. $settings['user']['uid'] = \Drupal::currentUser(); // Manipulate settings. if (isset($settings['dialog'])) { $settings['dialog']['...


3

You need to attach complete libraries, not single library files. Your module has the name helloworld, this is the first part before the slash. In your libraries.yml you have defined the top key helloworld, this is the library name and the second part after the slash: $attachments['#attached']['library'][] = 'helloworld/helloworld'; This line will attach all ...


Top 50 recent answers are included