public function ParagraphsWidget::createMessage

Helper to create a paragraph UI message.

Parameters

string $message: Message text.

string $type: Message type.

Return value

array Render array of message.

1 call to ParagraphsWidget::createMessage()
ParagraphsWidget::buildAddActions in paragraphs/src/Plugin/Field/FieldWidget/ParagraphsWidget.php
Add 'add more' button, if not working with a programmed form.

File

paragraphs/src/Plugin/Field/FieldWidget/ParagraphsWidget.php, line 1723

Class

ParagraphsWidget
Plugin implementation of the 'entity_reference_revisions paragraphs' widget.

Namespace

Drupal\paragraphs\Plugin\Field\FieldWidget

Code

public function createMessage($message, $type = 'warning') {
  return [
    '#type' => 'container',
    '#markup' => $message,
    '#attributes' => [
      'class' => [
        'messages',
        'messages--' . $type,
      ],
    ],
  ];
}