Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects

EPIC: OEL-1255: Migrate paragraphs

Merged Francesco SARDARA requested to merge EPIC-OEL-1255-migrate-paragraphs into 1.x
77 files
+ 5263
2
Compare changes
  • Side-by-side
  • Inline
Files
77
+ 21
0
<?php
/**
* @file
* Theme functions for paragraphs.
*/
declare(strict_types = 1);
/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function oe_whitelabel_theme_suggestions_paragraph_alter(array &$suggestions, array $variables): void {
/** @var \Drupal\paragraphs\ParagraphInterface $paragraph */
$paragraph = $variables['elements']['#paragraph'];
if ($paragraph->bundle() === 'oe_content_row') {
$variant = $paragraph->get('oe_paragraphs_variant')->first()->value;
$suggestions[] = 'paragraph__' . $paragraph->bundle() . '__variant_' . $variant;
}
}
Loading