You are here

function imagecache_actions_get_style_label in ImageCache Actions 8

Same name and namespace in other branches
  1. 7 utility.inc \imagecache_actions_get_style_label()

Returns the label for the given style name.

As of D7.23 image styles can also have a human readable label besides their machine readable name. This function returns that label if available, or the name if the label is absent.

Parameters

string|null $style_name: The name of the image style.

Return value

string The label for the image style.

2 calls to imagecache_actions_get_style_label()
theme_canvasactions_aspect_summary in canvasactions/canvasactions.inc
Implements theme_hook() for the aspect switcher effect summary.
theme_imagecache_subroutine_summary in customactions/imagecache_customactions.module
Implements theme_hook() for the subroutine effect summary.

File

./utility.inc, line 129
utility.inc: uitility form, conversion and rendering functions for image processing.

Code

function imagecache_actions_get_style_label($style_name) {
  if (!empty($style_name)) {
    $style = image_style_load($style_name);
    $label = isset($style['label']) ? $style['label'] : $style['name'];
    if (!empty($style)) {
      return $label;
    }
    else {
      return $label . ' ' . t('<span class="error">Invalid reference. The referenced image style may have been deleted!</span>');
    }
  }
  else {
    return t('none');
  }
}