
| Current Path : /var/www/html/c12park/web/modules/contrib/webform/src/Plugin/WebformElement/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/c12park/web/modules/contrib/webform/src/Plugin/WebformElement/WebformComputedTwig.php |
<?php
namespace Drupal\webform\Plugin\WebformElement;
use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\Twig\WebformTwigExtension;
use Drupal\webform\Utility\WebformElementHelper;
/**
* Provides a 'webform_computed_twig' element.
*
* @WebformElement(
* id = "webform_computed_twig",
* label = @Translation("Computed Twig"),
* description = @Translation("Provides an item to display computed webform submission values using Twig."),
* category = @Translation("Computed Elements"),
* )
*/
class WebformComputedTwig extends WebformComputedBase {
/**
* {@inheritdoc}
*/
protected function defineDefaultProperties() {
return [
'whitespace' => '',
] + parent::defineDefaultProperties();
}
/* ************************************************************************ */
/**
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['computed']['help'] = WebformTwigExtension::buildTwigHelp();
$form['computed']['template']['#mode'] = 'twig';
// Set #access so that help is always visible.
WebformElementHelper::setPropertyRecursive($form['computed']['help'], '#access', TRUE);
return $form;
}
}