Profile entities should be rendered together with contextual links for consistency with the general editor flow for entities.

This is fixed by defining the links in profile.links.contextual.yml, adding the links via ProfileViewBuilder::alterBuild() and rendering them via $title_suffix.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

olofjohansson created an issue. See original summary.

olofbokedal’s picture

Patch implements the steps mentioned in the issue description.

olofbokedal’s picture

FileSize
1.59 KB

First patch didn't include new file. Fixed.

zerolab’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 3: profile-contextual_links-2922979-3.patch, failed testing. View results

olofbokedal’s picture

error: profile.links.contextual.yml: No such file or directory according to the failed test.

This file should get created. Anyone knows how to avoid this error? Patch applied cleanly for me but perhaps it needs to be created in a different way.

maaty388’s picture

I believe it has to do something with tests, correct me if I am wrong. Your patch is working fine, gets applied and everything so this is the only thing that I can think of right now.

jwilson3’s picture

Status: Needs work » Needs review

trigger tests again maybe?

Status: Needs review » Needs work

The last submitted patch, 3: profile-contextual_links-2922979-3.patch, failed testing. View results

bojanz’s picture

You'll want to retest this on Drupal 8.5.0, which now automatically adds contextual links, making at least the ViewBuilder portion of the patch unnecessary.

szeidler’s picture

Status: Needs work » Needs review
FileSize
569 bytes

With Drupal 8.5.0 and https://www.drupal.org/node/2928555 it seems, that only {{ title_suffix }} is required for making the contextual links working for me. Could you review the reduced patch?

mglaman’s picture

    'title_prefix' => [],
    'title_suffix' => [],

Prefix and suffix are defaults. May as well add them both, even we are not rendering the profile label/title separate.

mglaman’s picture

Nevermind, here is what media.html.twig has

<div{{ attributes }}>
  {{ title_suffix.contextual_links }}
  {{ content }}
</div>

Let's just copy them. They prove the existing patch is all we need.

mglaman’s picture

FileSize
991 bytes

Here is #11 with the links from #3 (otherwise nothing rendered.)

mglaman’s picture

Attaching a screenshot for good measure.

  • mglaman committed 5400ceb on 8.x-1.x
    Issue #2922979 by olofbokedal, mglaman, szeidler: Implement contextual...
mglaman’s picture

Status: Needs review » Fixed

Committed! Thanks, everyone.

Status: Fixed » Closed (fixed)

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