Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
hi,
I changed the uri of all nodes by using hook_entity_info_alter like this:
function custom_entity_info_alter(&$entity_info) {
$entity_info['node']['uri callback'] = 'my_custom_url_callback';
}
function my_custom_url_callback($node) {
return array(
'path' => 'foo/bar/' . $node->nid,
);
}
when I now for example set the image-formatter on 'link to content', it properly links to foo/bar/123
. but the ds title field still links to node/123
In ds_render_field
is a structure like this:
if ($settings['link']) {
if (isset($field['entity']->uri['path'])) {
$path = $field['entity']->uri['path'];
}
else {
$entity_key = $field['properties']['entity_id_key'];
$entity_path = $field['properties']['entity_path'];
$path = $entity_path . '/' . $field['entity']->{$entity_key};
}
$output = l($output, $path);
}
I found out that $field['entity']->uri
is never defined here. I'm not much into this but it seems to be a bug. is it?
Comment | File | Size | Author |
---|---|---|---|
#2 | 1370386-2.patch | 2.27 KB | swentel |
Comments
Comment #1
swentel CreditAttribution: swentel commentedHmm true, I'll probably have to check entity_info for the url callback, nice catch, I'll try to come up with a patch soon.
Comment #2
swentel CreditAttribution: swentel commentedCan you test with this patch ?
Comment #3
loominade CreditAttribution: loominade commentedthe title now links to the correct uri. thank you :)
Comment #4
swentel CreditAttribution: swentel commentedOk great, committed and pushed.