function image_style_options

Same name and namespace in other branches
  1. 10 core/modules/image/image.module \image_style_options()
  2. 9 core/modules/image/image.module \image_style_options()
  3. 8.9.x core/modules/image/image.module \image_style_options()
  4. 7.x modules/image/image.module \image_style_options()
  5. main core/modules/image/image.module \image_style_options()

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

Parameters

bool $include_empty: If TRUE a '- None -' option will be inserted in the options array.

Return value

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

Deprecated

in drupal:11.4.0 and is removed from drupal:13.0.0. Use ImageDerivativeUtilities::styleOptions() instead.

See also

https://www.drupal.org/node/3567619

File

core/modules/image/image.module, line 50

Code

function image_style_options($include_empty = TRUE) : array {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use \\Drupal\\image\\ImageDerivativeUtilities::styleOptions() instead. See https://www.drupal.org/node/3567619', E_USER_DEPRECATED);
  return \Drupal::service(ImageDerivativeUtilities::class)->styleOptions($include_empty);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.