diff --git a/core/modules/image/image.admin.css b/core/modules/image/image.admin.css index 8b37456..248a848 100644 --- a/core/modules/image/image.admin.css +++ b/core/modules/image/image.admin.css @@ -77,3 +77,7 @@ .image-anchor td { border: 1px solid #ccc; } + +.image-style-label { + font-weight: bold; +} diff --git a/core/modules/image/image.admin.inc b/core/modules/image/image.admin.inc index df68065..a05c338 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(); } /** @@ -569,55 +559,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 7be1abd..ba473f3 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -214,9 +214,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..76a4bf1 --- /dev/null +++ b/core/modules/image/lib/Drupal/image/ImageStyleListController.php @@ -0,0 +1,56 @@ +uri(); + $row['label'] = array( + 'data' => array( + '#type' => 'link', + '#title' => $entity->label(), + '#href' => $uri['path'], + '#options' => $uri['options'], + ), + 'class' => array('image-style-label'), + ); + return $row; + } + + /** + * Overrides \Drupal\Core\Entity\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'))); + $build['#attached']['css'][] = drupal_get_path('module', 'image') . '/image.admin.css'; + 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 2c01d95..d506bd0 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 = {