Skip to content
Snippets Groups Projects
Commit 57f18d8d authored by Gaus Surahman's avatar Gaus Surahman Committed by Gaus Surahman
Browse files

Issue #3390513 by W01F, gausarts: Option to configure header for the caption title

parent 9f08631d
Branches
Tags
No related merge requests found
Pipeline #24894 passed
......@@ -540,12 +540,16 @@ function hook_blazy_item_alter(array &$settings, array &$attributes, array &$ite
// $blazies->is('captioned') or $blazies->is('multimedia') in case
// captioned or not, or breaking multimedia or media player, etc.
// If any display issues with grid, media player, etc., refine or remove this.
// blazies.is[image|video_file|twitter, etc] is related to Media sources.
if ($blazies->get('namespace') == 'blazy' && $blazies->is('image')) {
$blazies->set('is.figcaption', TRUE)
->set('item.wrapper_tag', 'figure')
->set('item.wrapper_attributes.class', ['blazy__content']);
}
// Changed default caption title tag from H2 to H3.
$blazies->set('item.title_tag', 'h3');
// Since > 2.17-beta1, below is no longer needed, already merged.
// Modifies IMG attributes, relevant for BlazyFilter here, see
// https://www.drupal.org/project/blazy/issues/3374519:
......
......@@ -194,12 +194,13 @@ class BlazyManager extends BlazyManagerBase implements BlazyManagerInterface, Tr
$keys = array_combine($keys, $keys);
$keys = array_filter($keys, fn($k) => strpos($k, 'title') === FALSE, ARRAY_FILTER_USE_KEY);
$single = count($keys) == 1;
$ttag = $blazies->get('item.title_tag', 'h2');
// Supports multiple description fields.
foreach ($captions as $key => $caption) {
$css = $prefix . $key;
if (strpos($key, 'title') !== FALSE) {
$inline[$key] = $this->toHtml($caption, 'h2', $prefix . 'title');
$inline[$key] = $this->toHtml($caption, $ttag, $prefix . 'title');
}
elseif ($key == 'overlay') {
$overlays[$key] = $this->toHtml($caption, 'div', $css);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment