You are here

image_hover_effects.module in Image Hover Effects 8

Same filename and directory in other branches
  1. 7 image_hover_effects.module

Primary module hooks for Image Hover Effects module.

File

image_hover_effects.module
View source
<?php

/**
 * @file
 * Primary module hooks for Image Hover Effects module.
 */
use Drupal\Core\Template\Attribute;

/**
 * Implements hook_theme().
 */
function image_hover_effects_theme($existing, $type, $theme, $path) {
  return [
    'image_hover_effects_image_formatter' => [
      'variables' => [
        'item' => NULL,
        'item_attributes' => NULL,
        'url' => NULL,
        'image_style' => NULL,
        'link_attributes' => NULL,
      ],
    ],
    'image_hover_effects_responsive_image_formatter' => array(
      'variables' => array(
        'item' => NULL,
        'item_attributes' => NULL,
        'url' => NULL,
        'responsive_image_style_id' => NULL,
        'link_attributes' => NULL,
      ),
    ),
  ];
}

/**
 * Prepares variables for image formatter templates.
 */
function template_preprocess_image_hover_effects_image_formatter(&$variables) {
  module_load_include('inc', 'image', 'image.field');
  template_preprocess_image_formatter($variables);
  $variables['link_attributes'] = new Attribute($variables['link_attributes']);
}

/**
 * Prepares variables for responsive image formatter templates.
 */
function template_preprocess_image_hover_effects_responsive_image_formatter(&$variables) {
  template_preprocess_responsive_image_formatter($variables);
  $variables['link_attributes'] = new Attribute($variables['link_attributes']);
}

Functions

Namesort descending Description
image_hover_effects_theme Implements hook_theme().
template_preprocess_image_hover_effects_image_formatter Prepares variables for image formatter templates.
template_preprocess_image_hover_effects_responsive_image_formatter Prepares variables for responsive image formatter templates.