Commit a3b5e85f authored by frjo's avatar frjo
Browse files

Move code to attache the Colorboc JS and CSS from hook_page_attachments() to...

Move code to attache the Colorboc JS and CSS from hook_page_attachments() to viewElements() in the Colorbox field formatter.
parent 6d8429ac
......@@ -8,7 +8,7 @@
/**
* The default path to the Colorbox directory.
*/
define('COLORBOX_MIN_PLUGIN_VERSION', '1.5.14');
define('COLORBOX_MIN_PLUGIN_VERSION', '1.6.1');
/**
......@@ -27,16 +27,6 @@ function colorbox_theme() {
);
}
/**
* Implements hook_page_attachments().
*/
function colorbox_page_attachments(array &$page) {
$attachment = \Drupal::service('colorbox.attachment');
if ($attachment->isApplicable()) {
$attachment->attach($page);
}
}
/**
* Implements hook_libraries_info().
*/
......
......@@ -319,6 +319,12 @@ class ColorboxFormatter extends ImageFormatterBase implements ContainerFactoryPl
);
}
// Attach the Colorbox JS and CSS.
$attachment = \Drupal::service('colorbox.attachment');
if ($attachment->isApplicable()) {
$attachment->attach($elements);
}
return $elements;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment