@@ -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 | $can_edit = FALSE; |
| 251 | - } |
|
| 252 | - elseif ($has_file_entity) { |
|
| 250 | + } elseif ($has_file_entity) { |
|
| 253 | 251 | $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 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - $id = Html::getUniqueId('field-' . $this->fieldDefinition->getName() . '-display-settings-wrapper'); |
|
| 173 | + $id = Html::getUniqueId('field-'.$this->fieldDefinition->getName().'-display-settings-wrapper'); |
|
| 174 | 174 | $element['field_widget_display'] = [ |
| 175 | 175 | '#title' => $this->t('Entity display plugin'), |
| 176 | 176 | '#type' => 'select', |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | '#type' => 'fieldset', |
| 221 | 221 | '#title' => $this->t('Entity display plugin configuration'), |
| 222 | 222 | '#tree' => TRUE, |
| 223 | - '#prefix' => '<div id="' . $id . '">', |
|
| 223 | + '#prefix' => '<div id="'.$id.'">', |
|
| 224 | 224 | '#suffix' => '</div>', |
| 225 | 225 | ]; |
| 226 | 226 | |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * A key for form state storage. |
| 304 | 304 | */ |
| 305 | 305 | protected function getFormStateKey(FieldItemListInterface $items) { |
| 306 | - return $items->getEntity()->uuid() . ':' . $items->getFieldDefinition()->getName(); |
|
| 306 | + return $items->getEntity()->uuid().':'.$items->getFieldDefinition()->getName(); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | // Get correct ordered list of entity IDs. |
| 317 | 317 | $ids = array_map( |
| 318 | - function (EntityInterface $entity) { |
|
| 318 | + function(EntityInterface $entity) { |
|
| 319 | 319 | return $entity->id(); |
| 320 | 320 | }, |
| 321 | 321 | $entities |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | // might result in unpredictable results. |
| 330 | 330 | $form_state->set(['entity_browser_widget', $this->getFormStateKey($items)], $ids); |
| 331 | 331 | |
| 332 | - $hidden_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName() . '-target-id'); |
|
| 333 | - $details_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName()); |
|
| 332 | + $hidden_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName().'-target-id'); |
|
| 333 | + $details_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName()); |
|
| 334 | 334 | |
| 335 | 335 | $element += [ |
| 336 | 336 | '#id' => $details_id, |
@@ -345,8 +345,8 @@ discard block |
||
| 345 | 345 | // We need to repeat ID here as it is otherwise skipped when rendering. |
| 346 | 346 | '#attributes' => ['id' => $hidden_id], |
| 347 | 347 | '#default_value' => implode(' ', array_map( |
| 348 | - function (EntityInterface $item) { |
|
| 349 | - return $item->getEntityTypeId() . ':' . $item->id(); |
|
| 348 | + function(EntityInterface $item) { |
|
| 349 | + return $item->getEntityTypeId().':'.$item->id(); |
|
| 350 | 350 | }, |
| 351 | 351 | $entities |
| 352 | 352 | )), |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | public static function processEntityBrowser(&$element, FormStateInterface $form_state, &$complete_form) { |
| 400 | 400 | $uuid = key($element['#attached']['drupalSettings']['entity_browser']); |
| 401 | - $element['#attached']['drupalSettings']['entity_browser'][$uuid]['selector'] = '#' . $element['#custom_hidden_id']; |
|
| 401 | + $element['#attached']['drupalSettings']['entity_browser'][$uuid]['selector'] = '#'.$element['#custom_hidden_id']; |
|
| 402 | 402 | return $element; |
| 403 | 403 | } |
| 404 | 404 | |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | '#theme_wrappers' => ['container'], |
| 509 | 509 | '#attributes' => ['class' => $classes], |
| 510 | 510 | 'items' => array_map( |
| 511 | - function (ContentEntityInterface $entity, $row_id) use ($field_widget_display, $details_id, $field_parents) { |
|
| 511 | + function(ContentEntityInterface $entity, $row_id) use ($field_widget_display, $details_id, $field_parents) { |
|
| 512 | 512 | $display = $field_widget_display->view($entity); |
| 513 | 513 | $edit_button_access = $this->getSetting('field_widget_edit') && $entity->access('update', $this->currentUser); |
| 514 | 514 | if ($entity->getEntityTypeId() == 'file') { |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | '#theme_wrappers' => ['container'], |
| 525 | 525 | '#attributes' => [ |
| 526 | 526 | 'class' => ['item-container', Html::getClass($field_widget_display->getPluginId())], |
| 527 | - 'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(), |
|
| 527 | + 'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(), |
|
| 528 | 528 | 'data-row-id' => $row_id, |
| 529 | 529 | ], |
| 530 | 530 | 'display' => $display, |
@@ -536,10 +536,10 @@ discard block |
||
| 536 | 536 | 'wrapper' => $details_id, |
| 537 | 537 | ], |
| 538 | 538 | '#submit' => [[get_class($this), 'removeItemSubmit']], |
| 539 | - '#name' => $this->fieldDefinition->getName() . '_remove_' . $entity->id() . '_' . $row_id . '_' . md5(json_encode($field_parents)), |
|
| 539 | + '#name' => $this->fieldDefinition->getName().'_remove_'.$entity->id().'_'.$row_id.'_'.md5(json_encode($field_parents)), |
|
| 540 | 540 | '#limit_validation_errors' => [array_merge($field_parents, [$this->fieldDefinition->getName()])], |
| 541 | 541 | '#attributes' => [ |
| 542 | - 'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(), |
|
| 542 | + 'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(), |
|
| 543 | 543 | 'data-row-id' => $row_id, |
| 544 | 544 | ], |
| 545 | 545 | '#access' => (bool) $this->getSetting('field_widget_remove'), |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | } |
| 679 | 679 | // Submit was triggered by one of the "Remove" buttons. We need to walk |
| 680 | 680 | // few levels up to read value of "target_id" element. |
| 681 | - elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName() . '_remove_') === 0) { |
|
| 681 | + elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName().'_remove_') === 0) { |
|
| 682 | 682 | $parents = array_merge(array_slice($trigger['#parents'], 0, -static::$deleteDepth), ['target_id']); |
| 683 | 683 | } |
| 684 | 684 | |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | // If an entity browser is being used in this widget, add it as a config |
| 736 | 736 | // dependency. |
| 737 | 737 | if ($browser_name = $this->getSetting('entity_browser')) { |
| 738 | - $dependencies['config'][] = 'entity_browser.browser.' . $browser_name; |
|
| 738 | + $dependencies['config'][] = 'entity_browser.browser.'.$browser_name; |
|
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | return $dependencies; |