@@ -137,24 +137,24 @@ |
||
137 | 137 | $this->assertOptionSelected('edit-widget-selector', 'tabs', 'Correct widget selector selected.'); |
138 | 138 | $this->assertOptionSelected('edit-selection-display', 'no_display', 'Correct selection display selected.'); |
139 | 139 | |
140 | - $this->drupalPostForm(NULL,[], 'Next'); |
|
140 | + $this->drupalPostForm(NULL, [], 'Next'); |
|
141 | 141 | $this->assertUrl('/admin/config/content/entity_browser/test_entity_browser/display', ['query' => ['js' => 'nojs']]); |
142 | 142 | $this->assertFieldById('edit-width', '100', 'Correct value for width found.'); |
143 | 143 | $this->assertFieldById('edit-height', '100', 'Correct value for height found.'); |
144 | 144 | $this->assertFieldById('edit-link-text', 'All animals are created equal', 'Correct value for link text found.'); |
145 | 145 | $this->assertFieldChecked('edit-auto-open', 'Auto open is enabled.'); |
146 | 146 | |
147 | - $this->drupalPostForm(NULL,[], 'Next'); |
|
147 | + $this->drupalPostForm(NULL, [], 'Next'); |
|
148 | 148 | $this->assertUrl('/admin/config/content/entity_browser/test_entity_browser/widget_selector', ['query' => ['js' => 'nojs']]); |
149 | 149 | |
150 | - $this->drupalPostForm(NULL,[], 'Next'); |
|
150 | + $this->drupalPostForm(NULL, [], 'Next'); |
|
151 | 151 | $this->assertUrl('/admin/config/content/entity_browser/test_entity_browser/selection_display', ['query' => ['js' => 'nojs']]); |
152 | 152 | |
153 | - $this->drupalPostForm(NULL,[], 'Next'); |
|
154 | - $this->assertFieldById('edit-table-' . $uuid . '-label', 'upload', 'Correct value for widget label found.'); |
|
155 | - $this->assertFieldById('edit-table-' . $uuid . '-form-upload-location', 'public://', 'Correct value for upload location found.'); |
|
153 | + $this->drupalPostForm(NULL, [], 'Next'); |
|
154 | + $this->assertFieldById('edit-table-'.$uuid.'-label', 'upload', 'Correct value for widget label found.'); |
|
155 | + $this->assertFieldById('edit-table-'.$uuid.'-form-upload-location', 'public://', 'Correct value for upload location found.'); |
|
156 | 156 | |
157 | - $this->drupalPostForm(NULL,[], 'Finish'); |
|
157 | + $this->drupalPostForm(NULL, [], 'Finish'); |
|
158 | 158 | |
159 | 159 | $this->drupalLogout(); |
160 | 160 | $this->drupalGet('/admin/config/content/entity_browser/test_entity_browser/general'); |
@@ -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' => [ |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Drupal\entity_browser\Plugin\EntityBrowser\SelectionDisplay; |
4 | 4 | |
5 | -use Drupal\Component\Utility\Html; |
|
6 | 5 | use Drupal\Core\Entity\EntityManagerInterface; |
7 | 6 | use Drupal\Core\Form\FormStateInterface; |
8 | 7 | use Drupal\entity_browser\FieldWidgetDisplayManager; |
@@ -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 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $definitions = $this->entityManager->getDefinitions(); |
66 | 66 | $entity_types = array_combine( |
67 | 67 | array_keys($definitions), |
68 | - array_map(function (EntityTypeInterface $item) { return $item->getLabel(); }, $definitions) |
|
68 | + array_map(function(EntityTypeInterface $item) { return $item->getLabel(); }, $definitions) |
|
69 | 69 | ); |
70 | 70 | |
71 | 71 | $form['entity_type'] = [ |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $bundles = []; |
83 | 83 | if ($entity_type) { |
84 | 84 | $definitions = $this->entityManager->getBundleInfo($entity_type); |
85 | - $bundles = array_map(function ($item) { return $item['label']; }, $definitions); |
|
85 | + $bundles = array_map(function($item) { return $item['label']; }, $definitions); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $form['bundle'] = [ |