Problem/Motivation
In #3557882: Support "placeholder" dashboard blocks we actually added "placeholder blocks". Its purpose is being used in recipes.
We forgot there to actually restrict that an editor can actually create them, because there's no way we can provide a good UI for those anyway.
Proposed resolution
Restrict them from layout builder and block UI.
Remaining tasks
Fix + tests
User interface changes
No weird blocks show up when placing blocks.
API changes
None.
Data model changes
None.
Issue fork dashboard-3566753
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
Comment #3
penyaskitoComment #4
penyaskito@phenaproxima I'm guessing you have some recipe for adding placeholder blocks for testing. Can you test this, and/or even better, paste a recipe example here?
I want to ensure that they can ONLY be created through a recipe, and not in the UI.
Comment #5
phenaproximaIn a recipe, you would probably add a placeholder block with a config action:
Drupal CMS's Admin UI recipe just embeds them directly: https://git.drupalcode.org/project/drupal_cms/-/blob/2.x/recipes/drupal_...
So to test it, I would just apply the config action programmatically, and skip messing with a recipe at all. Something like:
Similar to how the
addComponentToLayoutaction is tested in core: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/layou...Comment #6
penyaskitoUnrelated, but release blocking:
I'd expect you cannot edit the block. But actually the form works!
However, when you save it you actually lose the block!
Comment #7
phenaproximaThat makes sense. I think what needs to happen is that
buildConfigurationForm()and related methods need to be turned into no-ops. The configuration form should probably just always show a message that says "This is a placeholder block and cannot be edited in the UI."Comment #8
penyaskitoThat was my intent, but Drupal CMS editors would be too confused if some blocks can be edited, and others cannot.
And I actually made this work :D Will open a new MR in the original issue, and leave this for just hiding the block from the UI.
Comment #9
penyaskitoComment #10
penyaskitoPostpone on #3557882: Support "placeholder" dashboard blocks, re-opened.
Comment #11
penyaskito#3557882: Support "placeholder" dashboard blocks followup landed.
Comment #12
penyaskitoComment #14
penyaskitoThanks!
Comment #16
penyaskitoComment #17
penyaskito