Problem/Motivation

Using real fields to maintain advanced layout settings is cumbersome, makes storage fragmented and makes it hard to enable these features (say a gallery with many settings) on a paragraph type.

Proposed resolution

Paragraphs will support plugins that could offer specific behaviors attached to paragraph types.

The site builder can enable these behaviors on a paragraph type.
As a result these behaviors could offer more settings and then offer fields to the paragraph edit form.
The fields may be placed / moved / grouped through regular field management (defaults should make sense).
The plugin will then deal with the form values and can move them into a serialised field, stored per paragraph.
The plugin also may consult these values and alter the output.

Plugins have a sequence and thus some plugin run later can extend what a previous plugin provides

Tasks

#2828506: Introduce a plugin system for paragraphs types
#2829671: Implement edit perspectives with tabs when editing
#2856008: Enable behavior plugins with a tristate
#2825581: [META] Introduce a sticky header
#2825570: [META] Introduce new action elements

User interface changes

API changes

Data model changes

Comments

miro_dietiker created an issue. See original summary.

miro_dietiker’s picture

Title: [META] Feature Plugins » [META] Behavior Plugins
Issue summary: View changes

Feature => Behavior :-)

jasonawant’s picture

Hello,

How is this issue related to https://www.drupal.org/project/paragraphs_collection? That module's project pages states

Paragraphs introduced a powerful plugin system to attach behaviors to paragraph types.

Are behavior plugins already included in paragraphs?

miro_dietiker’s picture

Issue summary: View changes

Hello @jasonawant

Yeah, Paragraphs Collection implements multiple Behavior Plugins and was the first pool of plugins to proof the concept.

They are implemented with the EXPERIMENTAL widget since a while now.

But i see, this META issue was not updated for a while and doesn't contain a clear issue overview... Starting to update the summary.

Most importantly the tristate issue was not mentioned here.
Many plugins lead to UI clutter (of the behavior tab). Thus we need to additionally mature the plugin system to better support a nice UX.

miro_dietiker’s picture

Priority: Normal » Major
Issue summary: View changes

Also adding #2825570: [META] Introduce new action elements
Many of our custom plugins (indirectly) interact with the widget functionality through extending the action button.

Raising prio since the Plugins are a key extension point and we should make it perfect to build on top of it.

DamienMcKenna’s picture

Just to mention it, some of the intended editorial workflow could be accomplished by adding Panelizer integration as the site builder could create multiple (layout-based) defaults then they could be modified on a per paragraphs record basis.

hawkeye.twolf’s picture

@damien, can you expand on your proposal a bit? I don't quite follow but want to because I'm planning to write a Paragraphs behaviour plugin that allows editors to choose a layout. @miro, it'll essentially work like your "Grid" bundle in Paragraphs Collection (renamed to "Layout" paragraph in Primer, it seems?) but leverage the layouts provided by the Layout Discovery module.

DamienMcKenna’s picture

@derek: Heya, how's it going? :)

With Panelizer you can customize an entity's display via a replacement for the normal "manage display" functionality. Because it uses Panels you're not just limited to repositioning fields from the entity, you can also add blocks 'n things. You can also create multiple displays and change between which one is used as the "default". The extra magic comes into play when you enable the "Allow users to select which display to use", it adds a selector to the entity's normal edit form to pick which of the customized displays to use for that individual entity.

FYI core is working towards rebuilding Panelizer in core, so this functionality will eventually be in core, and a conversion script will be made available.

hawkeye.twolf’s picture

It's going well, man, thanks :)

Ah, so are you saying we could use Panelizer with Paragraph entities? I had no idea! That would be nifty. So is "Panelizer in core" the same as the Layout Builder stuff that Dries demoed during the keynote and Tim Plunkett presented at Austria? I.e., this core idea and this implementation issue?

DamienMcKenna’s picture

Panelizer doesn't support Paragraphs right now, it'd just take a plugin that shouldn't take too much code. The plugin could be added to either module.

johnchque’s picture

Any chance we can get a patch for a Panelizer plugin?

DamienMcKenna’s picture

I threw together a WIP in #2913418: Support Paragraphs that's guaranteed to not work yet ;-)