Problem/Motivation

When placing a paragraph block via the block ui or the layout builder will always result in the default display mode being shown. There is no way to configure that. But there are use casings to display the same paragraph type with different display modes.

Proposed resolution

  • The block configuration should have a setting for "display mode" where you can select any of the available modes for that paragraph type.
  • You should also be able to set a default display mode in the paragraph's parent entity configuration. So the current "set and forget" behaviour can be retained.
  • Current paragraph blocks saved without this configuration should still work. (migration? or just set "default" to all current paragraph blocks in an update hook?)
  • \Drupal\paragraph_blocks\Plugin\Block\ParagraphBlock::build() has a line that builds the output setting default as display mode: $build = $view_builder->view($paragraph, 'default');. This needs to be replaced.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

basvredeling created an issue. See original summary.

basvredeling’s picture

Assigned: Unassigned » basvredeling

basvredeling’s picture

Status: Active » Needs review
tim_dj’s picture

@basvredeling MR seems to work properly. I've put a few comments in the MR

tim_dj’s picture

Status: Needs review » Reviewed & tested by the community

Looking good and working fine here

  • basvredeling committed 202d7a25 on 4.x
    Issue #3452722 by basvredeling, tim_dj: Provide paragraph display mode...
basvredeling’s picture

Status: Reviewed & tested by the community » Fixed
basvredeling’s picture

Status: Fixed » Closed (fixed)

part of 4.1.0 release