Same name and namespace in other branches
  1. 7.x modules/image/image.module \image_theme()
  2. 8.9.x core/modules/image/image.module \image_theme()
  3. 9 core/modules/image/image.module \image_theme()

Implements hook_theme().

File

core/modules/image/image.module, line 69
Exposes global functionality for creating image styles.

Code

function image_theme() {
  return [
    // Theme functions in image.module.
    '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.
      // - http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8
      // - http://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' => [],
      ],
    ],
    // Theme functions in image.admin.inc.
    'image_style_preview' => [
      'variables' => [
        'style' => NULL,
      ],
      'file' => 'image.admin.inc',
    ],
    'image_anchor' => [
      'render element' => 'element',
      'file' => 'image.admin.inc',
    ],
    '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' => [],
      ],
    ],
    // Theme functions in image.field.inc.
    'image_widget' => [
      'render element' => 'element',
      'file' => 'image.field.inc',
    ],
    'image_formatter' => [
      'variables' => [
        'item' => NULL,
        'item_attributes' => NULL,
        'url' => NULL,
        'image_style' => NULL,
      ],
      'file' => 'image.field.inc',
    ],
  ];
}