Steps to replicate:

- Create a normal content view.
- Add the "Content: Authored by" field and enable the "Link this field to its user" option.
- Note that in the view, it has the correct uid, but links to node/{uid}

This effects other base tables with uid fields as well. eg: comments

The views data for these tables points the uid field at the 'user' plugin. (Drupal\user\Plugin\views\field\User)

The problem is in the renderLink() method of that class.

It generates the path like so:

$entity = $this->getEntity($values);
$this->options['alter']['path'] = $entity->getSystemPath();

This works fine when the base table IS the user table. However for any other base table, the entity will be wrong.

Seems to me that the user entity should be hard coded here.
Maybe it should be done similar to the "comment_username" plugin (Drupal\comment\Plugin\views\field\Username)

Something like the following maybe??

$account = entity_create('user');
$account->uid = $this->getValue($values, 'uid');
$this->options['alter']['path'] = $account->getSystemPath();

Comments

dpi’s picture

Version: 8.0.0-beta6 » 8.0.x-dev
Status: Active » Closed (cannot reproduce)
Issue tags: -#entity #views

No longer applicable