Commit cd54d14a authored by RenatoG's avatar RenatoG Committed by RenatoG

Issue #2892746 by PatrickMichael, RenatoG: Notice: Undefined index:...

Issue #2892746 by PatrickMichael, RenatoG: Notice: Undefined index: #entity_type in ColorboxFormatter.php
parent 631a8a81
......@@ -5,8 +5,6 @@
* Install, update and uninstall functions for the colorbox module.
*/
use Drupal\Core\Url;
/**
* Implements hook_install().
*/
......
......@@ -190,11 +190,18 @@ class ColorboxFormatter extends ImageFormatterBase implements ContainerFactoryPl
],
];
if ($this->moduleHandler->moduleExists('token')) {
$entity_type = '';
if (!empty($form['#entity_type'])) {
$entity_type = $form['#entity_type'];
}
$element['colorbox_token_gallery'] = [
'#type' => 'fieldset',
'#title' => $this->t('Replacement patterns'),
'#theme' => 'token_tree_link',
'#token_types' => [$form['#entity_type'], 'file'],
'#token_types' => [$entity_type, 'file'],
'#states' => [
'visible' => [
':input[name$="[settings_edit_form][settings][colorbox_gallery]"]' => ['value' => 'custom'],
......@@ -241,11 +248,18 @@ class ColorboxFormatter extends ImageFormatterBase implements ContainerFactoryPl
],
];
if ($this->moduleHandler->moduleExists('token')) {
$entity_type = '';
if (!empty($form['#entity_type'])) {
$entity_type = $form['#entity_type'];
}
$element['colorbox_token_caption'] = [
'#type' => 'fieldset',
'#title' => $this->t('Replacement patterns'),
'#theme' => 'token_tree_link',
'#token_types' => [$form['#entity_type'], 'file'],
'#token_types' => [$entity_type, 'file'],
'#states' => [
'visible' => [
':input[name$="[settings_edit_form][settings][colorbox_caption]"]' => ['value' => 'custom'],
......
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