diff --git a/core/modules/image/image.admin.inc b/core/modules/image/image.admin.inc index df68065..86350cf 100644 --- a/core/modules/image/image.admin.inc +++ b/core/modules/image/image.admin.inc @@ -9,18 +9,7 @@ * 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 entity_list_controller('image_style')->render(); } /** @@ -569,55 +558,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 91a3d23..ef74d0b 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -210,9 +210,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..6e6ea67 --- /dev/null +++ b/core/modules/image/lib/Drupal/image/ImageStyleListController.php @@ -0,0 +1,47 @@ +uri(); + $row['label'] = l($entity->label(), $uri['path'], $uri['options']); + return $row; + } + + /** + * Overrides EntityListController::render(); + */ + 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 d820050..9229146 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,6 +19,7 @@ * label = @Translation("Image style"), * module = "image", * controller_class = "Drupal\image\ImageStyleStorageController", + * list_controller_class = "Drupal\image\ImageStyleListController", * uri_callback = "image_style_entity_uri", * config_prefix = "image.style", * entity_keys = {