You are here

function inline_entity_form_get_element in Inline Entity Form 8

Same name and namespace in other branches
  1. 7 inline_entity_form.module \inline_entity_form_get_element()

Returns an IEF widget nearest to the triggering element.

8 calls to inline_entity_form_get_element()
InlineEntityFormComplex::closeChildForms in src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
Button #submit callback: Closes all open child forms in the IEF widget.
InlineEntityFormComplex::closeForm in src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
Button #submit callback: Closes a form in the IEF widget.
InlineEntityFormComplex::submitCloseRow in src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
Button #submit callback: Closes a row form in the IEF widget.
InlineEntityFormComplex::submitConfirmRemove in src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
Remove form submit callback.
inline_entity_form_cleanup_form_state in ./inline_entity_form.module
Button #submit callback: Cleans up form state for a closed entity form.

... See full list

4 string references to 'inline_entity_form_get_element'
InlineEntityFormComplex::buildEntityFormActions in src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
Adds actions to the inline entity form.
InlineEntityFormComplex::buildRemoveForm in src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
Builds remove form.
InlineEntityFormComplex::formElement in src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php
Returns the form for a single field widget.
inline_entity_form_reference_form in ./inline_entity_form.module
Provides the form for adding existing entities through an autocomplete field.

File

./inline_entity_form.module, line 307
Provides a widget for inline management (creation, modification, removal) of referenced entities. The primary use case is the parent -> children one (for example, order -> line items), where the child entities are never managed outside the…

Code

function inline_entity_form_get_element($form, FormStateInterface $form_state) {
  $element = [];
  $triggering_element = $form_state
    ->getTriggeringElement();

  // Remove the action and the actions container.
  $array_parents = array_slice($triggering_element['#array_parents'], 0, -2);
  while (!isset($element['#ief_root'])) {
    $element = NestedArray::getValue($form, $array_parents);
    array_pop($array_parents);
  }
  return $element;
}