|
@@ -7,7 +7,7 @@ discard block |
|
|
block discarded – undo |
|
7
|
7
|
/** |
|
8
|
8
|
* Implements hook_inline_entity_form_reference_form_alter(). |
|
9
|
9
|
*/ |
|
10
|
|
-function entity_browser_entity_form_inline_entity_form_reference_form_alter(&$reference_form, \Drupal\Core\Form\FormStateInterface &$form_state) { |
|
|
10
|
+function entity_browser_entity_form_inline_entity_form_reference_form_alter(&$reference_form, \Drupal\Core\Form\FormStateInterface&$form_state) { |
|
11
|
11
|
$entity_manager = \Drupal::entityManager(); |
|
12
|
12
|
\Drupal::service('event_dispatcher') |
|
13
|
13
|
->addListener( |
|
@@ -19,7 +19,7 @@ discard block |
|
|
block discarded – undo |
|
19
|
19
|
$instance = $form_state->get(['inline_entity_form', $reference_form['#ief_id'], 'instance']); |
|
20
|
20
|
|
|
21
|
21
|
/** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */ |
|
22
|
|
- $entity_form_id = $instance->getTargetEntityTypeId() . '.' . $instance->getTargetBundle() . '.default'; |
|
|
22
|
+ $entity_form_id = $instance->getTargetEntityTypeId().'.'.$instance->getTargetBundle().'.default'; |
|
23
|
23
|
// TODO - 'default' might become configurable or something else in the future. |
|
24
|
24
|
// See https://www.drupal.org/node/2510274 |
|
25
|
25
|
$form_display = $entity_manager->getStorage('entity_form_display')->load($entity_form_id); |
|
@@ -116,7 +116,7 @@ discard block |
|
|
block discarded – undo |
|
116
|
116
|
$form_values = NestedArray::getValue($form_state->getValues(), $reference_form['#parents']); |
|
117
|
117
|
$storage = \Drupal::entityTypeManager()->getStorage($reference_form['#entity_type']); |
|
118
|
118
|
$attach_entities = $storage->loadMultiple(explode(' ', $form_values['entity_id'])); |
|
119
|
|
- $entities =& $form_state->get(['inline_entity_form', $ief_id, 'entities']); |
|
|
119
|
+ $entities = & $form_state->get(['inline_entity_form', $ief_id, 'entities']); |
|
120
|
120
|
|
|
121
|
121
|
// Determine the correct weight of the new element. |
|
122
|
122
|
$weight = 0; |