image_style_options($include_empty = TRUE)
Gets 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.
File
- core/modules/image/image.module, line 240
- Exposes global functionality for creating image styles.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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 ; } |
Please login to continue.