You are here

function theme_image_style_list in Drupal 7

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_get_styles().

See also

image_get_styles()

Related topics

1 theme call to theme_image_style_list()
image_style_list in modules/image/image.admin.inc
Menu callback; Listing of all current image styles.

File

modules/image/image.admin.inc, line 664
Administration pages for image settings.

Code

function theme_image_style_list($variables) {
  $styles = $variables['styles'];
  $header = array(
    t('Style name'),
    t('Settings'),
    array(
      'data' => t('Operations'),
      'colspan' => 3,
    ),
  );
  $rows = array();
  foreach ($styles as $style) {
    $row = array();
    $row[] = l($style['label'], 'admin/config/media/image-styles/edit/' . $style['name']);
    $link_attributes = array(
      'attributes' => array(
        'class' => array(
          'image-style-link',
        ),
      ),
    );
    if ($style['storage'] == IMAGE_STORAGE_NORMAL) {
      $row[] = t('Custom');
      $row[] = l(t('edit'), 'admin/config/media/image-styles/edit/' . $style['name'], $link_attributes);
      $row[] = l(t('delete'), 'admin/config/media/image-styles/delete/' . $style['name'], $link_attributes);
    }
    elseif ($style['storage'] == IMAGE_STORAGE_OVERRIDE) {
      $row[] = t('Overridden');
      $row[] = l(t('edit'), 'admin/config/media/image-styles/edit/' . $style['name'], $link_attributes);
      $row[] = l(t('revert'), 'admin/config/media/image-styles/revert/' . $style['name'], $link_attributes);
    }
    else {
      $row[] = t('Default');
      $row[] = l(t('edit'), 'admin/config/media/image-styles/edit/' . $style['name'], $link_attributes);
      $row[] = '';
    }
    $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,
  ));
}