Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 299604

Duplicate AJAX wrapper around a file field (D7 Backport)

$
0
0

Follow up to Backport [2346893] to Drupal 7.

Problem/Motivation

Duplicate AJAX wrappers are causing some errors to be rendered twice.
Symptoms have been reported around file field and image field.
In #115 @lauriii notes the element prefix and suffix are added in the twig template, as well as in the renderer.

Steps to replicate using the File field:

  • Add a file field to basic page content type.
  • Upload file of any type other than text.
  • Double error is triggered.

Double Error is displayed

Proposed resolution

Fix this at the source in the ajax rendering system, not just at the points where symptoms occur.
Patch at #176

@xjm notes the #render_children property is defined in core/lib/Drupal/Core/Render/Element/RenderElement.php

Remaining tasks

  • Needs theme system maintainer review.
  • Create a follow-up issue to backport this to D7.
  • Fix templates in a non backwards compatible manner for D9.
  • Resolve ongoing discussion of related changes to metadata.
  • Decide whether or not to bubble up the cache and assets here. [See #185 ]

Example of a user interface change

Show error once, instead of twice! :-) This is just one example. There are likely other places that will be impacted by this change.

Before patch:

before patch

Patched:

patched

API changes

When #render_children is set, everything inside render array except children will be ignored.

Data model changes

None.

Discussion Summary

@idimopoulas reports doing a manual review at #177
@Fabianx explains the problem clearly in #134 and provides a patch at #137
@joelpittet manual review with screenshots at #122
@swentel reports symptom is fixed for image fields but still occurring for file fields in #69

See also
#1920886: drupal_render() should check if it's rendering a 'render element' and if so call drupal_render_children() (inline) instead

Original report

If I edit my profile, and upload a picture to Picture field, after that I see the messages but twice all times. (drupal_render() should check if it's rendering a 'render element' and if so call drupal_render_children() (inline) instead (1920886) ) not about the ajax its just rendering the element.

user edit duplicate messages

I find these message only one place (/core/modules/file/file.module;466) and I think somewhere is called twice. István Palócz see that bug, and he said the problem somewhere in ajax response.


Viewing all articles
Browse latest Browse all 299604

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>