1 image.theme.inc theme_image_style_list($variables)

Returns HTML for the page containing the list of image styles.

Parameters

$variables: An associative array containing:

  • styles: An array of all the image styles returned by image_styles().

See also

image_styles()

Related topics

File

core/modules/image/image.theme.inc, line 54
Theme functions for the Image module.

Code

function theme_image_style_list($variables) {
  $styles = $variables['styles'];

  $header = array(t('Style name'), t('Storage state'), array('data' => t('Operations'), 'colspan' => 3));
  $rows = array();
  foreach ($styles as $style) {
    $row = array();
    $row[] = l($style['label'], 'admin/config/media/image-styles/configure/' . $style['name']);

    $links = array();
    $links['configure'] = array(
      'title' => t('Configure'),
      'href' => 'admin/config/media/image-styles/configure/' . $style['name'],
    );
    if (user_access('synchronize configuration')) {
      $links['export'] = array(
        'title' => t('Export'),
        'href' => 'admin/config/development/configuration/single/export',
        'query' => array(
          'group' => 'Image styles',
          'name' => 'image.style.' . $style['name'],
        ),
      );
    }

    if ($style['storage'] == IMAGE_STORAGE_NORMAL) {
      $row[] = t('Custom');
      $links['delete'] = array(
        'title' => t('Delete'),
        'href' => 'admin/config/media/image-styles/delete/' . $style['name'],
      );
    }
    elseif ($style['storage'] == IMAGE_STORAGE_OVERRIDE) {
      $row[] = t('Overridden');
      $links['delete'] = array(
        'title' => t('Revert'),
        'href' => 'admin/config/media/image-styles/revert/' . $style['name'],
      );
    }
    else {
      $row[] = t('Default (module-provided)');
    }
    $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. <a href="!url">Add a new one</a>.', array('!url' => url('admin/config/media/image-styles/add'))),
    ));
  }

  return theme('table', array('header' => $header, 'rows' => $rows));
}