Commit b9f6051c authored by frjo's avatar frjo

Added token browser ui if the token module is installed, as in the Drupal 7 version.

parent 0fb008da
......@@ -176,6 +176,20 @@ class ColorboxFormatter extends ImageFormatterBase implements ContainerFactoryPl
),
),
);
if (\Drupal::moduleHandler()->moduleExists('token')) {
$element['colorbox_token_gallery'] = array(
'#type' => 'fieldset',
'#title' => t('Replacement patterns'),
'#theme' => 'token_tree_link',
'#token_types' => array($form['#entity_type'], 'file'),
'#states' => array(
'visible' => array(
':input[name$="[settings_edit_form][settings][colorbox_gallery]"]' => array('value' => 'custom'),
),
),
);
}
else {
$element['colorbox_token_gallery'] = array(
'#type' => 'fieldset',
'#title' => $this->t('Replacement patterns'),
......@@ -186,6 +200,7 @@ class ColorboxFormatter extends ImageFormatterBase implements ContainerFactoryPl
),
),
);
}
$caption = array(
'auto' => $this->t('Automatic'),
......@@ -212,6 +227,20 @@ class ColorboxFormatter extends ImageFormatterBase implements ContainerFactoryPl
),
),
);
if (\Drupal::moduleHandler()->moduleExists('token')) {
$element['colorbox_token_caption'] = array(
'#type' => 'fieldset',
'#title' => t('Replacement patterns'),
'#theme' => 'token_tree_link',
'#token_types' => array($form['#entity_type'], 'file'),
'#states' => array(
'visible' => array(
':input[name$="[settings_edit_form][settings][colorbox_caption]"]' => array('value' => 'custom'),
),
),
);
}
else {
$element['colorbox_token_caption'] = array(
'#type' => 'fieldset',
'#title' => $this->t('Replacement patterns'),
......@@ -222,6 +251,7 @@ class ColorboxFormatter extends ImageFormatterBase implements ContainerFactoryPl
),
),
);
}
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