Completed
Push — 8.x-1.x ( 387575...795405 )
by Janez
03:15
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
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
    * {@inheritdoc}
99 99
    */
100 100
   public function getForm(array &$original_form, FormStateInterface $form_state, array $aditional_widget_parameters) {
101
-    if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle'])  || empty($this->configuration['form_mode'])) {
101
+    if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle']) || empty($this->configuration['form_mode'])) {
102 102
       return ['#markup' => $this->t('The settings for this widget (Entity type, Bundle or Form mode) are not configured correctly.')];
103 103
     }
104 104
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
     // Pretend to be IEFs submit button.
108 108
     $form['#submit'] = [['Drupal\inline_entity_form\ElementSubmit', 'trigger']];
109
-    $form['actions']['submit']['#ief_submit_trigger']  = TRUE;
109
+    $form['actions']['submit']['#ief_submit_trigger'] = TRUE;
110 110
     $form['actions']['submit']['#ief_submit_trigger_all'] = TRUE;
111 111
 
112 112
     $form['inline_entity_form'] = [
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     $entities = $this->prepareEntities($form, $form_state);
135 135
     array_walk(
136 136
       $entities,
137
-      function (EntityInterface $entity) {
137
+      function(EntityInterface $entity) {
138 138
         $entity->save();
139 139
       }
140 140
     );
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     $definitions = $this->entityTypeManager->getDefinitions();
156 156
     $entity_types = array_combine(
157 157
       array_keys($definitions),
158
-      array_map(function (EntityTypeInterface $item) {
158
+      array_map(function(EntityTypeInterface $item) {
159 159
         return $item->getLabel();
160 160
       }, $definitions)
161 161
     );
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     $bundles = [];
174 174
     if ($entity_type) {
175 175
       $definitions = $this->entityTypeBundleInfo->getBundleInfo($entity_type);
176
-      $bundles = array_map(function ($item) {
176
+      $bundles = array_map(function($item) {
177 177
         return $item['label'];
178 178
       }, $definitions);
179 179
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         '#options' => $bundles,
187 187
         '#default_value' => $bundle,
188 188
       ],
189
-      '#attributes' => ['id' => 'bundle-wrapper-' . $this->uuid()],
189
+      '#attributes' => ['id' => 'bundle-wrapper-'.$this->uuid()],
190 190
     ];
191 191
 
192 192
     $form['form_mode'] = [
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         '#default_value' => $form_mode,
198 198
         '#options' => $this->entityDisplayRepository->getFormModeOptions($entity_type),
199 199
       ],
200
-      '#attributes' => ['id' => 'form-mode-wrapper-' . $this->uuid()],
200
+      '#attributes' => ['id' => 'form-mode-wrapper-'.$this->uuid()],
201 201
     ];
202 202
 
203 203
     return $form;
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
    */
223 223
   public function updateFormElements($form, FormStateInterface $form_state) {
224 224
     $response = new AjaxResponse();
225
-    $response->addCommand(new ReplaceCommand('#bundle-wrapper-' . $this->uuid(), $this->updateBundle($form, $form_state)));
226
-    $response->addCommand(new ReplaceCommand('#form-mode-wrapper-' . $this->uuid(), $this->updateFormMode($form, $form_state)));
225
+    $response->addCommand(new ReplaceCommand('#bundle-wrapper-'.$this->uuid(), $this->updateBundle($form, $form_state)));
226
+    $response->addCommand(new ReplaceCommand('#form-mode-wrapper-'.$this->uuid(), $this->updateFormMode($form, $form_state)));
227 227
     return $response;
228 228
   }
229 229
 
Please login to merge, or discard this patch.