baguettebox.module in baguetteBox.js 8
Same filename and directory in other branches
Primary module hooks for Baguettebox module.
File
baguettebox.moduleView source
<?php
/**
* @file
* Primary module hooks for Baguettebox module.
*/
use Drupal\Core\Template\Attribute;
/**
* Implements hook_theme().
*/
function baguettebox_theme() {
return [
'baguettebox_formatter' => [
'variables' => [
'item' => NULL,
'item_attributes' => NULL,
'link_attributes' => NULL,
'url' => NULL,
'image_style' => NULL,
],
],
];
}
/**
* Prepares variables for baguettebox formatter templates.
*
* Default template: baguettebox-formatter.html.twig.
*
* @param array $variables
* An associative array containing:
* - item: An ImageItem object.
* - item_attributes: An optional associative array of html attributes to be
* placed in the img tag.
* - image_style: An optional image style.
* - url: An optional \Drupal\Core\Url object.
*/
function template_preprocess_baguettebox_formatter(array &$variables) {
module_load_include('inc', 'image', 'image.field');
template_preprocess_image_formatter($variables);
$variables['link_attributes'] = new Attribute($variables['link_attributes']);
}
Functions
Name | Description |
---|---|
baguettebox_theme | Implements hook_theme(). |
template_preprocess_baguettebox_formatter | Prepares variables for baguettebox formatter templates. |