Commit 093c7b8e authored by damienmckenna's avatar damienmckenna Committed by Damien McKenna
Browse files

Issue #3208147 by DamienMcKenna: Simplify nested ternary logic in _link_sanitize().

parent 0b1a5d7a
......@@ -10,6 +10,7 @@ Link 7.x-1.x-dev, xxxx-xx-xx
#3120382 by dsnopek, RenatoG, DamienMcKenna: Notice: Undefined index: title in
link_field_load() (line 310 of link.module).
By DamienMcKenna: Unnecessary syntax change broke PHP 5.3 compatibility.
#3208147 by DamienMcKenna: Simplify nested ternary logic in _link_sanitize().
Link 7.x-1.7, 2019-11-14
......
......@@ -627,9 +627,15 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) {
$entity_type = $instance['entity_type'];
$entity_info = entity_get_info($entity_type);
$property_id = $entity_info['entity keys']['id'];
$entity_token_type = isset($entity_info['token type']) ? $entity_info['token type'] : (
$entity_type == 'taxonomy_term' || $entity_type == 'taxonomy_vocabulary' ? str_replace('taxonomy_', '', $entity_type) : $entity_type
);
if (isset($entity_info['token type'])) {
$entity_token_type = $entity_info['token type'];
}
elseif ($entity_type == 'taxonomy_term' || $entity_type == 'taxonomy_vocabulary') {
$entity_token_type = str_replace('taxonomy_', '', $entity_type);
}
else {
$entity_token_type = $entity_type;
}
if (isset($instance['settings']['enable_tokens']) && $instance['settings']['enable_tokens']) {
$text_tokens = token_scan($item['url']);
if (!empty($text_tokens)) {
......
Supports Markdown
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