diff --git a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatterBase.php b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatterBase.php index 791f74d..7e47597 100644 --- a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatterBase.php +++ b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatterBase.php @@ -13,6 +13,7 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\Core\Url; use Drupal\Core\Utility\LinkGeneratorInterface; use Drupal\field\FieldConfigInterface; use Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase; diff --git a/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php b/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php index 38a545f..1d5b60e 100644 --- a/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php +++ b/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php @@ -63,7 +63,7 @@ class ResponsiveImageFormatter extends ImageFormatterBase implements ContainerFa * @param \Drupal\Core\Entity\EntityStorageInterface $responsive_image_style_storage * The responsive image style storage. */ - public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, AccountInterface $current_user, LinkGeneratorInterface $link_generator, $current_user, EntityStorageInterface $image_style_storage, EntityStorageInterface $responsive_image_style_storage) { + public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, AccountInterface $current_user, LinkGeneratorInterface $link_generator, EntityStorageInterface $image_style_storage, EntityStorageInterface $responsive_image_style_storage) { parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings, $current_user, $link_generator, $image_style_storage); $this->responsiveImageStyleStorage = $responsive_image_style_storage; @@ -92,17 +92,17 @@ public static function create(ContainerInterface $container, array $configuratio * {@inheritdoc} */ public static function defaultSettings() { - return array( + return [ 'responsive_image_style' => '', 'image_link' => '', - ) + parent::defaultSettings(); + ]; } /** * {@inheritdoc} */ public function settingsForm(array $form, FormStateInterface $form_state) { - $responsive_image_options = array(); + $responsive_image_options = []; $responsive_image_styles = $this->responsiveImageStyleStorage->loadMultiple(); if ($responsive_image_styles && !empty($responsive_image_styles)) { foreach ($responsive_image_styles as $machine_name => $responsive_image_style) { @@ -112,25 +112,25 @@ public function settingsForm(array $form, FormStateInterface $form_state) { } } - $elements['responsive_image_style'] = array( + $elements['responsive_image_style'] = [ '#title' => t('Responsive image style'), '#type' => 'select', '#default_value' => $this->getSetting('responsive_image_style'), '#required' => TRUE, '#options' => $responsive_image_options, - ); + ]; - $link_types = array( + $link_types = [ 'content' => t('Content'), 'file' => t('File'), - ); - $elements['image_link'] = array( + ]; + $elements['image_link'] = [ '#title' => t('Link image to'), '#type' => 'select', '#default_value' => $this->getSetting('image_link'), '#empty_option' => t('Nothing'), '#options' => $link_types, - ); + ]; return $elements; } @@ -139,16 +139,16 @@ public function settingsForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function settingsSummary() { - $summary = array(); + $summary = []; $responsive_image_style = $this->responsiveImageStyleStorage->load($this->getSetting('responsive_image_style')); if ($responsive_image_style) { - $summary[] = t('Responsive image style: @responsive_image_style', array('@responsive_image_style' => $responsive_image_style->label())); + $summary[] = t('Responsive image style: @responsive_image_style', ['@responsive_image_style' => $responsive_image_style->label()]); - $link_types = array( + $link_types = [ 'content' => t('Linked to content'), 'file' => t('Linked to file'), - ); + ]; // Display this setting only if image is linked. if (isset($link_types[$this->getSetting('image_link')])) { $summary[] = $link_types[$this->getSetting('image_link')]; @@ -165,7 +165,7 @@ public function settingsSummary() { * {@inheritdoc} */ public function viewElements(FieldItemListInterface $items) { - $elements = array(); + $elements = []; $files = $this->getEntitiesToView($items); // Early opt-out if the field is empty. @@ -187,7 +187,7 @@ public function viewElements(FieldItemListInterface $items) { // Collect cache tags to be added for each item in the field. $responsive_image_style = $this->responsiveImageStyleStorage->load($this->getSetting('responsive_image_style')); - $image_styles_to_load = array(); + $image_styles_to_load = []; $cache_tags = []; if ($responsive_image_style) { $cache_tags = Cache::mergeTags($cache_tags, $responsive_image_style->getCacheTags()); @@ -210,16 +210,16 @@ public function viewElements(FieldItemListInterface $items) { $item_attributes = $item->_attributes; unset($item->_attributes); - $elements[$delta] = array( + $elements[$delta] = [ '#theme' => 'responsive_image_formatter', '#item' => $item, '#item_attributes' => $item_attributes, '#responsive_image_style_id' => $responsive_image_style ? $responsive_image_style->id() : '', '#url' => $url, - '#cache' => array( + '#cache' => [ 'tags' => $cache_tags, - ), - ); + ], + ]; } return $elements; } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index f0a6282..86365a9 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -1308,9 +1308,6 @@ function system_update_8004() { // ensure they match the currently expected status. $manager = \Drupal::entityDefinitionUpdateManager(); foreach (array_keys(\Drupal::entityManager()->getDefinitions()) as $entity_type_id) { - if (is_null($manager->getEntityType($entity_type_id))) { - $manager->getEntityType($entity_type_id); - } $manager->updateEntityType($manager->getEntityType($entity_type_id)); } }