function paragraphs_collection_theme_suggestions_paragraph_alter in Paragraphs Collection 8
Implements hook_theme_suggestions_HOOK_alter().
File
- ./
paragraphs_collection.module, line 26 - Contains paragraphs_collection.module
Code
function paragraphs_collection_theme_suggestions_paragraph_alter(array &$suggestions, array $variables) {
$paragraph = $variables['elements']['#paragraph'];
if ($paragraph
->getParagraphType()
->hasEnabledBehaviorPlugin('style')) {
if ($templates = $paragraph
->getParagraphType()
->getBehaviorPlugin('style')
->getStyleTemplates($paragraph)) {
foreach ($templates as $template) {
$suggestions[] = 'paragraph__' . $paragraph
->bundle() . '__' . $template;
}
return $suggestions;
}
}
}