CommentFileSizeAuthor
#53 interdiff.txt1.1 KBlinl
#53 replace_all_instances-2321901-53.patch16.6 KBlinl
#48 replace_all_instances-2321901-48.patch17.42 KBlinl
#45 replace_all_instances-2321901-45.patch17.41 KBsiva_epari
#45 interdiff-42-45.txt683 bytessiva_epari
#42 replace_all_instances-2321901-42.patch17.41 KBsiva_epari
#42 interdiff-40-42.txt1.79 KBsiva_epari
#1 drupal8-entity_system-image-style-load-2321901-1.patch15.24 KBtemoor
#5 drupal8-entity_system-image-style-load-2321901-5.patch17.82 KBtemoor
#5 interdiff.txt5.04 KBtemoor
#5 drupal8-entity_system-image-style-load-2321901-5-reroll.patch14.83 KBtemoor
#10 drupal8-entity_system-image-style-load-2321901-10.patch18.14 KBpcambra
#13 drupal8-entity_system-image-style-load-2321901-13.patch18.15 KBunstatu
#18 drupal8-entity_system-image-style-load-2321901-17.patch18.17 KBunstatu
#20 interdiff.txt1.1 KBunstatu
#20 drupal8-entity_system-image-style-load-2321901-20.patch18.56 KBunstatu
#22 drupal8-entity_system-image-style-load-2321901-22.patch18.31 KBpiyuesh23
#24 drupal8-entity_system-image-style-load-2321901-22.patch18.31 KBjeroent
#26 replace_all_instances-2321901-24.patch17.31 KBjeroent
#27 replace_all_instances-2321901-25.patch17.17 KBjeroent
#29 replace_all_instances-2321901-29.patch16.82 KBjeroent
#29 interdiff.txt2.08 KBjeroent
#32 2321901-32.patch16.9 KBlokapujya
#35 drupal-replace-all-instances-2321901-35.patch18.13 KBlokapujya
#36 drupal-replace-all-instances-2321901-35.patch18.13 KBlokapujya
#40 interdiff.txt1.77 KBsiva_epari
#40 drupal-replace-all-instances-2321901-40.patch17.02 KBsiva_epari

Comments

temoor’s picture

Status: Active » Needs review
StatusFileSize
new15.24 KB
m1r1k’s picture

Issue tags: +#ams2014contest
Michael Hodge Jr’s picture

Status: Needs review » Reviewed & tested by the community

I applied the patch, grepped the code and can confirm things look as they should.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
@@ -9,6 +9,7 @@
+use Drupal\image\Entity\ImageStyle;

