Similar to Field Collections, Stacks and vanilla ECK entities using Entity Reference, it seems that Bricks suffers from the critical mistake of not supporting revisions on the parent entity, thus any changes made to the brick objects are immediately made public. This means that Content Moderation or other editorial workflow system would be broken when using Bricks.

To resolve this, rewrite the module to build off Entity Reference Revisions instead of Entity Reference.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna created an issue. See original summary.

DamienMcKenna’s picture

DamienMcKenna’s picture

Title: Support entity workflows via revision tracking » Rewrite to use Entity Reference Revisions
Issue summary: View changes
anydigital’s picture

Your truth Damien!

I tried to implement this, but I'm rather new to 8.x fields/widgets/formatters world. Can you please advise on pros & cons for the following options?

1. Extend right from EntityReferenceRevisionsItem instead EntityReferenceItem. => But IEF can be broken, right?

2. Custom support by storing target_revision_id per each item (I already have serialized `options` column).

3. Do not extend at all, use EntityReferenceRevisionsItem as is. But I need to add several db columns somehow.

Looking forward for your thoughts!

anydigital’s picture

Another related issues for custom Brick entities powered by ECK - https://www.drupal.org/node/2788507.

But we can still work on support for revisions on widget side (Bricks can work with any entity types, ie nodes).

DamienMcKenna’s picture

I don't have any advice on how to approach using Entity Reference Revisions instead of Entity Reference, you should check with the Paragraphs maintainers on that.

  • tonystar committed 38c87c8 on 8.x-1.x
    Issue #2859679 by tonystar, DamienMcKenna: Rewrite to use Entity...
anydigital’s picture

Status: Active » Fixed

Available as a core submodule (Bricks Revisions) starting from 8.x-1.3!

caldenjacobs’s picture

Bravo, @tonystar! :)

pavlosdan’s picture

After enabling the Bricks Revisions module and rebuilding the cach there's 2 "Paragraphs" options showing under Reference Revisions when adding a new field to a node. One is seemingly provided by Bricks according to the HTML of the element. Please refer to attached screenshot. Possible conflict with Paragraphs if that module is also installed on the site? (though admittedly someone using Bricks might not be using Paragraphs as well as they seem to satisfy the same need). Thought I'd give a heads up anyway.

pavlosdan’s picture

Seems that this is not an issue with Bricks but an issue with Paragraphs as they do not seem to provide their own FieldType extending EntityReferenceRevisionsItem and instead are treating all entity reference revision field types as possible field types to be used with Paragraphs. (from what I understood from my digging around the Bricks and Paragraphs code and this postponed issue: https://www.drupal.org/node/2430209).

anydigital’s picture

Thanks Pavlos for reporting!

Possible conflict with Paragraphs if that module is also installed on the site?

No conflicts. Bricks field type and widget are designed to be compatible with ANY entity, and since Paragraph is just entity - they work well together.

Seems that this is not an issue with Bricks but an issue with Paragraphs as they do not seem to provide their own FieldType extending EntityReferenceRevisionsItem and instead are treating all entity reference revision field types as possible field types to be used with Paragraphs. (from what I understood from my digging around the Bricks and Paragraphs code and this postponed issue: https://www.drupal.org/node/2430209).

Thanks for pointing! It's not a bug actually, Bricks is one field type and generic Entity Reference Revisions is another one => that's why you see two options labeled "Paragraph" - the same target (Paragraph) but different field types.

pavlosdan’s picture

I see. thanks a lot for explaining Tony! much appreciated :)

anydigital’s picture

You are welcome!

Also you can always ask/report in Slack: https://drupalslack.herokuapp.com, channel: #bricks or direct message: @tonystar!

Mohammed J. Razem’s picture

It seems that when creating a new field of type "Bricks (revisioned)" the Brick bundle is not available for "Type of item to reference".
However, Paragraph, Content, Media, Custom block are available.

Is this a limitation from ECK? Or am I missing something?

anydigital’s picture

Mohammed, correct-

ECK revisions support is in progress: https://www.drupal.org/node/2788507.

Status: Fixed » Closed (fixed)

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

ashish.ietecs’s picture

We need to implement revision support using brick and eck. We are using brick , eck , inline entity form, entity reference revision, and brick revision as a field of type. Initially when we used, it didn't work for us. Whenever we update any brick bundle inside brick content then immediately referenced brick bundle get published with latest revision. After searching on web we have applied below patches in -

For eck revision support -
https://www.drupal.org/node/2788507 -

For inline entity reference revision support -
https://www.drupal.org/node/2367235 -

Now after applying above patches, revisions of referenced brick bundle is maintained with only entity reference revision field widget, but not with brick revision field. By using brick revision field, it always update with latest revision of referenced brick bundle to parent entity. We have to use brick revision field for the legacy purpose. Any one has encounter in this situation and applied any solution can please help me out. This is a blocker situation for us. Please help us.

DamienMcKenna’s picture

@ashish.ietecs: You should open a new "support request" issue to cover this request, as this issue is closed most people won't see it.