diff --git a/core/modules/image/src/Form/ImageStyleDeleteForm.php b/core/modules/image/src/Form/ImageStyleDeleteForm.php index e119c1b..baf3b61 100644 --- a/core/modules/image/src/Form/ImageStyleDeleteForm.php +++ b/core/modules/image/src/Form/ImageStyleDeleteForm.php @@ -21,7 +21,7 @@ class ImageStyleDeleteForm extends EntityDeleteForm { * {@inheritdoc} */ public function getQuestion() { - if ($this->isDependency()) { + if ($this->isConfigurationDependency()) { return $this->t('Select a replacement style before deleting image style %style', array('%style' => $this->entity->label())); } else{ @@ -32,7 +32,7 @@ public function getQuestion() { * {@inheritdoc} */ public function getDescription() { - if ($this->isDependency()) { + if ($this->isConfigurationDependency()) { return $this->t('This image style is in use on the site, you must select another style to replace it. All images that have been generated for this image style will be permanently deleted.'); } else{ @@ -44,11 +44,11 @@ public function getDescription() { * {@inheritdoc} */ public function form(array $form, FormStateInterface $form_state) { - if ($this->isDependency()) { + if ($this->isConfigurationDependency()) { $replacement_styles = array_diff_key(image_style_options(), array($this->entity->id() => '')); $form['replacement'] = array( '#title' => $this->t('Replacement style'), - '#required' => $this->isDependency(), + '#required' => $this->isConfigurationDependency(), '#type' => 'select', '#options' => $replacement_styles, ); @@ -57,13 +57,16 @@ public function form(array $form, FormStateInterface $form_state) { return parent::form($form, $form_state); } + /** + * {@inheritdoc} + */ public function buildForm(array $form, FormStateInterface $form_state) { $form = parent::buildForm($form, $form_state); // The entity view display configuration entities will be updated during // preDelete() so we have to move them to entity_updates in order to show // correct information. - if ($this->isDependency()) { + if ($this->isConfigurationDependency()) { // Move the entity view display configuration entities. $form['entity_updates']['entity_view_display'] = $form['entity_deletes']['entity_view_display']; unset($form['entity_deletes']['entity_view_display']); @@ -97,13 +100,13 @@ public function submitForm(array &$form, FormStateInterface $form_state) { * * @return bool */ - protected function isDependency() { + protected function isConfigurationDependency() { $entity = $this->getEntity(); $config_manager = $this->getConfigManager(); foreach ($config_manager->getConfigEntitiesToChangeOnDependencyRemoval($entity->getConfigDependencyKey(), [$entity->getConfigDependencyName()]) as $dependencies) { if (!empty($dependencies)) { - return true; + return TRUE; } } diff --git a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php index f05b4db..e75ee07 100644 --- a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php +++ b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php @@ -231,9 +231,12 @@ public function viewElements(FieldItemListInterface $items) { return $elements; } + /** + * {@inheritdoc} + */ public function calculateDependencies() { - if (!empty($this->getSetting('image_style'))) { - $this->addDependency('config', 'image.style.' . $this->getSetting('image_style')); + if ($image_style = $this->getSetting('image_style')) { + $this->addDependency('config', 'image.style.' . $image_style); } return $this->dependencies; }