Completed
Push — 8.x-1.x ( 6b638e...01d716 )
by Janez
02:35
created
modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
    * {@inheritdoc}
100 100
    */
101 101
   public function getForm(array &$original_form, FormStateInterface $form_state, array $additional_widget_parameters) {
102
-    if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle'])  || empty($this->configuration['form_mode'])) {
102
+    if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle']) || empty($this->configuration['form_mode'])) {
103 103
       return ['#markup' => $this->t('The settings for this widget (Entity type, Bundle or Form mode) are not configured correctly.')];
104 104
     }
105 105
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
     // Pretend to be IEFs submit button.
109 109
     $form['#submit'] = [['Drupal\inline_entity_form\ElementSubmit', 'trigger']];
110
-    $form['actions']['submit']['#ief_submit_trigger']  = TRUE;
110
+    $form['actions']['submit']['#ief_submit_trigger'] = TRUE;
111 111
     $form['actions']['submit']['#ief_submit_trigger_all'] = TRUE;
112 112
 
113 113
     $form['inline_entity_form'] = [
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
       $entities = $this->prepareEntities($form, $form_state);
137 137
       array_walk(
138 138
         $entities,
139
-        function (EntityInterface $entity) {
139
+        function(EntityInterface $entity) {
140 140
           $entity->save();
141 141
         }
142 142
       );
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     $definitions = $this->entityTypeManager->getDefinitions();
159 159
     $entity_types = array_combine(
160 160
       array_keys($definitions),
161
-      array_map(function (EntityTypeInterface $item) {
161
+      array_map(function(EntityTypeInterface $item) {
162 162
         return $item->getLabel();
163 163
       }, $definitions)
164 164
     );
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     $bundles = [];
177 177
     if ($entity_type) {
178 178
       $definitions = $this->entityTypeBundleInfo->getBundleInfo($entity_type);
179
-      $bundles = array_map(function ($item) {
179
+      $bundles = array_map(function($item) {
180 180
         return $item['label'];
181 181
       }, $definitions);
182 182
     }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         '#options' => $bundles,
190 190
         '#default_value' => $bundle,
191 191
       ],
192
-      '#attributes' => ['id' => 'bundle-wrapper-' . $this->uuid()],
192
+      '#attributes' => ['id' => 'bundle-wrapper-'.$this->uuid()],
193 193
     ];
194 194
 
195 195
     $form['form_mode'] = [
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         '#default_value' => $form_mode,
201 201
         '#options' => $this->entityDisplayRepository->getFormModeOptions($entity_type),
202 202
       ],
203
-      '#attributes' => ['id' => 'form-mode-wrapper-' . $this->uuid()],
203
+      '#attributes' => ['id' => 'form-mode-wrapper-'.$this->uuid()],
204 204
     ];
205 205
 
206 206
     return $form;
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
    */
226 226
   public function updateFormElements($form, FormStateInterface $form_state) {
227 227
     $response = new AjaxResponse();
228
-    $response->addCommand(new ReplaceCommand('#bundle-wrapper-' . $this->uuid(), $this->updateBundle($form, $form_state)));
229
-    $response->addCommand(new ReplaceCommand('#form-mode-wrapper-' . $this->uuid(), $this->updateFormMode($form, $form_state)));
228
+    $response->addCommand(new ReplaceCommand('#bundle-wrapper-'.$this->uuid(), $this->updateBundle($form, $form_state)));
229
+    $response->addCommand(new ReplaceCommand('#form-mode-wrapper-'.$this->uuid(), $this->updateFormMode($form, $form_state)));
230 230
     return $response;
231 231
   }
232 232
 
Please login to merge, or discard this patch.