Commit ca172588 authored by frjo's avatar frjo

Issue #2647776: Add the setting for returnFocus

parent c04e878b
......@@ -13,6 +13,7 @@ custom:
initialwidth: '300'
initialheight: '250'
overlayclose: TRUE
returnfocus: TRUE
fixed: TRUE
scrolling: TRUE
slideshow:
......
......@@ -74,6 +74,9 @@ colorbox.settings:
overlayclose:
type: boolean
label: 'Overlay close'
returnfocus:
type: boolean
label: 'Return focus'
fixed:
type: boolean
label: 'Fixed'
......
......@@ -74,6 +74,7 @@ class ColorboxAttachment implements ElementAttachmentInterface {
'next' => $this->settings->get('custom.text_next'),
'close' => $this->settings->get('custom.text_close'),
'overlayClose' => $this->settings->get('custom.overlayclose') ? TRUE : FALSE,
'returnFocus' => $this->settings->get('custom.returnfocus') ? TRUE : FALSE,
'maxWidth' => $this->settings->get('custom.maxwidth'),
'maxHeight' => $this->settings->get('custom.maxheight'),
'initialWidth' => $this->settings->get('custom.initialwidth'),
......
......@@ -166,6 +166,13 @@ class ColorboxSettingsForm extends ConfigFormBase {
'#description' => $this->t('Enable closing Colorbox by clicking on the background overlay.'),
'#states' => $this->getState(static::STATE_CUSTOM_SETTINGS),
);
$form['colorbox_custom_settings']['colorbox_returnfocus'] = array(
'#type' => 'checkbox',
'#title' => $this->t('Return focus'),
'#default_value' => $config->get('custom.returnfocus'),
'#description' => $this->t('Return focus when Colorbox exits to the element it was launched from.'),
'#states' => $this->getState(static::STATE_CUSTOM_SETTINGS),
);
$form['colorbox_custom_settings']['colorbox_fixed'] = array(
'#type' => 'checkbox',
'#title' => $this->t('Fixed'),
......@@ -306,6 +313,7 @@ class ColorboxSettingsForm extends ConfigFormBase {
->set('custom.text_next', $form_state->getValue('colorbox_text_next'))
->set('custom.text_close', $form_state->getValue('colorbox_text_close'))
->set('custom.overlayclose', $form_state->getValue('colorbox_overlayclose'))
->set('custom.returnfocus', $form_state->getValue('colorbox_returnfocus'))
->set('custom.maxwidth', $form_state->getValue('colorbox_maxwidth'))
->set('custom.maxheight', $form_state->getValue('colorbox_maxheight'))
->set('custom.initialwidth', $form_state->getValue('colorbox_initialwidth'))
......
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