You are here

protected function ActionWebformHandler::displayDebug in Webform 6.x

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

Display debugging information about the current action.

Parameters

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

1 call to ActionWebformHandler::displayDebug()
ActionWebformHandler::executeAction in src/Plugin/WebformHandler/ActionWebformHandler.php
Execute this action.

File

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

Class

ActionWebformHandler
Webform submission action handler.

Namespace

Drupal\webform\Plugin\WebformHandler

Code

protected function displayDebug(WebformSubmissionInterface $webform_submission) {
  if (!$this->configuration['debug']) {
    return;
  }
  $build = [
    '#type' => 'details',
    '#title' => $this
      ->t('Debug: Action: @title', [
      '@title' => $this
        ->label(),
    ]),
    '#open' => TRUE,
  ];
  $state = $webform_submission
    ->getWebform()
    ->getSetting('results_disabled') ? WebformSubmissionInterface::STATE_COMPLETED : $webform_submission
    ->getState();
  $build['state'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('State'),
    '#markup' => $state,
    '#wrapper_attributes' => [
      'class' => [
        'container-inline',
      ],
      'style' => 'margin: 0',
    ],
  ];
  $build['sticky'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('Status'),
    '#markup' => $this->configuration['sticky'] === NULL ? '' : ($this->configuration['sticky'] ? $this
      ->t('Flagged/Starred') : $this
      ->t('Unflagged/Unstarred')),
    '#wrapper_attributes' => [
      'class' => [
        'container-inline',
      ],
      'style' => 'margin: 0',
    ],
  ];
  $build['locked'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('Lock'),
    '#markup' => $this->configuration['locked'] === NULL ? '' : ($this->configuration['locked'] ? $this
      ->t('Locked') : $this
      ->t('Unlocked')),
    '#wrapper_attributes' => [
      'class' => [
        'container-inline',
      ],
      'style' => 'margin: 0',
    ],
  ];
  $build['notes'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('Notes'),
    '#markup' => $this->configuration['notes'],
    '#wrapper_attributes' => [
      'class' => [
        'container-inline',
      ],
      'style' => 'margin: 0',
    ],
  ];
  $build['data'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('Data'),
    '#markup' => $this->configuration['notes'] ? '<pre>' . htmlentities($this->configuration['notes']) . '</pre>' : '',
    '#wrapper_attributes' => [
      'class' => [
        'container-inline',
      ],
      'style' => 'margin: 0',
    ],
  ];
  $build['message'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('Message'),
    '#markup' => $this->configuration['message'],
    '#wrapper_attributes' => [
      'class' => [
        'container-inline',
      ],
      'style' => 'margin: 0',
    ],
  ];
  $build['message_type'] = [
    '#type' => 'item',
    '#title' => $this
      ->t('Message type'),
    '#markup' => $this->configuration['message_type'],
    '#wrapper_attributes' => [
      'class' => [
        'container-inline',
      ],
      'style' => 'margin: 0',
    ],
  ];
  $this
    ->messenger()
    ->addWarning($this->renderer
    ->renderPlain($build), TRUE);
}