Get the template setting of the styles of the Paragraph.
\Drupal\paragraphs\ParagraphInterface $paragraph: The paragraph.
string[] The template setting of the selected styles.
public function getStyleTemplates(ParagraphInterface $paragraph) {
if ($paragraph
->getParagraphType()
->hasEnabledBehaviorPlugin('style')) {
$templates = [];
$paragraph_styles = $this
->getStyles($paragraph);
foreach ($paragraph_styles as $group_name => $paragraph_style) {
if ($style = $this->yamlStyleDiscovery
->getStyle($paragraph_style)) {
if (!empty($style['template'])) {
$templates[] = $style['template'];
}
}
}
return $templates;
}
return NULL;
}