Currently the user-link/user-cancel-link/user-edit-link still uses just the UID and constructs the uri for itself, but there is no reason for them to do that,
as the entities are loaded already anyway.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review
FileSize
5.82 KB

Adapted the parameters so it's way easier to get what is going on.

Status: Needs review » Needs work

The last submitted patch, drupal-1859884-1.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
6.23 KB
3.32 KB

Some improvements.

Status: Needs review » Needs work
Issue tags: -VDC

The last submitted patch, drupal-1859884-3.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
Issue tags: +VDC

#3: drupal-1859884-3.patch queued for re-testing.

tim.plunkett’s picture

+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.phpundefined
@@ -57,16 +58,29 @@ public function query() {
+  public function render_link(EntityInterface $entity, \stdClass $values) {

It's sad to see a stdClass here, but it was actually always there, just not typehinted. So, fine.

+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/Link.phpundefined
@@ -57,16 +58,29 @@ public function query() {
+    $uri = $entity->uri();
+    $this->options['alter']['path'] = $uri['path'];

Someday we'll write a helper to just get the 'path' part :)

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/field/FieldPluginBase.phpundefined
@@ -355,12 +355,15 @@ function element_wrapper_classes($row_index = NULL) {
+   * @param \stdClass $values
...
+  public function get_entity($values) {

Any reason to not typehint this as well?
Or leave it out altogether, it doesn't seem to be 100% related

dawehner’s picture

FileSize
755 bytes
6.24 KB

Let's do that.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me!

catch’s picture

Status: Reviewed & tested by the community » Fixed

Yep. Committed/pushed to 8.x.

tstoeckler’s picture

Status: Fixed » Needs review
FileSize
776 bytes
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/field/LinkCancel.php
@@ -21,19 +22,17 @@
+  public function render_link(EntityInterface $entity, \stdClass $values) {
+      if ($entity && user_cancel_access($entity)) {
       $this->options['alter']['make_link'] = TRUE;

I hope it's OK that I re-open this issue for this, but here's a quick follow-up to fix the wrong indentation in that hunk.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Sure, this looks perfect.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed the follow-up.

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