image_style_options

7 image.module image_style_options($include_empty = TRUE)
8 image.module image_style_options($include_empty = TRUE)

Get an array of image styles suitable for using as select list options.

Parameters

$include_empty: If TRUE a <none> option will be inserted in the options array.

Return value

Array of image styles both key and value are set to style name.

6 calls to image_style_options()

File

modules/image/image.module, line 743
Exposes global functionality for creating image styles.

Code

function image_style_options($include_empty = TRUE) {
  $styles = image_styles();
  $options = array();
  if ($include_empty && !empty($styles)) {
    $options[''] = t('<none>');
  }
  // Use the array concatenation operator '+' here instead of array_merge(),
  // because the latter loses the datatype of the array keys, turning
  // associative string keys into numeric ones without warning.
  $options = $options + drupal_map_assoc(array_keys($styles));
  if (empty($options)) {
    $options[''] = t('No defined styles');
  }
  return $options;
}
Login or register to post comments