public function AbstractFieldThirdPartySettingsFormEvent::addElements in Hook Event Dispatcher 8.2
Same name and namespace in other branches
- 3.x modules/field_event_dispatcher/src/Event/Field/AbstractFieldThirdPartySettingsFormEvent.php \Drupal\field_event_dispatcher\Event\Field\AbstractFieldThirdPartySettingsFormEvent::addElements()
Add third-party form elements to the form.
Alters the form structure so that each module's third-party form elements are correctly nested only under their module machine names.
Parameters
string $moduleName: The machine name of the module to add the third-party form elements for.
array $newElements: An array containing the third-party form elements to add.
See also
\Drupal\field_event_dispatcher\EventSubscriber\Form\FormEntityViewDisplayEditAlterEventSubscriber::formAlter()
File
- modules/
field_event_dispatcher/ src/ Event/ Field/ AbstractFieldThirdPartySettingsFormEvent.php, line 110
Class
- AbstractFieldThirdPartySettingsFormEvent
- Class AbstractFieldThirdPartySettingsFormEvent.
Namespace
Drupal\field_event_dispatcher\Event\FieldCode
public function addElements(string $moduleName, array $newElements) : void {
$this->elements = NestedArray::mergeDeep($this->elements, [
// Nest the new elements under the module's machine name for our form
// alter event subscriber.
$moduleName => $newElements,
]);
}