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?

CommentFileSizeAuthor
#2 1370386-2.patch2.27 KBswentel
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

swentel’s picture

Hmm 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.

swentel’s picture

Status: Active » Needs review
FileSize
2.27 KB

Can you test with this patch ?

loominade’s picture

the title now links to the correct uri. thank you :)

swentel’s picture

Status: Needs review » Fixed

Ok great, committed and pushed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.