Commit e07f9759 authored by jurgenhaas's avatar jurgenhaas

Issue #2860231 by brockfanning: Add options for controlling the "rel"...

Issue #2860231 by brockfanning: Add options for controlling the "rel" attribute for Colorbox grouping
parent 50a97935
......@@ -116,6 +116,12 @@ class ColorboxFieldFormatter extends FormatterBase {
'#type' => 'textfield',
'#default_value' => $this->getSetting('class'),
);
$form['rel'] = array(
'#title' => $this->t('Rel'),
'#type' => 'textfield',
'#default_value' => $this->getSetting('rel'),
'#description' => $this->t('This can be used to identify a group for Colorbox to cycle through.'),
);
return $form;
}
......@@ -149,6 +155,9 @@ class ColorboxFieldFormatter extends FormatterBase {
if (!empty($this->getSetting('class'))) {
$summary[] = $this->t('Classes: @class', ['@class' => $this->getSetting('class'),]);
}
if (!empty($this->getSetting('rel'))) {
$summary[] = $this->t('Rel: @rel', ['@rel' => $this->getSetting('rel')]);
}
return $summary;
}
......@@ -181,6 +190,9 @@ class ColorboxFieldFormatter extends FormatterBase {
if (!empty($this->getSetting('class'))) {
$options['attributes']['class'] = array_merge($options['attributes']['class'], explode(' ', $this->getSetting('class')));
}
if (!empty($this->getSetting('rel'))) {
$options['attributes']['rel'] = $this->getSetting('rel');
}
$url->setOptions($options);
$link = Link::fromTextAndUrl($output, $url);
......
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