summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrenatog2017-06-05 16:18:15 (GMT)
committerRenato Goncalves de Araujo2017-06-05 16:18:15 (GMT)
commit17ba110cba8de198dc0f80cf8b458647b645f1eb (patch)
tree3baa5c34c5048382d4bc7107699eae2987e2d36b
parent77686a32cebd85f71aa147eb755343f6d39f9c49 (diff)
Issue #2883873 by RenatoG: Show tip for colorbox load and inline just if not enabled
-rw-r--r--src/Form/ColorboxSettingsForm.php80
1 files changed, 42 insertions, 38 deletions
diff --git a/src/Form/ColorboxSettingsForm.php b/src/Form/ColorboxSettingsForm.php
index e3f425f..549a717 100644
--- a/src/Form/ColorboxSettingsForm.php
+++ b/src/Form/ColorboxSettingsForm.php
@@ -296,17 +296,21 @@ class ColorboxSettingsForm extends ConfigFormBase {
'#default_value' => $config->get('advanced.compression_type'),
];
- $form['colorbox_extras'] = [
- '#type' => 'details',
- '#title' => $this->t('Extras'),
- ];
+ $moduleHandler = \Drupal::service('module_handler');
+ if (!$moduleHandler->moduleExists('colorbox_load') || !$moduleHandler->moduleExists('colorbox_inline')) {
- $form['colorbox_extras']['colorbox_additional_tips'] = [
- '#markup' => $this->t('You can find new features in the <a href="@url_colorbox_load" target="blank">Colorbox Load</a> and <a href="@url_colorbox_inline" target="blank">Colorbox Inline</a>', [
- '@url_colorbox_load' => 'https://www.drupal.org/project/colorbox_load',
- '@url_colorbox_inline' => 'https://www.drupal.org/project/colorbox_inline',
- ]),
- ];
+ $form['colorbox_extras'] = [
+ '#type' => 'details',
+ '#title' => $this->t('Extras'),
+ ];
+
+ $form['colorbox_extras']['colorbox_additional_tips'] = [
+ '#markup' => $this->t('You can find new features in the <a href="@url_colorbox_load" target="blank">Colorbox Load</a> and <a href="@url_colorbox_inline" target="blank">Colorbox Inline</a>', [
+ '@url_colorbox_load' => 'https://www.drupal.org/project/colorbox_load',
+ '@url_colorbox_inline' => 'https://www.drupal.org/project/colorbox_inline',
+ ]),
+ ];
+ }
return parent::buildForm($form, $form_state);
}
@@ -319,34 +323,34 @@ class ColorboxSettingsForm extends ConfigFormBase {
$config = $this->configFactory->getEditable('colorbox.settings');
$config
- ->set('custom.style', $form_state->getValue('colorbox_style'))
- ->set('custom.activate', $form_state->getValue('colorbox_custom_settings_activate'))
- ->set('custom.transition_type', $form_state->getValue('colorbox_transition_type'))
- ->set('custom.transition_speed', $form_state->getValue('colorbox_transition_speed'))
- ->set('custom.opacity', $form_state->getValue('colorbox_opacity'))
- ->set('custom.text_current', $form_state->getValue('colorbox_text_current'))
- ->set('custom.text_previous', $form_state->getValue('colorbox_text_previous'))
- ->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'))
- ->set('custom.initialheight', $form_state->getValue('colorbox_initialheight'))
- ->set('custom.fixed', $form_state->getValue('colorbox_fixed'))
- ->set('custom.scrolling', $form_state->getValue('colorbox_scrolling'))
- ->set('custom.slideshow.slideshow', $form_state->getValue('colorbox_slideshow'))
- ->set('custom.slideshow.auto', $form_state->getValue('colorbox_slideshowauto'))
- ->set('custom.slideshow.speed', $form_state->getValue('colorbox_slideshowspeed'))
- ->set('custom.slideshow.text_start', $form_state->getValue('colorbox_text_start'))
- ->set('custom.slideshow.text_stop', $form_state->getValue('colorbox_text_stop'))
- ->set('advanced.unique_token', $form_state->getValue('colorbox_unique_token'))
- ->set('advanced.mobile_detect', $form_state->getValue('colorbox_mobile_detect'))
- ->set('advanced.mobile_device_width', $form_state->getValue('colorbox_mobile_device_width'))
- ->set('advanced.caption_trim', $form_state->getValue('colorbox_caption_trim'))
- ->set('advanced.caption_trim_length', $form_state->getValue('colorbox_caption_trim_length'))
- ->set('advanced.compression_type', $form_state->getValue('colorbox_compression_type'));
+ ->set('custom.style', $form_state->getValue('colorbox_style'))
+ ->set('custom.activate', $form_state->getValue('colorbox_custom_settings_activate'))
+ ->set('custom.transition_type', $form_state->getValue('colorbox_transition_type'))
+ ->set('custom.transition_speed', $form_state->getValue('colorbox_transition_speed'))
+ ->set('custom.opacity', $form_state->getValue('colorbox_opacity'))
+ ->set('custom.text_current', $form_state->getValue('colorbox_text_current'))
+ ->set('custom.text_previous', $form_state->getValue('colorbox_text_previous'))
+ ->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'))
+ ->set('custom.initialheight', $form_state->getValue('colorbox_initialheight'))
+ ->set('custom.fixed', $form_state->getValue('colorbox_fixed'))
+ ->set('custom.scrolling', $form_state->getValue('colorbox_scrolling'))
+ ->set('custom.slideshow.slideshow', $form_state->getValue('colorbox_slideshow'))
+ ->set('custom.slideshow.auto', $form_state->getValue('colorbox_slideshowauto'))
+ ->set('custom.slideshow.speed', $form_state->getValue('colorbox_slideshowspeed'))
+ ->set('custom.slideshow.text_start', $form_state->getValue('colorbox_text_start'))
+ ->set('custom.slideshow.text_stop', $form_state->getValue('colorbox_text_stop'))
+ ->set('advanced.unique_token', $form_state->getValue('colorbox_unique_token'))
+ ->set('advanced.mobile_detect', $form_state->getValue('colorbox_mobile_detect'))
+ ->set('advanced.mobile_device_width', $form_state->getValue('colorbox_mobile_device_width'))
+ ->set('advanced.caption_trim', $form_state->getValue('colorbox_caption_trim'))
+ ->set('advanced.caption_trim_length', $form_state->getValue('colorbox_caption_trim_length'))
+ ->set('advanced.compression_type', $form_state->getValue('colorbox_compression_type'));
if ($form_state->getValue('colorbox_image_style')) {
$config->set('insert.image_style', $form_state->getValue('colorbox_image_style'));