image_style_options($include_empty = TRUE)
Gets an array of image styles suitable for using as select list options.
$include_empty: If TRUE a '- None -' option will be inserted in the options array.
Array of image styles both key and value are set to style name.
function image_style_options($include_empty = TRUE) { $styles = ImageStyle::loadMultiple(); $options = array(); if ($include_empty && !empty($styles)) { $options[''] = t('- None -'); } foreach ($styles as $name => $style) { $options[$name] = $style->label(); } if (empty($options)) { $options[''] = t('No defined styles'); } return $options; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!image!image.module/function/image_style_options/8.1.x