public function Hidden::form in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformElement/Hidden.php \Drupal\webform\Plugin\WebformElement\Hidden::form()
Gets the actual configuration webform array to be built.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array An associative array contain the element's configuration webform without any default values.
Overrides TextBase::form
File
- src/
Plugin/ WebformElement/ Hidden.php, line 62
Class
- Hidden
- Provides a 'hidden' element.
Namespace
Drupal\webform\Plugin\WebformElementCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
// Remove the default section under the advanced tab.
unset($form['default']);
// Add the default value textarea to the element's main settings.
$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;
}