Skip to content
Snippets Groups Projects
Commit a597f3a6 authored by Adrian Lorenc's avatar Adrian Lorenc Committed by Ilias Dimopoulos
Browse files

ISAICP-9459: Include only existing libraries.

parent c45d7dfc
No related branches found
No related tags found
1 merge request!209Release 2.2.0
......@@ -15,7 +15,11 @@
*/
function ventuno_preprocess_paragraph(array &$variables): void {
$variables['#attached']['library'][] = 'ventuno/paragraph';
$variables['#attached']['library'][] = 'ventuno/paragraph__' . $variables['paragraph']->bundle();
$bundle_library = 'ventuno/paragraph__' . $variables['paragraph']->bundle();
if (array_key_exists($bundle_library, \Drupal::service('library.discovery')
->getLibrariesByExtension('ventuno'))) {
$variables['#attached']['library'][] = $bundle_library;
}
$variables['attributes']['class'][] = 'paragraph--' . str_replace('_', '-', $variables['paragraph']->bundle());
if (isset($variables['elements']['#joinup_paragraph_alignment'])) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment