Entity Embed 7.x currently supports rendering an entity using a specific view mode. It would be great if users could select a specific field formatter like they can in D8.

Comments

Devin Carlson created an issue. See original summary.

devin carlson’s picture

Status: Active » Needs review
StatusFileSize
new36.91 KB

An initial patch that demonstrates a basic version of this functionality. todo is building a display plugin system similar to the one used in 8.x-1.x.

Status: Needs review » Needs work

The last submitted patch, 2: add-field-formatter-support-2550669-1.patch, failed testing.

devin carlson’s picture

Status: Needs work » Needs review
StatusFileSize
new37.49 KB

Fixed a few issues.

Status: Needs review » Needs work

The last submitted patch, 4: add-field-formatter-support-2550669-4.patch, failed testing.

devin carlson’s picture

Status: Needs work » Needs review
StatusFileSize
new54.85 KB

Accommodated test changes and added additional tests.

bneil’s picture

Status: Needs review » Needs work

When I run the update, it fails with the following error. I had previously updated from 7.x-1.x to 7.x-2.x before applying the patch. Doing a fresh install, I do not notice an issue.

SQLSTATE[01000]: Warning: 1265 Data truncated for column [error]
'display_plugins' at row 1
Performed update: entity_embed_update_7101

After configuring the allowed display options for a file entity button, I noticed that I see all available display options when embedding. When I select one that I did allow and click Embed, I get the following javascript alert:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /entity-embed/preview/filtered_html?value=%3Cdrupal-entity+data-entity-type%3D%22file%22+data-entity-id%3D%221%22+data-entity-uuid%3D%22%22+data-entity-embed-display%3D%22image%22+data-entity-embed-settings%3D%22%7B%26quot%3Bimage_style%26quot%3B%3A%26quot%3Blarge%26quot%3B%2C%26quot%3Bimage_link%26quot%3B%3A%26quot%3B%26quot%3B%7D%22+data-embed-button%3D%22fil%22+data-entity-label%3D%22file%22+data-align%3D%22center%22+id%3D%22entity-embed-0%22+data-cke-widget-data%3D%22%257B%257D%22+data-cke-widget-upcasted%3D%221%22+data-cke-widget-keep-attr%3D%220%22+data-widget%3D%22drupalentity%22+class%3D%22cke_widget_element%22%3E%3C%2Fdrupal-entity%3E
StatusText: Service unavailable (with message)
ResponseText: Recoverable fatal error: Argument 4 passed to render_entity_embed_display_plugin() must be an array, string given, called in /path-to-drupal/sites/all/modules/entity_embed/includes/entity_embed.display.inc on line 50 and defined in render_entity_embed_display_plugin() (line 76 of /path-to-drupal/sites/all/modules/entity_embed/includes/entity_embed.display.inc)

.

devin carlson’s picture

Status: Needs work » Needs review
Related issues: +#2105841: Xss filter() mangles image captions and title/alt/data attributes
StatusFileSize
new58.9 KB

An updated patch which fixes the upgrade issue by providing initial data for existing buttons, restricts formatter selection for file entities to those which support a given file's MIME type, standardizes the formatter attribute to include the module name (as it does in D8) and fixes a variety of compatibility issues with various formatters provided by other contrib modules.

This requires core to be patched with the backport of #2105841-90: Xss filter() mangles image captions and title/alt/data attributes.

Additionally, using this has made it easy to uncover various issues with formatters, notably a couple provided by Entity Reference. #2495405: Notice : Undefined variable: element in entityreference_field_formatter_settings_form() (line 1141 in /sites/all/modules/entityreference/entityreference.module). #1823406: Undefined index entityreference_field_formatter_prepare_view().

devin carlson’s picture

StatusFileSize
new59.27 KB

Fixed a couple of bugs on the embed form that crept in while standardizing the formatter attribute. Also removed "duplicate" formatters if File Image Formatters is enabled.

devin carlson’s picture

Status: Needs review » Fixed

I've created a new 7.x-3.x branch to host the field formatter display capabilities. This will be required if/when we make Entity Reference a dependency in #2554501: Default display plugin duplicates the Rendered entity field formatter display plugin and makes development easier since we won't have to reroll large patches.

I don't plan on creating an actual release until the blocking core/contrib issues are fixed and more testing has occurred. I see the 3.x branch supplanting the 2.x branch and eventually becoming the recommended release while 1.x continues to remain supported.

  • Devin Carlson committed 8b67f77 on 7.x-3.x
    Issue #2550669 by Devin Carlson: Backport field formatter display...

Status: Fixed » Closed (fixed)

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