image_style_options

  1. drupal
    1. 8
    2. 7
Versions
8 – 7 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 functions call image_style_options()

image_example_style_form in examples/image_example/image_example.pages.inc
Form for uploading and displaying an image using selected style.
image_field_formatter_settings_form in modules/image/image.field.inc
Implements hook_field_formatter_settings_form().
image_field_formatter_settings_summary in modules/image/image.field.inc
Implements hook_field_formatter_settings_summary().
image_field_widget_settings_form in modules/image/image.field.inc
Implements hook_field_widget_settings_form().
image_style_delete_form in modules/image/image.admin.inc
Form builder; Form for deleting an image style.
user_admin_settings in modules/user/user.admin.inc
Form builder; Configure user settings for this site.

Code

modules/image/image.module, line 677

<?php
function image_style_options($include_empty = TRUE) {
  $styles = image_styles();
  $options = array();
  if ($include_empty && !empty($styles)) {
    $options[''] = t('<none>');
  }
  $options = array_merge($options, drupal_map_assoc(array_keys($styles)));
  if (empty($options)) {
    $options[''] = t('No defined styles');
  }
  return $options;
}
?>