Commit d53ac521 authored by jurgenhaas's avatar jurgenhaas

#2211899 Implement support for tokens in the manual link

parent 26bd380c
......@@ -97,6 +97,21 @@ function colorbox_field_formatter_field_formatter_settings_form($field, $instanc
),
),
);
if (module_exists('token')) {
$element['token_help_wrapper'] = array(
'#type' => 'container',
'#states' => array(
'visible' => array(
'select.colorbox-field-formatter-link-type' => array('value' => 'manual'),
),
),
);
$element['token_help_wrapper']['token_help'] = array(
'#theme' => 'token_tree',
'#token_types' => array('entity' => $form['#entity_type']),
'#global_types' => FALSE,
);
}
$element['colorbox_field_formatter_width'] = array(
'#title' => t('Width'),
......@@ -181,7 +196,8 @@ function colorbox_field_formatter_field_formatter_view($entity_type, $entity, $f
$uri = entity_uri($entity_type, $entity);
}
else {
$uri = array('path' => $settings['colorbox_field_formatter_link']);
$link = module_exists('token') ? token_replace($settings['colorbox_field_formatter_link'], array($entity_type => $entity)) : $settings['colorbox_field_formatter_link'];
$uri = array('path' => $link);
}
$options = array(
......
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