You are here

public function ParagraphsWidget::createMessage in Paragraphs 8

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 src/Plugin/Field/FieldWidget/ParagraphsWidget.php
Add 'add more' button, if not working with a programmed form.

File

src/Plugin/Field/FieldWidget/ParagraphsWidget.php, line 1478

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