Commit 915f4479 authored by jurgenhaas's avatar jurgenhaas

Issue #2837713: Can't get the popup to work in a views field

parent a91fa80c
......@@ -7,6 +7,7 @@
namespace Drupal\colorbox_field_formatter\Plugin\Field\FieldFormatter;
use Drupal\colorbox\ColorboxAttachment;
use Drupal\Component\Utility\Html;
use Drupal\Core\Annotation\Translation;
use Drupal\Core\Field\Annotation\FieldFormatter;
......@@ -192,6 +193,14 @@ class ColorboxFieldFormatter extends FormatterBase {
$element[$delta] = $link->toRenderable();
}
/** @var ColorboxAttachment $attachment */
$attachment = \Drupal::getContainer()->get('colorbox.attachment');
// Attach the Colorbox JS and CSS.
if ($attachment->isApplicable()) {
$attachment->attach($element);
}
return $element;
}
......
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