Adding contextual links via Views fields does not work

Created on 13 July 2015, over 9 years ago
Updated 15 August 2024, 3 months ago

Problem

When adding the contextual links field to a view that is configured to show fields, it won't show anything, plus notices in log.

User error: "attributes" is an invalid render array key in Drupal\Core\Render\Element::children() (line 98 of /app/web/core/lib/Drupal/Core/Render/Element.php)

Steps to reproduce

  • Fresh Drupal 9 install.
  • Create some content.
  • Create a view of that content type.
  • Display fields
  • The field Title shows up by default.
  • Add the field Link to edit content and hide it.
  • Add the general Contextual links field and select to use the Link to edit the content.
  • Save the view and visit it.
  • You will not get the contextual link for node edit. Of course you will see the contextual link to edit the view, so do not get confused here.
  • Check the logs and you will see some notices too.

Remaining tasks



- Add test coverage

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Contextual 

Last updated about 2 months ago

Created by

🇬🇧United Kingdom Psycle Interactive

Live updates comments and jobs are added and updated live.
  • VDC

    Related to the Views in Drupal Core initiative.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024