Hidden.php in Webform 6.x
File
src/Plugin/WebformElement/Hidden.php
View source
<?php
namespace Drupal\webform\Plugin\WebformElement;
use Drupal\webform\WebformInterface;
use Drupal\Core\Form\FormStateInterface;
class Hidden extends TextBase {
protected function defineDefaultProperties() {
$access_properties = $this
->defineDefaultBaseProperties();
$access_properties = array_filter($access_properties, function ($access_default, $access_key) {
return strpos($access_key, 'access_') === 0;
}, ARRAY_FILTER_USE_BOTH);
return [
'title' => '',
'default_value' => '',
'prepopulate' => FALSE,
'private' => FALSE,
] + $access_properties;
}
public function preview() {
return [];
}
public function getTestValues(array $element, WebformInterface $webform, array $options = []) {
return NULL;
}
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
unset($form['default']);
$form['element']['default_value'] = [
'#type' => 'textarea',
'#title' => $this
->t('Default value'),
'#description' => $this
->t('The default value of the webform element.'),
'#maxlength' => NULL,
];
return $form;
}
}
Classes
Name |
Description |
Hidden |
Provides a 'hidden' element. |