You are here

protected function WebformOptionsCustomForm::buildTwigHelp in Webform 8.5

Same name and namespace in other branches
  1. 6.x modules/webform_options_custom/src/WebformOptionsCustomForm.php \Drupal\webform_options_custom\WebformOptionsCustomForm::buildTwigHelp()

Build Twig help.

Return value

array A renderable array container Twig help.

1 call to WebformOptionsCustomForm::buildTwigHelp()
WebformOptionsCustomForm::form in modules/webform_options_custom/src/WebformOptionsCustomForm.php
Gets the actual form array to be built.

File

modules/webform_options_custom/src/WebformOptionsCustomForm.php, line 345

Class

WebformOptionsCustomForm
Provides a form to set webform options custom.

Namespace

Drupal\webform_options_custom

Code

protected function buildTwigHelp() {

  // Build custom options specific Twig help.
  // @see \Drupal\webform\Twig\WebformTwigExtension::buildTwigHelp
  $t_args = [
    ':twig_href' => 'https://twig.sensiolabs.org/',
    ':drupal_href' => 'https://www.drupal.org/docs/8/theming/twig',
  ];
  $build = [];
  $build[] = [
    '#markup' => '<p>' . $this
      ->t('Learn about <a href=":twig_href">Twig</a> and how it is used in <a href=":drupal_href">Drupal</a>.', $t_args) . '</p>',
  ];
  $build[] = [
    '#markup' => '<p>' . $this
      ->t("The following variables are available:") . '</p>',
  ];
  $build[] = [
    '#theme' => 'item_list',
    '#items' => [
      '{{ type }}',
      '{{ title }}',
      '{{ description }}',
      '{{ help }}',
      '{{ options }}',
      '{{ options_custom }}',
      '{{ descriptions }}',
      '{{ default_value }}',
      '{{ multiple }}',
      '{{ attributes }}',
      '{{ empty_option }}',
      '{{ empty_value }}',
    ],
  ];
  $build[] = [
    '#markup' => '<p>' . $this
      ->t("You can debug data using the <code>webform_debug()</code> function.") . '</p>',
  ];
  $build[] = [
    '#markup' => "<pre>{{ webform_debug(data) }}</pre>",
  ];
  return $build;
}