@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | '#tree' => TRUE |
| 35 | 35 | ]; |
| 36 | 36 | foreach ($selected_entities as $id => $entity) { |
| 37 | - $form['selected']['items_'. $entity->id()] = [ |
|
| 37 | + $form['selected']['items_'.$entity->id()] = [ |
|
| 38 | 38 | '#theme_wrappers' => ['container'], |
| 39 | 39 | '#attributes' => [ |
| 40 | 40 | 'class' => ['selected-item-container'], |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | '#type' => 'submit', |
| 46 | 46 | '#value' => $this->t('Remove'), |
| 47 | 47 | '#submit' => [[get_class($this), 'removeItemSubmit']], |
| 48 | - '#name' => 'remove_' . $entity->id(), |
|
| 48 | + '#name' => 'remove_'.$entity->id(), |
|
| 49 | 49 | '#attributes' => [ |
| 50 | 50 | 'data-row-id' => $id, |
| 51 | - 'data-remove-entity' => 'items_' . $entity->id(), |
|
| 51 | + 'data-remove-entity' => 'items_'.$entity->id(), |
|
| 52 | 52 | ] |
| 53 | 53 | ], |
| 54 | 54 | 'weight' => [ |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | /** |
| 43 | 43 | * Implements hook_form_alter(). |
| 44 | 44 | */ |
| 45 | -function entity_browser_form_alter(&$form, FormStateInterface &$form_state) { |
|
| 45 | +function entity_browser_form_alter(&$form, FormStateInterface&$form_state) { |
|
| 46 | 46 | $entity_browser_dialog_edit = \Drupal::service('request_stack')->getCurrentRequest()->get('_route'); |
| 47 | 47 | if ($entity_browser_dialog_edit == 'entity_browser.edit_form') { |
| 48 | 48 | // Let's allow the save button only. |
@@ -7,7 +7,7 @@ discard block |
||
| 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 |
||
| 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); |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | foreach ($attach_entities as $attach_entity) { |
| 98 | 98 | foreach ($form_state->get(['inline_entity_form', $ief_id, 'entities']) as $key => $value) { |
| 99 | 99 | if ($value['entity'] == $attach_entity) { |
| 100 | - $form_state->setErrorByName($parents_path . '][existing_entity', t('The selected @label has already been added.', array('@label' => $labels['singular']))); |
|
| 100 | + $form_state->setErrorByName($parents_path.'][existing_entity', t('The selected @label has already been added.', array('@label' => $labels['singular']))); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | else { |
| 106 | - $form_state->setErrorByName($parents_path . '][existing_entity', t('The selected @label is not valid.', array('@label' => $labels['singular']))); |
|
| 106 | + $form_state->setErrorByName($parents_path.'][existing_entity', t('The selected @label is not valid.', array('@label' => $labels['singular']))); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
@@ -133,14 +133,14 @@ discard block |
||
| 133 | 133 | if ($form_state->has(['inline_entity_form', $ief_id, 'entities', 0])) { |
| 134 | 134 | $weight = max( |
| 135 | 135 | array_map( |
| 136 | - function ($item) { return intval($item['_weight']); }, |
|
| 136 | + function($item) { return intval($item['_weight']); }, |
|
| 137 | 137 | $form_state->get(['inline_entity_form', $ief_id, 'entities']) |
| 138 | 138 | ) |
| 139 | 139 | ); |
| 140 | 140 | $weight++; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $entities =& $form_state->get(['inline_entity_form', $ief_id, 'entities']); |
|
| 143 | + $entities = & $form_state->get(['inline_entity_form', $ief_id, 'entities']); |
|
| 144 | 144 | foreach ($attach_entities as $attach_entity) { |
| 145 | 145 | $entities[] = array( |
| 146 | 146 | 'entity' => $attach_entity, |
@@ -101,8 +101,7 @@ |
||
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | - } |
|
| 105 | - else { |
|
| 104 | + } else { |
|
| 106 | 105 | $form_state->setErrorByName($parents_path . '][existing_entity', t('The selected @label is not valid.', array('@label' => $labels['singular']))); |
| 107 | 106 | } |
| 108 | 107 | } |