Hi, when trying to output the field: {{ drupal_field('body', 'node', 49) }}
I get the following error in browser's console:
Uncaught Quick Edit could not associate the rendered entity field markup (with [data-quickedit-field-id="node/49/body/lv/default"]) with the corresponding rendered entity markup: no parent DOM node found with [data-quickedit-entity-id="node/49"]. This is typically caused by the theme's template for this entity type forgetting to print the attributes.

I suppose there is some missing wrapper or attribute thus Drupal is unable output the edit icon?

Comments

Gugols created an issue. See original summary.

chi’s picture

Title: {{ drupal_field .. }} causes Javascript error. » drupal_field() causes Javascript error.
Related issues: +#2923337: Quick edit error when rendering commerce product variation fields injected into the commerce_product template
chi’s picture

Title: drupal_field() causes Javascript error. » drupal_field() causes Javascript error

Seems like Quick edit module does not support editing fields when they are printed separately from parent entity.
I could only find a way to disable Quick edit for a certain field.

/**
 * Implements hook_preprocess_field().
 */
function HOOK_preprocess_field__node__body(&$vars) {
  unset($vars['attributes']['data-quickedit-field-id']);
}
crash_springfield’s picture

I'm getting this error too and am confused about what it means. Everything appears to be working fine.

chi’s picture

Status: Active » Closed (won't fix)

I think this needs to be fixed in Drupal core.

One more way to suppress the error message is displaying HTML element with entity ID attribute.

<span data-quickedit-entity-id="node/1"></span>
{{ drupal_field('body', 'node', 1) }}
emb03’s picture

I am getting this error as well. Can anyone confirm that this is Drupal Core bug and reopen this ticket?

#5 worked for me, but this is not something I can do on a production site. I am only getting it on one template...

Thanks,

off’s picture

#5 is working.. Thank you, Chi!