@@ -453,8 +453,7 @@ discard block |
||
453 | 453 | // and use this information to return correct part of the form. |
454 | 454 | if (!empty($trigger['#ajax']['event']) && $trigger['#ajax']['event'] == 'entity_browser_value_updated') { |
455 | 455 | $parents = array_slice($trigger['#array_parents'], 0, -1); |
456 | - } |
|
457 | - elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], '_remove_')) { |
|
456 | + } elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], '_remove_')) { |
|
458 | 457 | $parents = array_slice($trigger['#array_parents'], 0, -static::$deleteDepth); |
459 | 458 | } |
460 | 459 | |
@@ -621,12 +620,10 @@ discard block |
||
621 | 620 | $entity_browser_id = $this->getSetting('entity_browser'); |
622 | 621 | if (empty($entity_browser_id)) { |
623 | 622 | return [$this->t('No entity browser selected.')]; |
624 | - } |
|
625 | - else { |
|
623 | + } else { |
|
626 | 624 | if ($browser = $this->entityTypeManager->getStorage('entity_browser')->load($entity_browser_id)) { |
627 | 625 | $summary[] = $this->t('Entity browser: @browser', ['@browser' => $browser->label()]); |
628 | - } |
|
629 | - else { |
|
626 | + } else { |
|
630 | 627 | drupal_set_message($this->t('Missing entity browser!'), 'error'); |
631 | 628 | return [$this->t('Missing entity browser!')]; |
632 | 629 | } |
@@ -636,8 +633,7 @@ discard block |
||
636 | 633 | $selection_mode_options = EntityBrowserElement::getSelectionModeOptions(); |
637 | 634 | if (isset($selection_mode_options[$selection_mode])) { |
638 | 635 | $summary[] = $this->t('Selection mode: @selection_mode', ['@selection_mode' => $selection_mode_options[$selection_mode]]); |
639 | - } |
|
640 | - else { |
|
636 | + } else { |
|
641 | 637 | $summary[] = $this->t('Undefined selection mode.'); |
642 | 638 | } |
643 | 639 |
@@ -45,8 +45,7 @@ |
||
45 | 45 | $title = $this->t('Edit entity @entity', ['@entity' => $entity->label()]); |
46 | 46 | $response = AjaxResponse::create()->addCommand(new OpenDialogCommand('#' . $entity->getEntityTypeId() . '-' . $entity->id() . '-edit-dialog', $title, $form, ['modal' => TRUE, 'width' => 800])); |
47 | 47 | return $response; |
48 | - } |
|
49 | - else { |
|
48 | + } else { |
|
50 | 49 | // Return command for closing the modal. |
51 | 50 | $response = AjaxResponse::create()->addCommand(new CloseDialogCommand('#' . $entity->getEntityTypeId() . '-' . $entity->id() . '-edit-dialog')); |
52 | 51 | // Also refresh the widget if "details_id" is provided. |
@@ -136,8 +136,7 @@ |
||
136 | 136 | /** @var \Drupal\entity_browser\EntityBrowserInterface $entity_browser */ |
137 | 137 | if (is_string($element['#entity_browser'])) { |
138 | 138 | $entity_browser = EntityBrowser::load($element['#entity_browser']); |
139 | - } |
|
140 | - else { |
|
139 | + } else { |
|
141 | 140 | $entity_browser = $element['#entity_browser']; |
142 | 141 | } |
143 | 142 |
@@ -125,8 +125,7 @@ discard block |
||
125 | 125 | return [ |
126 | 126 | '#markup' => $this->t('Entity browser select form field not found on a view. <a href=":link">Go fix it</a>!', [':link' => $url]), |
127 | 127 | ]; |
128 | - } |
|
129 | - else { |
|
128 | + } else { |
|
130 | 129 | return [ |
131 | 130 | '#markup' => $this->t('Entity browser select form field not found on a view. Go fix it!'), |
132 | 131 | ]; |
@@ -184,8 +183,7 @@ discard block |
||
184 | 183 | ]); |
185 | 184 | $form_state->setError($form['widget']['view']['entity_browser_select'], $message); |
186 | 185 | } |
187 | - } |
|
188 | - catch (PluginNotFoundException $e) { |
|
186 | + } catch (PluginNotFoundException $e) { |
|
189 | 187 | $message = $this->t('The Entity Type @type does not exist.', [ |
190 | 188 | '@type' => $parts[0], |
191 | 189 | ]); |
@@ -208,8 +208,7 @@ |
||
208 | 208 | $extensions = implode(' ', array_unique($extensions)); |
209 | 209 | if (!preg_match('/^([a-z0-9]+([.][a-z0-9])* ?)+$/', $extensions)) { |
210 | 210 | $form_state->setError($element, t('The list of allowed extensions is not valid, be sure to exclude leading dots and to separate extensions with a comma or space.')); |
211 | - } |
|
212 | - else { |
|
211 | + } else { |
|
213 | 212 | $form_state->setValueForElement($element, $extensions); |
214 | 213 | } |
215 | 214 | } |
@@ -165,8 +165,7 @@ |
||
165 | 165 | '#empty_value' => '_none', |
166 | 166 | '#default_value' => $plugin->getThirdPartySetting('entity_browser_entity_form', 'entity_browser_id'), |
167 | 167 | ]; |
168 | - } |
|
169 | - else { |
|
168 | + } else { |
|
170 | 169 | $element['message'] = [ |
171 | 170 | '#markup' => t('There are no entity browsers available. You can create one <a href="@url">here</a>.', ['@url' => Url::fromRoute('entity.entity_browser.collection')->toString()]), |
172 | 171 | ]; |
@@ -96,8 +96,7 @@ |
||
96 | 96 | $triggering_element = $form_state->getTriggeringElement(); |
97 | 97 | if ($triggering_element['#name'] == 'prev_page') { |
98 | 98 | $page--; |
99 | - } |
|
100 | - elseif ($triggering_element['#name'] == 'next_page') { |
|
99 | + } elseif ($triggering_element['#name'] == 'next_page') { |
|
101 | 100 | $page++; |
102 | 101 | } |
103 | 102 |
@@ -54,8 +54,7 @@ |
||
54 | 54 | // that directly. |
55 | 55 | if ($option == 'use_ajax') { |
56 | 56 | return TRUE; |
57 | - } |
|
58 | - else { |
|
57 | + } else { |
|
59 | 58 | return parent::getOption($option); |
60 | 59 | } |
61 | 60 | } |
@@ -180,8 +180,7 @@ discard block |
||
180 | 180 | // their styles in code. |
181 | 181 | elseif ($this->fieldDefinition->getType() == 'image' && $image_style = ImageStyle::load($image_style_setting)) { |
182 | 182 | $preview_image_style = $this->t('Preview image style: @style', ['@style' => $image_style->label()]); |
183 | - } |
|
184 | - else { |
|
183 | + } else { |
|
185 | 184 | $preview_image_style = $this->t('No preview image'); |
186 | 185 | } |
187 | 186 | array_unshift($summary, $preview_image_style); |
@@ -248,8 +247,7 @@ discard block |
||
248 | 247 | // will only throw an exception. |
249 | 248 | if (!$entity->getEntityType()->getFormClass('edit')) { |
250 | 249 | $edit_button_access = FALSE; |
251 | - } |
|
252 | - elseif ($has_file_entity) { |
|
250 | + } elseif ($has_file_entity) { |
|
253 | 251 | $edit_button_access = $can_edit && $entity->access('update', $this->currentUser); |
254 | 252 | } |
255 | 253 | |
@@ -268,8 +266,7 @@ discard block |
||
268 | 266 | if ($field_type == 'file') { |
269 | 267 | $description = $item->description; |
270 | 268 | $display_field = $item->display; |
271 | - } |
|
272 | - elseif ($field_type == 'image') { |
|
269 | + } elseif ($field_type == 'image') { |
|
273 | 270 | $alt = $item->alt; |
274 | 271 | $title = $item->title; |
275 | 272 | $width = $item->width; |
@@ -474,8 +471,7 @@ discard block |
||
474 | 471 | if (!empty($settings['max_resolution']) || !empty($settings['min_resolution'])) { |
475 | 472 | $validators['entity_browser_file_validate_image_resolution'] = [$settings['max_resolution'], $settings['min_resolution']]; |
476 | 473 | } |
477 | - } |
|
478 | - elseif (!empty($settings['file_extensions'])) { |
|
474 | + } elseif (!empty($settings['file_extensions'])) { |
|
479 | 475 | $validators['file_validate_extensions'] = [$settings['file_extensions']]; |
480 | 476 | } |
481 | 477 |