You are here

public function ActionWebformHandler::getSummary in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformHandler/ActionWebformHandler.php \Drupal\webform\Plugin\WebformHandler\ActionWebformHandler::getSummary()

Returns a render array summarizing the configuration of the webform handler.

Return value

array A render array.

Overrides WebformHandlerBase::getSummary

File

src/Plugin/WebformHandler/ActionWebformHandler.php, line 47

Class

ActionWebformHandler
Webform submission action handler.

Namespace

Drupal\webform\Plugin\WebformHandler

Code

public function getSummary() {
  $settings = $this
    ->getSettings();

  // Get state labels.
  $states = [
    WebformSubmissionInterface::STATE_DRAFT_CREATED => $this
      ->t('Draft created'),
    WebformSubmissionInterface::STATE_DRAFT_UPDATED => $this
      ->t('Draft updated'),
    WebformSubmissionInterface::STATE_CONVERTED => $this
      ->t('Converted'),
    WebformSubmissionInterface::STATE_COMPLETED => $this
      ->t('Completed'),
    WebformSubmissionInterface::STATE_UPDATED => $this
      ->t('Updated'),
    WebformSubmissionInterface::STATE_LOCKED => $this
      ->t('Locked'),
  ];
  $settings['states'] = array_intersect_key($states, array_combine($settings['states'], $settings['states']));

  // Get message type.
  $message_types = [
    'status' => $this
      ->t('Status'),
    'error' => $this
      ->t('Error'),
    'warning' => $this
      ->t('Warning'),
    'info' => $this
      ->t('Info'),
  ];
  $settings['message'] = $settings['message'] ? WebformHtmlEditor::checkMarkup($settings['message']) : NULL;
  $settings['message_type'] = $message_types[$settings['message_type']];

  // Get data element keys.
  $data = Yaml::decode($settings['data']) ?: [];
  $settings['data'] = array_keys($data);
  return [
    '#settings' => $settings,
  ] + parent::getSummary();
}