0

We hired someone else to make our theme, and they gave us something with the quickedit not working. What can cause this to break, and how do I fix it?

Here's what my contextual-links ul looks like right now:

<ul class="contextual-links" hidden=""><li class="quickedit"><a href="" role="button" aria-pressed="false">Quick edit</a></li><li class="entitynodeedit-form"></li><li class="entitynodedelete-form"></li></ul>

The entitynodeedit-form li is empty, as well as the delete li. What is supposed to fill them in, and how do I fix it?

  • 1
    Look in PHP error logs or watchdog (and JavaScript console errors if any) and post them if you still don't have an answer. I found that usually the modal or something javascript-y isn't working because of some PHP error in some contrib (or core) module making some assumption and throwing an exception or fatal error'ing. – mradcliffe Nov 8 '16 at 22:20
1

If there is not an obvious error in php or javascript, see the comment from @mradcliffe, then there are probably some attributes missing, because they were removed in twig templates.

The quickedit links are not delivered in html, they are build in javascript. For this the attributes to identify the involved entities and fields need to be present.

Look especially for the attributes data-quickedit-entity-id in node templates and data-quickedit-field-id in field templates.

This is the correct way to add attributes in twig:

{%
  set classes = [
    'red',
    'green',
  ]
%}
<div{{ attributes.addClass(classes) }}></div>

Source: https://www.drupal.org/docs/8/theming-drupal-8/using-attributes-in-templates

  • Thanks much, as it turned out the theme had explicitly overridden a links.html.twig template from Classy, and there was an if condition in it that was preventing them from ever showing. – RaisinBranCrunch Nov 21 '16 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.