You are here

function theme_file_style_list in Styles 7

Same name and namespace in other branches
  1. 7.2 contrib/file_styles/file_styles.admin.inc \theme_file_style_list()

Display the page containing the list of file styles.

Parameters

$variables: An associative array containing:

  • styles: An array of all the file styles returned by file_get_styles().

See also

file_get_styles()

1 theme call to theme_file_style_list()
file_style_list in contrib/file_styles/file_styles.admin.inc
Menu callback; Listing of all current File styles.

File

contrib/file_styles/file_styles.admin.inc, line 345
Administrative page callbacks for the File: Styles module.

Code

function theme_file_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['name'], 'admin/config/file/file-styles/edit/' . $style['name']);
    $link_attributes = array(
      'attributes' => array(
        'class' => array(
          'file-style-link',
        ),
      ),
    );
    if ($style['storage'] == IMAGE_STORAGE_NORMAL) {
      $row[] = t('Custom');
      $row[] = l(t('edit'), 'admin/config/file/file-styles/edit/' . $style['name'], $link_attributes);
      $row[] = l(t('delete'), 'admin/config/file/file-styles/delete/' . $style['name'], $link_attributes);
    }
    elseif ($style['storage'] == IMAGE_STORAGE_OVERRIDE) {
      $row[] = t('Overridden');
      $row[] = l(t('edit'), 'admin/config/file/file-styles/edit/' . $style['name'], $link_attributes);
      $row[] = l(t('revert'), 'admin/config/file/file-styles/revert/' . $style['name'], $link_attributes);
    }
    else {
      $row[] = t('Default');
      $row[] = l(t('edit'), 'admin/config/file/file-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/file/file-styles/add'),
        )),
      ),
    );
  }
  return theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
}