W3cubDocs

/Drupal 8

function image_theme

image_theme()

Implements hook_theme().

File

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

Code

function image_theme() {
  return array(
    // Theme functions in image.module.
    'image_style' => array(
      // 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' => array(
        'style_name' => NULL,
        'uri' => NULL,
        'width' => NULL,
        'height' => NULL,
        'alt' => '',
        'title' => NULL,
        'attributes' => array(),
      ),
    ),

    // Theme functions in image.admin.inc.
    'image_style_preview' => array(
      'variables' => array('style' => NULL),
      'file' => 'image.admin.inc',
    ),
    'image_anchor' => array(
      'render element' => 'element',
      'file' => 'image.admin.inc',
    ),
    'image_resize_summary' => array(
      'variables' => array('data' => NULL, 'effect' => array()),
    ),
    'image_scale_summary' => array(
      'variables' => array('data' => NULL, 'effect' => array()),
    ),
    'image_crop_summary' => array(
      'variables' => array('data' => NULL, 'effect' => array()),
    ),
    'image_rotate_summary' => array(
      'variables' => array('data' => NULL, 'effect' => array()),
    ),

    // Theme functions in image.field.inc.
    'image_widget' => array(
      'render element' => 'element',
      'file' => 'image.field.inc',
    ),
    'image_formatter' => array(
      'variables' => array('item' => NULL, 'item_attributes' => NULL, 'url' => NULL, 'image_style' => NULL),
      'file' => 'image.field.inc',
    ),
  );
}

© 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_theme/8.1.x