Problem/Motivation

Some layout plugins choose to provide configuration forms.
Those are form_alter-able by custom code.

However, if a layout plugin does not provide its own form, custom code can't do anything about it without swapping out the plugin class itself.

Proposed resolution

This is what PluginWithFormsInterface is for!

Add that to LayoutDefault (the 99.9% use case) and it will allow custom code to alter the layout definition to provide a form for them, without messing with their plugin class.

Remaining tasks

Write tests

User interface changes

API changes

None. LayoutInterface is not changed here (ideally we'd be able to, but erring on the side of no API addition)

Data model changes

Release notes snippet

Issue fork drupal-3043879

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

tim.plunkett created an issue. See original summary.

tim.plunkett’s picture

Status: Active » Needs review
StatusFileSize
new6.16 KB

Untested patch

bkosborne’s picture

+1 to this.

This lowers the barrier for a contrib module that wants to allow adding a CSS class to any layouts used on a site, without also defining the layout plugin class.

tim.plunkett’s picture

PluginWithFormsTrait needs to respect PluginDefinitionInterface (instead of assuming an array)

Status: Needs review » Needs work

The last submitted patch, 2: 3043879-layoutform-2.patch, failed testing. View results

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new6.13 KB
new1.46 KB

Still needs tests, but here's the fix for above

tim.plunkett’s picture

Issue tags: +sprint
tim.plunkett’s picture

Status: Needs review » Needs work

NW for the tests

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

rromore’s picture

StatusFileSize
new5.88 KB

#6 no longer applies, I'm guessing because of commit 3003cc65 for issue #3073872. Adding updated patch.

rromore’s picture

StatusFileSize
new5.88 KB

Looks like I accidentally left an extraneous '!' which was causing the section config form link not to appear.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

tim.plunkett’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new4.25 KB
new10.13 KB

Added a test. The FAIL patch is equivalent to an interdiff

Status: Needs review » Needs work

The last submitted patch, 13: 3043879-layoutform-13-PASS.patch, failed testing. View results

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new8.54 KB
new15 KB
new10.71 KB

Discussed more with @bkosborne and he helped clarify how to test this.

In order to allow custom code to affect all layout plugins, this requires a change to LayoutInterface. This has a 1:1 mapping to LayoutDefault, and there is a trait available. Added full test coverage for this too.

The last submitted patch, 15: 3043879-layoutform-15-FAIL.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 15: 3043879-layoutform-15-PASS.patch, failed testing. View results

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new15.05 KB
new966 bytes

Needs to check if the one plugin we don't control exists

bkosborne’s picture

Thank you for your work on this. I have a very busy week coming up, but I added this to my TODO list to test if this will work well with the layout builder styles module after this week is over.

tim.plunkett’s picture

StatusFileSize
new15.01 KB

Minor reroll for some use statement conflicts after #3143635: Change Layout Preparation into an Event to allow proper alterations.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

jurgenhaas’s picture

StatusFileSize
new14.96 KB

Minor reroll for the test module.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

jurgenhaas’s picture

StatusFileSize
new15.07 KB

Minor re-roll for 9.2.x

jurgenhaas’s picture

StatusFileSize
new15.25 KB

Another re-roll as I missed one broken junk.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

tim.plunkett’s picture

Rebased and switched to using an MR

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new150 bytes

The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

jurgenhaas’s picture

StatusFileSize
new10.42 KB
new7.88 KB

The MR doesn't apply for 11.x or 10.3.x so I did a re-roll. Uploading as a patch since I'm not sure if we want to create a new MR for this or if we change the existing MR to target 11.x

jurgenhaas’s picture

StatusFileSize
new8.91 KB
new2.31 KB

Re-rolled again by removing some tests that conflicted with upstream changes.

jurgenhaas’s picture

StatusFileSize
new8.95 KB
new1.57 KB

Another re-roll.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.