@@ -118,7 +119,7 @@ public function viewElements(FieldItemListInterface $items) {
-      $image_style = entity_load('image_style', $image_style_setting);
+      $image_style = ImageStyle::load($image_style_setting);

+++ b/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php
@@ -11,6 +11,7 @@
+use Drupal\image\Entity\ImageStyle;

@@ -176,13 +177,13 @@ public function viewElements(FieldItemListInterface $items) {
-          $image_style = entity_load('image_style', $image_style_name);
+          $image_style = ImageStyle::load($image_style_name);
...
-      $image_style = entity_load('image_style', $fallback_image_style);
+      $image_style = ImageStyle::load($fallback_image_style);

Needs to have the storage injected instead.

Also as this is changing the responsive_image module I'd like this postponed on #2271529: Move breakpoint settings to theme and module *.breakpoints.yml files at root level

temoor’s picture

Status: Needs work » Needs review
Issue tags: -
StatusFileSize
new17.82 KB
new5.04 KB
new14.83 KB

Rerolled patch and injected storage.

The last submitted patch, 5: drupal8-entity_system-image-style-load-2321901-5.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 5: drupal8-entity_system-image-style-load-2321901-5-reroll.patch, failed testing.

pcambra’s picture

Status: Needs work » Needs review
StatusFileSize
new18.14 KB

Here's a re-roll adding a couple of loads that have came in since #5

Status: Needs review » Needs work

The last submitted patch, 10: drupal8-entity_system-image-style-load-2321901-10.patch, failed testing.

berdir’s picture

Component: entity system » image.module

Moving this to the right component :)

unstatu’s picture

Made a reroll.

Something strange is happening with the tests. Drupal\\image\\Tests\\ImageAdminStylesTest::testStyle is failing even if no code is changed in a 8.0.x installation.

unstatu’s picture

Issue tags: +#SprintWeekend2015
David Hernández’s picture

Issue tags: -#SprintWeekend2015 +SprintWeekend2015

Updated tag to the correct one.

unstatu’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 13: drupal8-entity_system-image-style-load-2321901-13.patch, failed testing.

unstatu’s picture

Status: Needs work » Needs review
StatusFileSize
new18.17 KB

Status: Needs review » Needs work

The last submitted patch, 18: drupal8-entity_system-image-style-load-2321901-17.patch, failed testing.

unstatu’s picture

Status: Needs work » Needs review
StatusFileSize
new1.1 KB
new18.56 KB

Stored the injected EntityStorage into the class attribute.

linl’s picture

Status: Needs review » Needs work
Issue tags: +@deprecated, +Needs reroll

Patch no longer applies, tagging for reroll.

piyuesh23’s picture

Status: Needs work » Needs review
Issue tags: +#DCM2015
StatusFileSize
new18.31 KB

Re-rolled the patch.

pwieck’s picture

Issue tags: -Needs reroll
jeroent’s picture

Created re-roll.

Status: Needs review » Needs work

The last submitted patch, 24: drupal8-entity_system-image-style-load-2321901-22.patch, failed testing.

jeroent’s picture

StatusFileSize
new17.31 KB

This is the right patch...

jeroent’s picture

Status: Needs work » Needs review
StatusFileSize
new17.17 KB

.

Status: Needs review » Needs work

The last submitted patch, 27: replace_all_instances-2321901-25.patch, failed testing.

jeroent’s picture

StatusFileSize
new16.82 KB
new2.08 KB

This should fix the tests.

linl’s picture

Status: Needs work » Needs review
pcambra’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll
lokapujya’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new16.9 KB

Rerolled. Conflict with ResponsiveImageFormatter use statements.

lokapujya’s picture

+++ b/core/modules/image/image.module
@@ -11,6 +11,7 @@
+use Drupal\image\Entity\ImageStyle; 

Might not be needed anymore, but I can't be sure and it's out of scope of this issue.

jeroent’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Patch no longer applies.

lokapujya’s picture

Patch submitted by the Drush iq-submit command.

lokapujya’s picture

Rerolled.

lokapujya’s picture

Status: Needs work » Needs review

The last submitted patch, 35: drupal-replace-all-instances-2321901-35.patch, failed testing.

andypost’s picture

  1. +++ b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
    @@ -66,10 +67,11 @@ class ImageFormatter extends ImageFormatterBase implements ContainerFactoryPlugi
    +    $this->imageStyleStorage = $image_style_storage;
    

    define the class variable

  2. +++ b/core/modules/image/src/Tests/ImageStyleFlushTest.php
    @@ -6,6 +6,7 @@
     namespace Drupal\image\Tests;
    +use Drupal\image\Entity\ImageStyle;
    

    need blank line between

  3. +++ b/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php
    @@ -37,6 +37,11 @@ class ResponsiveImageFormatter extends ImageFormatterBase implements ContainerFa
    +   * @var EntityStorageInterface
    +   */
    +  protected $imageStyleStorage;
    
    @@ -55,11 +60,14 @@ class ResponsiveImageFormatter extends ImageFormatterBase implements ContainerFa
    +   * @param \Drupal\Core\Entity\EntityStorageInterface $image_style_storage
    

    should be full namespaced like second one

siva_epari’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new17.02 KB
new1.77 KB

Patch rerolled and included changes suggested by andypost.

mile23’s picture

Status: Needs review » Needs work

Patch applied, and I couldn't find any instances of image_style_load() or entity_load('image_style") or their _multiple()s.

I made entity_load() and it's multiple pal throw exceptions if entity type was 'image_style' and ran unit tests. Not conclusive due to the question of coverage, but there you go.

Couldn't find out-of-scope changes.

The changes from #39 are in the interdiff but not the patch. Maybe hit the wrong commit or something?

siva_epari’s picture

StatusFileSize
new1.79 KB
new17.41 KB

Sorry. Patch in #40 was just a reroll. Added suggested changes now.

siva_epari’s picture

Status: Needs work » Needs review
mile23’s picture

Status: Needs review » Needs work
+++ b/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php
@@ -36,6 +36,13 @@ class ResponsiveImageFormatter extends ImageFormatterBase implements ContainerFa
+  /*
+   * The image style entity storage.
+   *
+   * @var \Drupal\Core\Entity\EntityStorageInterface

Needs /** instead of /*

Thanks. :-)

siva_epari’s picture

Status: Needs work » Needs review
StatusFileSize
new683 bytes
new17.41 KB

Oops. Wonder, how that crept in :P

Fixed!

mile23’s picture

Status: Needs review » Reviewed & tested by the community

Adds container create/construct pattern to ImageFormatter and ResponsiveImageFormatter.

I couldn't find any instances of image_style_load(), entity_load('entity_style'), or entity_load_multiple('entity_style').

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 45: replace_all_instances-2321901-45.patch, failed testing.

linl’s picture

jeroent’s picture

RTBC as per #46

jeroent’s picture

Status: Needs review » Reviewed & tested by the community
xjm’s picture

Thanks @LinL and @JeroenT.

entity_load() and entity_load_multiple() are not marked as deprecated, and there is no such thing as image_style_load() as far as I can see? So this is not consistent with what's in the parent issue's beta evaluation: #2225347: [META] Replace calls to ENTITY_TYPE_load() and ENTITY_TYPE_load_multiple() with static method calls Edit: I've posted a comment there.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/modules/responsive_image/src/Plugin/Field/FieldFormatter/ResponsiveImageFormatter.php
    @@ -14,9 +14,9 @@
    +use Drupal\image\Entity\ImageStyle;
    

    Not used.

  2. +++ b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php
    @@ -277,6 +277,7 @@ protected function doTestResponsiveImageFieldFormatters($scheme, $empty_styles =
    +    $large_style = ImageStyle::load('large');
    

    This does not look like it is needed. The $large_style variable is populated already.

linl’s picture

Status: Needs work » Needs review
StatusFileSize
new16.6 KB
new1.1 KB

New patch with changes from #52.

linl’s picture

Title: Replace all instances of image_style_load(), entity_load('image_style') and entity_load_multiple('image_style') with static method calls » Replace all instances of entity_load('image_style') and entity_load_multiple('image_style') with static method calls

Also updating issue title - image_style_load() was removed in #2190313: Add $EntityType::load() and loadMultiple() to simplify loading entities.

Thanks @xjm.

mile23’s picture

Status: Needs review » Reviewed & tested by the community

Removes all instances of entity_load('image_style') and entity_load_multiple('image_style'), addresses issues in #52.

Whether this is a prioritized change is up to the maintainer... I think it's better to be consistent with the OOP approach before release, and the work is already done anyway.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Can we get a followup to replace the use of entity_load_unchanged() in ImageAdminStylesTest?

As stated in #2225347-29: [META] Replace calls to ENTITY_TYPE_load() and ENTITY_TYPE_load_multiple() with static method calls i think that replacing calls to entity_load() etc are fine atm. Committed 1f9399f and pushed to 8.0.x. Thanks!

  • alexpott committed 1f9399f on 8.0.x
    Issue #2321901 by JeroenT, epari.siva, unstatu, Temoor, lokapujya, LinL...
jeroent’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.