diff --git a/core/modules/image/image.admin.inc b/core/modules/image/image.admin.inc index 9ed3aa9..4e3f7f3 100644 --- a/core/modules/image/image.admin.inc +++ b/core/modules/image/image.admin.inc @@ -9,18 +9,8 @@ * Menu callback; Listing of all current image styles. */ function image_style_list() { - $page = array(); - - $styles = entity_load_multiple('image_style'); - $page['image_style_list'] = array( - '#markup' => theme('image_style_list', array('styles' => $styles)), - '#attached' => array( - 'css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array()), - ), - ); - - return $page; - + return Drupal::service('plugin.manager.entity') + ->getListController('image_style')->render(); } /** @@ -499,55 +489,6 @@ function image_rotate_form($data) { } /** - * Returns HTML for the page containing the list of image styles. - * - * @param $variables - * An associative array containing: - * - styles: An array of all the image styles returned by image_get_styles(). - * - * @see image_get_styles() - * @ingroup themeable - */ -function theme_image_style_list($variables) { - $styles = $variables['styles']; - - $header = array(t('Style name'), t('Operations')); - $rows = array(); - - foreach ($styles as $style) { - $row = array(); - $row[] = l($style->label(), 'admin/config/media/image-styles/manage/' . $style->id()); - $links = array(); - $links['edit'] = array( - 'title' => t('edit'), - 'href' => 'admin/config/media/image-styles/manage/' . $style->id(), - 'class' => array('image-style-link'), - ); - $links['delete'] = array( - 'title' => t('delete'), - 'href' => 'admin/config/media/image-styles/manage/' . $style->id() . '/delete', - 'class' => array('image-style-link'), - ); - $row[] = array( - 'data' => array( - '#type' => 'operations', - '#links' => $links, - ), - ); - $rows[] = $row; - } - - if (empty($rows)) { - $rows[] = array(array( - 'colspan' => 4, - 'data' => t('There are currently no styles. Add a new one.', array('!url' => url('admin/config/media/image-styles/add'))), - )); - } - - return theme('table', array('header' => $header, 'rows' => $rows)); -} - -/** * Returns HTML for a listing of the effects within a specific image style. * * @param $variables diff --git a/core/modules/image/image.module b/core/modules/image/image.module index f95c633..cfa25ae 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -206,9 +206,6 @@ function image_theme() { ), // Theme functions in image.admin.inc. - 'image_style_list' => array( - 'variables' => array('styles' => NULL), - ), 'image_style_effects' => array( 'render element' => 'form', ), diff --git a/core/modules/image/lib/Drupal/image/ImageStyleListController.php b/core/modules/image/lib/Drupal/image/ImageStyleListController.php new file mode 100644 index 0000000..f91b05f --- /dev/null +++ b/core/modules/image/lib/Drupal/image/ImageStyleListController.php @@ -0,0 +1,48 @@ + check_plain($entity->label()), + ); + return $row; + } + + /** + * {@inheritdoc} + */ + public function render() { + $build = parent::render(); + $build['#empty'] = t('There are currently no styles. Add a new one.', array('!url' => url('admin/config/media/image-styles/add'))); + return $build; + } + +} 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 0678407..005a369 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,8 @@ * label = @Translation("Image style"), * module = "image", * controllers = { - * "storage" = "Drupal\image\ImageStyleStorageController" + * "storage" = "Drupal\image\ImageStyleStorageController", + * "list" = "Drupal\image\ImageStyleListController" * }, * uri_callback = "image_style_entity_uri", * config_prefix = "image.style",