You are here

protected function OptionsLimitWebformHandler::setElementLimitReachedMessage in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php \Drupal\webform_options_limit\Plugin\WebformHandler\OptionsLimitWebformHandler::setElementLimitReachedMessage()

Set element's limit reached message.

Parameters

array $element: An element with limits.

2 calls to OptionsLimitWebformHandler::setElementLimitReachedMessage()
OptionsLimitWebformHandler::alterBooleanElement in modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php
Alter a boolean element's.
OptionsLimitWebformHandler::alterOptionsElement in modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php
Alter an options element.

File

modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php, line 565

Class

OptionsLimitWebformHandler
Webform options and boolean (boolean) limit handler.

Namespace

Drupal\webform_options_limit\Plugin\WebformHandler

Code

protected function setElementLimitReachedMessage(array &$element) {
  if (empty($this->configuration['limit_reached_message'])) {
    return;
  }
  $args = [
    '@name' => $this
      ->getElementLabel(),
  ];
  $element['#description'] = [
    '#type' => 'webform_message',
    '#message_type' => 'warning',
    '#message_message' => new FormattableMarkup($this->configuration['limit_reached_message'], $args),
  ];
}