public function ContainerBase::form in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformElement/ContainerBase.php \Drupal\webform\Plugin\WebformElement\ContainerBase::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 WebformElementBase::form
5 calls to ContainerBase::form()
- WebformActions::form in src/
Plugin/ WebformElement/ WebformActions.php - Gets the actual configuration webform array to be built.
- WebformCard::form in modules/
webform_cards/ src/ Plugin/ WebformElement/ WebformCard.php - Gets the actual configuration webform array to be built.
- WebformFlexbox::form in src/
Plugin/ WebformElement/ WebformFlexbox.php - Gets the actual configuration webform array to be built.
- WebformSection::form in src/
Plugin/ WebformElement/ WebformSection.php - Gets the actual configuration webform array to be built.
- WebformWizardPage::form in src/
Plugin/ WebformElement/ WebformWizardPage.php - Gets the actual configuration webform array to be built.
5 methods override ContainerBase::form()
- WebformActions::form in src/
Plugin/ WebformElement/ WebformActions.php - Gets the actual configuration webform array to be built.
- WebformCard::form in modules/
webform_cards/ src/ Plugin/ WebformElement/ WebformCard.php - Gets the actual configuration webform array to be built.
- WebformFlexbox::form in src/
Plugin/ WebformElement/ WebformFlexbox.php - Gets the actual configuration webform array to be built.
- WebformSection::form in src/
Plugin/ WebformElement/ WebformSection.php - Gets the actual configuration webform array to be built.
- WebformWizardPage::form in src/
Plugin/ WebformElement/ WebformWizardPage.php - Gets the actual configuration webform array to be built.
File
- src/
Plugin/ WebformElement/ ContainerBase.php, line 252
Class
- ContainerBase
- Provides a base 'container' class.
Namespace
Drupal\webform\Plugin\WebformElementCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
// Randomize.
$form['element']['randomize'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Randomize elements'),
'#description' => $this
->t('Randomizes the order of the sub-element when they are displayed in the webform.'),
'#return_value' => TRUE,
];
// Containers are wrappers, therefore wrapper classes should be used by the
// container element.
$form['element_attributes']['attributes']['#classes'] = $this->configFactory
->get('webform.settings')
->get('element.wrapper_classes');
// Containers can only hide the title using #title_display: invisible.
// @see fieldset.html.twig
// @see webform-section.html.twig
$form['form']['display_container']['title_display']['#options'] = [
'invisible' => $this
->t('Invisible'),
];
return $form;
}