public function ParagraphsStylePlugin::getStyleTemplates

Get the template setting of the styles of the Paragraph.

Parameters

\Drupal\paragraphs\ParagraphInterface $paragraph: The paragraph.

Return value

string[] The template setting of the selected styles.

File

paragraphs_collection/src/Plugin/paragraphs/Behavior/ParagraphsStylePlugin.php, line 345

Class

ParagraphsStylePlugin
Provides style selection plugin.

Namespace

Drupal\paragraphs_collection\Plugin\paragraphs\Behavior

Code

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;
}