You are here

protected function OptionsLimitWebformHandler::getElementLimitStatusMessage 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::getElementLimitStatusMessage()

Get an options or boolean element's limit status message.

Parameters

string $type: Type of message.

array $limit: Associative array containing limit, total, remaining, and label.

Return value

\Drupal\Component\Render\FormattableMarkup|string A limit status message.

4 calls to OptionsLimitWebformHandler::getElementLimitStatusMessage()
OptionsLimitWebformHandler::alterBooleanElement in modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php
Alter a boolean element's.
OptionsLimitWebformHandler::getOptionsLimitLabel in modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php
Get option limit label.
OptionsLimitWebformHandler::validateBooleanElement in modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php
Validate a boolean element with limit(s).
OptionsLimitWebformHandler::validateOptionsElement in modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php
Validate an options element with limit(s).

File

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

Class

OptionsLimitWebformHandler
Webform options and boolean (boolean) limit handler.

Namespace

Drupal\webform_options_limit\Plugin\WebformHandler

Code

protected function getElementLimitStatusMessage($type, array $limit) {
  $message = $this->configuration['option_' . $type . '_message'];
  if (!$message) {
    return '';
  }
  return new FormattableMarkup($message, [
    '@name' => $this
      ->getElementLabel(),
    '@label' => $limit['label'],
    '@limit' => $limit['limit'],
    '@total' => $limit['total'],
    '@remaining' => $limit['remaining'],
  ]);
}