diff --git a/core/modules/image/image.module b/core/modules/image/image.module index b9ad53c..4e2bfca 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -72,15 +72,6 @@ function image_help($path, $arg) { } /** - * Entity URI callback for image style. - */ -function image_style_entity_uri(ImageStyle $style) { - return array( - 'path' => 'admin/config/media/image-styles/manage/' . $style->id(), - ); -} - -/** * Implements hook_menu(). */ function image_menu() { diff --git a/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php index eda9f5c..8862aa4 100644 --- a/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php +++ b/core/modules/image/lib/Drupal/image/Plugin/Core/Entity/ImageStyle.php @@ -19,7 +19,6 @@ * label = @Translation("Image style"), * module = "image", * controller_class = "Drupal\image\ImageStyleStorageController", - * uri_callback = "image_style_entity_uri", * config_prefix = "image.style", * entity_keys = { * "id" = "name", @@ -65,4 +64,17 @@ public function id() { return $this->name; } + /** + * Overrides \Drupal\Core\Entity\Entity::uri(). + */ + public function uri() { + return array( + 'path' => 'admin/config/media/image-styles/edit/' . $this->id(), + 'options' => array( + 'entity_type' => $this->entityType, + 'entity' => $this, + ), + ); + } + } diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php index 0d09461..6461317 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageAdminStylesTest.php @@ -120,6 +120,10 @@ function testStyle() { // Load the saved image style. $style = entity_load('image_style', $style_name); + // Ensure that the image style URI matches our expected path. + $style_uri = $style->uri(); + $style_uri_path = url($style_uri['path'], $style_uri['options']); + $this->assertTrue(strpos($style_uri_path, $style_path) !== FALSE, 'The image style URI is correct.'); // Confirm that all effects on the image style have settings on the effect // edit form that match what was saved.