class WebformUiEntityElementsForm in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_ui/src/WebformUiEntityElementsForm.php \Drupal\webform_ui\WebformUiEntityElementsForm
Webform manage elements UI form.
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, RedirectDestinationTrait, StringTranslationTrait
- class \Drupal\Core\Entity\EntityForm implements EntityFormInterface
- class \Drupal\Core\Entity\BundleEntityFormBase
- class \Drupal\webform_ui\WebformUiEntityElementsForm uses WebformEntityAjaxFormTrait
- class \Drupal\Core\Entity\BundleEntityFormBase
- class \Drupal\Core\Entity\EntityForm implements EntityFormInterface
Expanded class hierarchy of WebformUiEntityElementsForm
File
- modules/
webform_ui/ src/ WebformUiEntityElementsForm.php, line 24
Namespace
Drupal\webform_uiView source
class WebformUiEntityElementsForm extends BundleEntityFormBase {
use WebformEntityAjaxFormTrait;
/**
* Array of required states.
*
* @var array
*/
protected $requiredStates = [
'required' => 'required',
'!required' => '!required',
'optional' => 'optional',
'!optional' => '!optional',
];
/**
* The renderer.
*
* @var \Drupal\Core\Render\RendererInterface
*/
protected $renderer;
/**
* The element info manager.
*
* @var \Drupal\Core\Render\ElementInfoManagerInterface
*/
protected $elementInfo;
/**
* The webform element manager.
*
* @var \Drupal\webform\Plugin\WebformElementManagerInterface
*/
protected $elementManager;
/**
* The webform element validator.
*
* @var \Drupal\webform\WebformEntityElementsValidatorInterface
*/
protected $elementsValidator;
/**
* The webform token manager.
*
* @var \Drupal\webform\WebformTokenManagerInterface
*/
protected $tokenManager;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
$instance = parent::create($container);
$instance->renderer = $container
->get('renderer');
$instance->elementInfo = $container
->get('plugin.manager.element_info');
$instance->elementManager = $container
->get('plugin.manager.webform.element');
$instance->elementsValidator = $container
->get('webform.elements_validator');
return $instance;
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
/** @var \Drupal\webform\WebformInterface $webform */
$webform = $this
->getEntity();
$header = $this
->getTableHeader();
$elements = $this
->getOrderableElements();
// Get (weight) delta parent options.
$delta = count($elements);
$parent_options = $this
->getParentOptions($elements);
// Build table rows for elements.
$rows = [];
foreach ($elements as $element) {
$rows[$element['#webform_key']] = $this
->getElementRow($element, $delta, $parent_options);
}
$form['webform_ui_elements'] = [
'#type' => 'table',
'#header' => $header,
'#empty' => $this
->t('Please add elements to this webform.'),
'#attributes' => [
'class' => [
'webform-ui-elements-table',
],
],
'#tabledrag' => [
[
'action' => 'match',
'relationship' => 'parent',
'group' => 'row-parent-key',
'source' => 'row-key',
'hidden' => TRUE,
/* hides the WEIGHT & PARENT tree columns below */
'limit' => FALSE,
],
[
'action' => 'order',
'relationship' => 'sibling',
'group' => 'row-weight',
],
],
] + $rows;
if ($rows && !$webform
->hasActions()) {
$form['webform_ui_elements'] += [
'webform_actions_default' => $this
->getCustomizeActionsRow(),
];
}
// Must preload libraries required by (modal) dialogs.
WebformDialogHelper::attachLibraries($form);
$form['#attached']['library'][] = 'webform/webform.admin.tabledrag';
$form['#attached']['library'][] = 'webform_ui/webform_ui';
$form = parent::buildForm($form, $form_state);
return $this
->buildAjaxForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
/** @var \Drupal\webform\WebformInterface $webform */
$webform = $this
->getEntity();
// Get raw flattened elements that will be used to rebuild element's YAML
// hierarchy.
$elements_flattened = $webform
->getElementsDecodedAndFlattened();
// Get the reordered elements and sort them by weight.
$webform_ui_elements = $form_state
->getValue('webform_ui_elements') ?: [];
uasort($webform_ui_elements, [
'Drupal\\Component\\Utility\\SortArray',
'sortByWeightElement',
]);
// Make sure the reordered element keys and match the existing element keys.
if (array_diff_key($webform_ui_elements, $elements_flattened)) {
$form_state
->setError($form['webform_ui_elements'], $this
->t('The elements have been unexpectedly altered. Please try again'));
}
// Validate parent key and add children to ordered elements.
foreach ($webform_ui_elements as $key => $table_element) {
// Validate parent key.
if ($parent_key = $table_element['parent_key']) {
// Validate missing parent key.
if (!isset($elements_flattened[$parent_key])) {
$form_state
->setError($form['webform_ui_elements'][$key]['parent']['parent_key'], $this
->t('Parent %parent_key does not exist.', [
'%parent_key' => $parent_key,
]));
continue;
}
// Validate the parent keys and make sure there
// are no recursive parents.
$parent_keys = [
$key,
];
$current_parent_key = $parent_key;
while ($current_parent_key) {
if (in_array($current_parent_key, $parent_keys)) {
$form_state
->setError($form['webform_ui_elements'][$key]['parent']['parent_key'], $this
->t('Parent %parent_key key is not valid.', [
'%parent_key' => $parent_key,
]));
break;
}
$parent_keys[] = $current_parent_key;
$current_parent_key = isset($webform_ui_elements[$current_parent_key]['parent_key']) ? $webform_ui_elements[$current_parent_key]['parent_key'] : NULL;
}
}
// Set #required or remove the property.
$is_conditionally_required = isset($elements_flattened[$key]['#states']) && array_intersect_key($this->requiredStates, $elements_flattened[$key]['#states']);
if ($is_conditionally_required) {
// Always unset conditionally required elements.
unset($elements_flattened[$key]['#required']);
}
elseif (isset($webform_ui_elements[$key]['required'])) {
if (empty($webform_ui_elements[$key]['required'])) {
unset($elements_flattened[$key]['#required']);
}
else {
$elements_flattened[$key]['#required'] = TRUE;
}
}
// Add this key to the parent's children.
$webform_ui_elements[$parent_key]['children'][$key] = $key;
}
if ($form_state
->hasAnyErrors()) {
return;
}
// Rebuild elements to reflect new hierarchy.
$elements_updated = [];
// Preserve the original elements root properties.
$elements_original = Yaml::decode($webform
->get('elements')) ?: [];
foreach ($elements_original as $key => $value) {
if (WebformElementHelper::property($key)) {
$elements_updated[$key] = $value;
}
}
$this
->buildUpdatedElementsRecursive($elements_updated, '', $webform_ui_elements, $elements_flattened);
// Update the webform's elements.
$webform
->setUpdating()
->setElements($elements_updated);
// Validate only elements required, hierarchy, and rendering.
$validate_options = [
'required' => TRUE,
'yaml' => FALSE,
'array' => FALSE,
'names' => FALSE,
'properties' => FALSE,
'submissions' => FALSE,
'hierarchy' => TRUE,
'rendering' => TRUE,
];
if ($this->elementsValidator
->validate($webform, $validate_options)) {
$form_state
->setErrorByName(NULL, $this
->t('There has been error validating the elements.'));
}
}
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
/** @var \Drupal\webform\WebformInterface $webform */
$webform = $this
->getEntity();
$webform
->save();
$context = [
'@label' => $webform
->label(),
'link' => $webform
->toLink($this
->t('Edit'), 'edit-form')
->toString(),
];
$t_args = [
'%label' => $webform
->label(),
];
$this
->logger('webform')
->notice('Webform @label elements saved.', $context);
$this
->messenger()
->addStatus($this
->t('Webform %label elements saved.', $t_args));
}
/**
* {@inheritdoc}
*/
protected function actionsElement(array $form, FormStateInterface $form_state) {
$form = parent::actionsElement($form, $form_state);
$form['submit']['#value'] = $this
->t('Save elements');
unset($form['delete']);
return $form;
}
/**
* Build updated elements using the new parent child relationship.
*
* @param array $elements
* An associative array that will be populated with updated elements
* hierarchy.
* @param string $key
* The current element key. The blank empty key represents the elements
* root.
* @param array $webform_ui_elements
* An associative array contain the reordered elements parent child
* relationship.
* @param array $elements_flattened
* An associative array containing the raw flattened elements that will
* copied into the updated elements hierarchy.
*/
protected function buildUpdatedElementsRecursive(array &$elements, $key, array $webform_ui_elements, array $elements_flattened) {
if (!isset($webform_ui_elements[$key]['children'])) {
return;
}
foreach ($webform_ui_elements[$key]['children'] as $key) {
$elements[$key] = $elements_flattened[$key];
$this
->buildUpdatedElementsRecursive($elements[$key], $key, $webform_ui_elements, $elements_flattened);
}
}
/**
* Get webform's elements as an associative array of orderable elements.
*
* @return array
* An associative array of orderable elements.
*/
protected function getOrderableElements() {
/** @var \Drupal\webform\WebformInterface $webform */
$webform = $this
->getEntity();
$elements = $webform
->getElementsInitializedAndFlattened();
$weights = [];
foreach ($elements as $element_key => &$element) {
$parent_key = $element['#webform_parent_key'];
if (!isset($weights[$parent_key])) {
$element['#weight'] = $weights[$parent_key] = 0;
}
else {
$element['#weight'] = ++$weights[$parent_key];
}
if (empty($element['#type'])) {
if (isset($element['#theme'])) {
$element['#type'] = $element['#theme'];
}
else {
$element['#type'] = '';
}
}
if (empty($element['#title'])) {
if (!empty($element['#markup'])) {
$element['#title'] = Markup::create(Unicode::truncate(strip_tags($element['#markup']), 100, TRUE, TRUE));
}
else {
$element['#title'] = '[' . $element_key . ']';
}
}
}
return $elements;
}
/**
* Gets the elements table header.
*
* @return array
* The header elements.
*/
protected function getTableHeader() {
/** @var \Drupal\webform\WebformInterface $webform */
$webform = $this
->getEntity();
$header = [];
$header['title'] = $this
->t('Title');
if ($webform
->hasContainer()) {
$header['add'] = [
'data' => '',
'class' => [
'webform-ui-element-operations',
],
];
}
$header['key'] = [
'data' => $this
->t('Key'),
'class' => [
RESPONSIVE_PRIORITY_LOW,
],
];
$header['type'] = [
'data' => $this
->t('Type'),
'class' => [
RESPONSIVE_PRIORITY_LOW,
],
];
if ($webform
->hasFlexboxLayout()) {
$header['flex'] = [
'data' => $this
->t('Flex'),
'class' => [
RESPONSIVE_PRIORITY_LOW,
],
];
}
if ($webform
->hasConditions()) {
$header['conditions'] = [
'data' => $this
->t('Conditional'),
'class' => [
RESPONSIVE_PRIORITY_LOW,
],
];
}
$header['required'] = [
'data' => $this
->t('Required'),
'class' => [
'webform-ui-element-required',
RESPONSIVE_PRIORITY_LOW,
],
];
$header['weight'] = [
'data' => $this
->t('Weight'),
'class' => [
'webform-tabledrag-hide',
],
];
$header['parent'] = [
'data' => $this
->t('Parent'),
'class' => [
'webform-tabledrag-hide',
],
];
$header['operations'] = [
'data' => $this
->t('Operations'),
'class' => [
'webform-ui-element-operations',
],
];
return $header;
}
/**
* Get parent (container) elements as options.
*
* @param array $elements
* A flattened array of elements.
*
* @return array
* Parent (container) elements as options.
*/
protected function getParentOptions(array $elements) {
$options = [];
foreach ($elements as $key => $element) {
$plugin_id = $this->elementManager
->getElementPluginId($element);
$webform_element = $this->elementManager
->createInstance($plugin_id);
if ($webform_element
->isContainer($element)) {
$options[$key] = $element['#admin_title'] ?: $element['#title'];
}
}
return $options;
}
/**
* Gets an row for a single element.
*
* @param array $element
* Webform element.
* @param int $delta
* The number of elements.
* @param array $parent_options
* An associative array of parent (container) options.
*
* @return array
* The row for the element.
*/
protected function getElementRow(array $element, $delta, array $parent_options) {
/** @var \Drupal\webform\WebformInterface $webform */
$webform = $this
->getEntity();
$row = [];
$element_state_options = OptGroup::flattenOptions(WebformElementStates::getStateOptions());
$key = $element['#webform_key'];
$title = $element['#admin_title'] ?: $element['#title'];
$title = is_array($title) ? $this->renderer
->render($title) : $title;
$plugin_id = $this->elementManager
->getElementPluginId($element);
/** @var \Drupal\webform\Plugin\WebformElementInterface $webform_element */
$webform_element = $this->elementManager
->createInstance($plugin_id);
$offcanvas_dialog_attributes = WebformDialogHelper::getOffCanvasDialogAttributes($webform_element
->getOffCanvasWidth());
$is_container = $webform_element
->isContainer($element);
$is_root = $webform_element
->isRoot();
$is_element_disabled = $webform_element
->isDisabled();
$is_access_disabled = !Element::isVisibleElement($element);
// If disabled, display warning.
if ($is_element_disabled) {
$webform_element
->displayDisabledWarning($element);
}
// Get row class names.
$row_class = [
'draggable',
];
if ($is_root) {
$row_class[] = 'tabledrag-root';
$row_class[] = 'webform-ui-element-root';
}
if (!$is_container) {
$row_class[] = 'tabledrag-leaf';
}
if ($is_container) {
$row_class[] = 'webform-ui-element-container';
}
if (!empty($element['#type'])) {
$row_class[] = 'webform-ui-element-type-' . $element['#type'];
}
else {
$row_class[] = 'webform-ui-element-container';
}
if ($is_element_disabled || $is_access_disabled) {
$row_class[] = 'webform-ui-element-disabled';
}
// Add element key and type.
$row['#attributes']['data-webform-key'] = $element['#webform_key'];
$row['#attributes']['data-webform-type'] = isset($element['#type']) ? $element['#type'] : '';
$row['#attributes']['class'] = $row_class;
$indentation = NULL;
if ($element['#webform_depth']) {
$indentation = [
'#theme' => 'indentation',
'#size' => $element['#webform_depth'],
];
}
$row['title'] = [
'link' => [
'#type' => 'link',
'#title' => $element['#admin_title'] ?: $element['#title'],
'#url' => new Url('entity.webform_ui.element.edit_form', [
'webform' => $webform
->id(),
'key' => $key,
]),
'#attributes' => $offcanvas_dialog_attributes,
'#prefix' => !empty($indentation) ? $this->renderer
->renderPlain($indentation) : '',
],
];
if (!empty($element['#admin_notes'])) {
$row['title']['notes'] = [
'#type' => 'webform_help',
'#help_title' => $element['#admin_title'] ?: $element['#title'],
'#help' => $element['#admin_notes'],
'#weight' => 100,
];
}
if ($webform
->hasContainer()) {
if ($is_container) {
$route_parameters = [
'webform' => $webform
->id(),
];
$route_options = [
'query' => [
'parent' => $key,
],
];
if ($webform_element instanceof WebformTable) {
$route_parameters['type'] = 'webform_table_row';
$row['add'] = [
'#type' => 'link',
'#title' => $this
->t('Add <span>row</span>'),
'#url' => new Url('entity.webform_ui.element.add_form', $route_parameters, $route_options),
'#attributes' => WebformDialogHelper::getOffCanvasDialogAttributes(WebformDialogHelper::DIALOG_NORMAL, [
'button',
'button-action',
'button--primary',
'button--small',
]),
];
}
else {
$row['add'] = [
'#type' => 'link',
'#title' => $this
->t('Add <span>element</span>'),
'#url' => new Url('entity.webform_ui.element', $route_parameters, $route_options),
'#attributes' => WebformDialogHelper::getModalDialogAttributes(WebformDialogHelper::DIALOG_NORMAL, [
'button',
'button-action',
'button--primary',
'button--small',
]),
];
}
}
else {
$row['add'] = [
'#markup' => '',
];
}
}
$row['name'] = [
'#markup' => $element['#webform_key'],
];
$type = $webform_element
->getPluginLabel();
if ($webform_element instanceof WebformElement) {
if (!empty($element['#type'])) {
$type = '[' . $element['#type'] . ']';
}
elseif (isset($element['#theme'])) {
$type = '[' . $element['#theme'] . ']';
}
}
$row['type'] = [
'#markup' => $type,
];
if ($webform
->hasFlexboxLayout()) {
$row['flex'] = [
'#markup' => empty($element['#flex']) ? 1 : $element['#flex'],
];
}
$is_conditionally_required = FALSE;
if ($webform
->hasConditions()) {
$states = [];
if (!empty($element['#states'])) {
$states = array_intersect_key($element_state_options, $element['#states']);
$is_conditionally_required = array_intersect_key($this->requiredStates, $element['#states']);
}
$row['conditional'] = [
'#type' => 'link',
'#title' => implode('; ', $states),
'#url' => new Url('entity.webform_ui.element.edit_form', [
'webform' => $webform
->id(),
'key' => $key,
]),
'#attributes' => $offcanvas_dialog_attributes + [
// Add custom hash to current page's location.
// @see Drupal.behaviors.webformAjaxLink
'data-hash' => 'webform-tab--conditions',
'title' => $this
->t('Edit @states conditional', [
'@states' => implode('; ', $states),
]),
'aria-label' => $this
->t('Edit @states conditional', [
'@states' => implode('; ', $states),
]),
],
];
}
if ($webform_element
->hasProperty('required')) {
$row['required'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Required for @title', [
'@title' => $title,
]),
'#title_display' => 'invisible',
'#default_value' => empty($element['#required']) ? FALSE : TRUE,
];
if ($is_conditionally_required) {
$row['required']['#default_value'] = TRUE;
$row['required']['#disabled'] = TRUE;
}
}
else {
$row['required'] = [
'#markup' => '',
];
}
$row['weight'] = [
'#type' => 'weight',
'#title' => $this
->t('Weight for @title', [
'@title' => $title,
]),
'#title_display' => 'invisible',
'#default_value' => $element['#weight'],
'#wrapper_attributes' => [
'class' => [
'webform-tabledrag-hide',
],
],
'#attributes' => [
'class' => [
'row-weight',
],
],
'#delta' => $delta,
];
$row['parent'] = [
'#wrapper_attributes' => [
'class' => [
'webform-tabledrag-hide',
],
],
];
$row['parent']['key'] = [
'#parents' => [
'webform_ui_elements',
$key,
'key',
],
'#type' => 'hidden',
'#value' => $key,
'#attributes' => [
'class' => [
'row-key',
],
],
];
if ($parent_options) {
$row['parent']['parent_key'] = [
'#parents' => [
'webform_ui_elements',
$key,
'parent_key',
],
'#type' => 'select',
'#options' => $parent_options,
'#empty_option' => '',
'#title' => $this
->t('Parent element @title', [
'@title' => $title,
]),
'#title_display' => 'invisible',
'#default_value' => $element['#webform_parent_key'],
'#attributes' => [
'class' => [
'row-parent-key',
],
],
];
}
else {
$row['parent']['parent_key'] = [
'#parents' => [
'webform_ui_elements',
$key,
'parent_key',
],
'#type' => 'hidden',
'#default_value' => '',
'#attributes' => [
'class' => [
'row-parent-key',
],
],
];
}
$row['operations'] = [
'#type' => 'operations',
'#prefix' => '<div class="webform-dropbutton">',
'#suffix' => '</div>',
];
$row['operations']['#links']['edit'] = [
'title' => $this
->t('Edit'),
'url' => new Url('entity.webform_ui.element.edit_form', [
'webform' => $webform
->id(),
'key' => $key,
]),
'attributes' => $offcanvas_dialog_attributes,
];
// Issue #2741877 Nested modals don't work: when using CKEditor in a
// modal, then clicking the image button opens another modal,
// which closes the original modal.
// @todo Remove the below workaround once this issue is resolved.
if ($webform_element
->getPluginId() === 'processed_text' && !WebformDialogHelper::useOffCanvas()) {
unset($row['operations']['#links']['edit']['attributes']);
}
if (!$is_container) {
$row['operations']['#links']['duplicate'] = [
'title' => $this
->t('Duplicate'),
'url' => new Url('entity.webform_ui.element.duplicate_form', [
'webform' => $webform
->id(),
'key' => $key,
]),
'attributes' => $offcanvas_dialog_attributes,
];
}
$row['operations']['#links']['delete'] = [
'title' => $this
->t('Delete'),
'url' => new Url('entity.webform_ui.element.delete_form', [
'webform' => $webform
->id(),
'key' => $key,
]),
'attributes' => WebformDialogHelper::getModalDialogAttributes(WebformDialogHelper::DIALOG_NARROW),
];
return $row;
}
/**
* Get customize actions row.
*
* @return array
* The customize actions row.
*/
protected function getCustomizeActionsRow() {
/** @var \Drupal\webform\WebformInterface $webform */
$webform = $this
->getEntity();
$row = [];
$row['#attributes']['class'] = [
'webform-ui-element-type-webform_actions',
];
$row['title'] = [
'#type' => 'link',
'#title' => $this
->t('Submit button(s)'),
'#url' => new Url('entity.webform_ui.element.add_form', [
'webform' => $webform
->id(),
'type' => 'webform_actions',
], [
'query' => [
'key' => 'actions',
],
]),
'#attributes' => WebformDialogHelper::getOffCanvasDialogAttributes(),
];
if ($webform
->hasContainer()) {
$row['add'] = [
'#markup' => '',
];
}
$row['name'] = [
'#markup' => 'actions',
];
$row['type'] = [
'#markup' => $this
->t('Submit button(s)'),
];
if ($webform
->hasFlexboxLayout()) {
$row['flex'] = [
'#markup' => 1,
];
}
if ($webform
->hasConditions()) {
$row['conditions'] = [
'#markup' => '',
];
}
$row['required'] = [
'#markup' => '',
];
$row['weight'] = [
'#markup' => '',
'#wrapper_attributes' => [
'class' => [
'webform-tabledrag-hide',
],
],
];
$row['parent'] = [
'#markup' => '',
'#wrapper_attributes' => [
'class' => [
'webform-tabledrag-hide',
],
],
];
if ($this->elementManager
->isExcluded('webform_actions')) {
$row['operations'] = [
'#markup' => '',
];
}
else {
$row['operations'] = [
'#type' => 'operations',
'#prefix' => '<div class="webform-dropbutton">',
'#suffix' => '</div>',
];
$row['operations']['#links']['customize'] = [
'title' => $this
->t('Customize'),
'url' => new Url('entity.webform_ui.element.add_form', [
'webform' => $webform
->id(),
'type' => 'webform_actions',
]),
'attributes' => WebformDialogHelper::getOffCanvasDialogAttributes(),
];
}
return $row;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BundleEntityFormBase:: |
protected | function | Protects the bundle entity's ID property's form element against changes. | |
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
EntityForm:: |
protected | property | The entity being used by this form. | 11 |
EntityForm:: |
protected | property | The entity type manager. | 3 |
EntityForm:: |
protected | property | The module handler service. | |
EntityForm:: |
protected | property | The name of the current operation. | |
EntityForm:: |
public | function | Form element #after_build callback: Updates the entity with submitted data. | |
EntityForm:: |
public | function |
Builds an updated entity object based upon the submitted form values. Overrides EntityFormInterface:: |
3 |
EntityForm:: |
protected | function | Copies top-level form values to entity properties. | 9 |
EntityForm:: |
public | function | Gets the actual form array to be built. | 36 |
EntityForm:: |
public | function |
Returns a string identifying the base form. Overrides BaseFormIdInterface:: |
6 |
EntityForm:: |
public | function |
Gets the form entity. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function |
Determines which entity will be used by this form from a RouteMatch object. Overrides EntityFormInterface:: |
3 |
EntityForm:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
12 |
EntityForm:: |
public | function |
Gets the operation identifying the form. Overrides EntityFormInterface:: |
|
EntityForm:: |
protected | function | Initialize the form state and the entity before the first form build. | 3 |
EntityForm:: |
protected | function | Prepares the entity object before the form is built first. | 3 |
EntityForm:: |
protected | function | Invokes the specified prepare hook variant. | |
EntityForm:: |
public | function | Process callback: assigns weights and hides extra fields. | |
EntityForm:: |
public | function |
Sets the form entity. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function |
Sets the entity type manager for this form. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function |
Sets the module handler for this form. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function |
Sets the operation for this form. Overrides EntityFormInterface:: |
|
EntityForm:: |
public | function |
This is the default entity object builder function. It is called before any
other submit handler to build the new entity object to be used by the
following submit handlers. At this point of the form workflow the entity is
validated and the form state… Overrides FormInterface:: |
20 |
FormBase:: |
protected | property | The config factory. | 3 |
FormBase:: |
protected | property | The request stack. | 1 |
FormBase:: |
protected | property | The route match. | |
FormBase:: |
protected | function | Retrieves a configuration object. | |
FormBase:: |
protected | function | Gets the config factory for this form. | 3 |
FormBase:: |
private | function | Returns the service container. | |
FormBase:: |
protected | function | Gets the current user. | |
FormBase:: |
protected | function | Gets the request object. | |
FormBase:: |
protected | function | Gets the route match. | |
FormBase:: |
protected | function | Gets the logger for a specific channel. | |
FormBase:: |
protected | function | Returns a redirect response object for the specified route. | |
FormBase:: |
public | function | Resets the configuration factory. | |
FormBase:: |
public | function | Sets the config factory for this form. | |
FormBase:: |
public | function | Sets the request stack object to use. | |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. | |
MessengerTrait:: |
protected | property | The messenger. | 27 |
MessengerTrait:: |
public | function | Gets the messenger. | 27 |
MessengerTrait:: |
public | function | Sets the messenger. | |
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
WebformAjaxFormTrait:: |
protected | function | Queue announcement with Ajax response. | |
WebformAjaxFormTrait:: |
protected | function | Add Ajax support to a form. | |
WebformAjaxFormTrait:: |
protected | function | Create an AjaxResponse or WebformAjaxResponse object. | |
WebformAjaxFormTrait:: |
protected | function | Get announcements. | |
WebformAjaxFormTrait:: |
protected | function | Get redirect URL from the form's state. | |
WebformAjaxFormTrait:: |
protected | function | Get the form's Ajax wrapper id. | 1 |
WebformAjaxFormTrait:: |
protected | function | Determine if Ajax callback is callable. | |
WebformAjaxFormTrait:: |
protected | function | Is the current request for an Ajax modal/dialog. | |
WebformAjaxFormTrait:: |
protected | function | Is the current request for an off canvas dialog. | |
WebformAjaxFormTrait:: |
protected | function | Handle missing Ajax callback. | |
WebformAjaxFormTrait:: |
public | function | Empty submit callback used to only have the submit button to use an #ajax submit callback. | 1 |
WebformAjaxFormTrait:: |
protected | function | Reset announcements. | |
WebformAjaxFormTrait:: |
protected | function | Set announcements. | |
WebformAjaxFormTrait:: |
public | function | Submit form #ajax callback. | 1 |
WebformAjaxFormTrait:: |
public | function | Validate form #ajax callback. | 1 |
WebformEntityAjaxFormTrait:: |
protected | function | ||
WebformEntityAjaxFormTrait:: |
public | function |
Cancel form #ajax callback. Overrides WebformAjaxFormTrait:: |
|
WebformEntityAjaxFormTrait:: |
protected | function |
Get default ajax callback settings. Overrides WebformAjaxFormTrait:: |
|
WebformEntityAjaxFormTrait:: |
protected | function |
Returns if webform is using Ajax. Overrides WebformAjaxFormTrait:: |
|
WebformEntityAjaxFormTrait:: |
protected | function | Determine if dialogs are disabled. | |
WebformEntityAjaxFormTrait:: |
protected | function |
Replace form via an Ajax response. Overrides WebformAjaxFormTrait:: |
|
WebformUiEntityElementsForm:: |
protected | property | The element info manager. | |
WebformUiEntityElementsForm:: |
protected | property | The webform element manager. | |
WebformUiEntityElementsForm:: |
protected | property | The webform element validator. | |
WebformUiEntityElementsForm:: |
protected | property | The renderer. | |
WebformUiEntityElementsForm:: |
protected | property | Array of required states. | |
WebformUiEntityElementsForm:: |
protected | property | The webform token manager. | |
WebformUiEntityElementsForm:: |
protected | function |
Returns the action form element for the current entity form. Overrides EntityForm:: |
|
WebformUiEntityElementsForm:: |
public | function |
Form constructor. Overrides WebformEntityAjaxFormTrait:: |
|
WebformUiEntityElementsForm:: |
protected | function | Build updated elements using the new parent child relationship. | |
WebformUiEntityElementsForm:: |
public static | function |
Instantiates a new instance of this class. Overrides FormBase:: |
|
WebformUiEntityElementsForm:: |
protected | function | Get customize actions row. | |
WebformUiEntityElementsForm:: |
protected | function | Gets an row for a single element. | |
WebformUiEntityElementsForm:: |
protected | function | Get webform's elements as an associative array of orderable elements. | |
WebformUiEntityElementsForm:: |
protected | function | Get parent (container) elements as options. | |
WebformUiEntityElementsForm:: |
protected | function | Gets the elements table header. | |
WebformUiEntityElementsForm:: |
public | function |
Form submission handler for the 'save' action. Overrides EntityForm:: |
|
WebformUiEntityElementsForm:: |
public | function |
Form validation handler. Overrides FormBase:: |