public function TestBoldTextBehavior::settingsIcon

Returns a short info icon for the current behavior settings.

Usually the information is in the form of an icon or a badge or some similar graphical representation.

Parameters

\Drupal\paragraphs\Entity\Paragraph $paragraph: The paragraph.

Return value

string[] The plugin settings.

Overrides ParagraphsBehaviorBase::settingsIcon

See also

ParagraphInterface::getIcons()

File

paragraphs/tests/modules/paragraphs_test/src/Plugin/paragraphs/Behavior/TestBoldTextBehavior.php, line 75

Class

TestBoldTextBehavior
Provides a test feature plugin.

Namespace

Drupal\paragraphs_test\Plugin\paragraphs\Behavior

Code

public function settingsIcon(Paragraph $paragraph) {
  $bold_setting = $paragraph
    ->getBehaviorSetting($this
    ->getPluginId(), 'bold_text');
  if ($bold_setting) {
    return [
      'bold' => [
        '#theme' => 'paragraphs_info_icon',
        '#message' => $this
          ->t('Bold: Yes.'),
        '#icon' => 'bold',
      ],
    ];
  }
  return [];
}