function ImageThemeHooks::theme
Implements hook_theme().
Attributes
#[Hook('theme')]
File
-
core/
modules/ image/ src/ Hook/ ImageThemeHooks.php, line 35
Class
- ImageThemeHooks
- Theme hook implementations for image module.
Namespace
Drupal\image\HookCode
public function theme() : array {
return [
'image_style' => [
// HTML 4 and XHTML 1.0 always require an alt attribute. The HTML 5
// draft allows the alt attribute to be omitted in some cases.
// Therefore, default the alt attribute to an empty string, but allow
// code using '#theme' => 'image_style' to pass explicit NULL for it to
// be omitted.
// Usually, neither omission nor an empty string satisfies accessibility
// requirements, so it is strongly encouraged for code using '#theme' =>
// 'image_style' to pass a meaningful value for the alt variable.
// - https://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8
// - https://www.w3.org/TR/xhtml1/dtds.html
// - http://dev.w3.org/html5/spec/Overview.html#alt
// The title attribute is optional in all cases, so it is omitted by
// default.
'variables' => [
'style_name' => NULL,
'uri' => NULL,
'width' => NULL,
'height' => NULL,
'alt' => '',
'title' => NULL,
'attributes' => [],
],
'initial preprocess' => static::class . ':preprocessImageStyle',
],
'image_style_preview' => [
'variables' => [
'style' => NULL,
],
'initial preprocess' => static::class . ':preprocessImageStylePreview',
],
'image_anchor' => [
'render element' => 'element',
'initial preprocess' => static::class . ':preprocessImageAnchor',
],
'image_resize_summary' => [
'variables' => [
'data' => NULL,
'effect' => [],
],
],
'image_scale_summary' => [
'variables' => [
'data' => NULL,
'effect' => [],
],
],
'image_crop_summary' => [
'variables' => [
'data' => NULL,
'effect' => [],
],
],
'image_scale_and_crop_summary' => [
'variables' => [
'data' => NULL,
'effect' => [],
],
],
'image_rotate_summary' => [
'variables' => [
'data' => NULL,
'effect' => [],
],
],
'image_widget' => [
'render element' => 'element',
'initial preprocess' => static::class . ':preprocessImageWidget',
],
'image_formatter' => [
'variables' => [
'item' => NULL,
'item_attributes' => NULL,
'url' => NULL,
'image_style' => NULL,
],
'initial preprocess' => static::class . ':preprocessImageFormatter',
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.