Problem/Motivation

See #3281151: Remove extra margin on 'add paragraph' button on claro, the class is added to the button element, if modules like paragraphs are doing something arguably weird, button might not actually be a button.

It would IMHO be better if \Drupal\Core\Field\WidgetBase::formMultipleElements() would already set that button class instead of claro adding it itself, then other themes don't have to duplicate that.

Possible problems:

* Is it an API change to move a class like that? Nothing will change for any widget that does not replace the button, but for widgets that do, it will change back to a large button.

Steps to reproduce

Proposed resolution

Remaining tasks

* Create the patch to move that class from claro_preprocess_field_multiple_value_form() to the widget

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3292488

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

Berdir created an issue. See original summary.

berdir’s picture

Issue summary: View changes
romina_ferrario’s picture

move class button-small from claro_preprocess_field_multiple_value_form() to the widget

claro seven
before moving class screenshot of claro before screenshot of seven before
after moving class screenshot of claro after screenshot of seven after
rymcveigh’s picture

Just noting that the patch supplied in #3 will not apply when I attempt to apply it to Drupal version 9.4.5 via composer.

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.

gaurav-mathur’s picture

Assigned: Unassigned » gaurav-mathur
gaurav-mathur’s picture

Assigned: gaurav-mathur » Unassigned
StatusFileSize
new4.94 KB
new6.41 KB

I apply patch #3 and it is work fine in claro.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

This looks like a good change and not breaking anything.

Also verified still applies to 10.1.x also.

Status: Reviewed & tested by the community » Needs work
smustgrave’s picture

Status: Needs work » Reviewed & tested by the community

Moving back as appears to be random failure for 9.5

Status: Reviewed & tested by the community » Needs work

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.

berdir’s picture

Status: Needs work » Reviewed & tested by the community

Random test fail again I think.

lauriii’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/lib/Drupal/Core/Field/WidgetBase.php
@@ -262,7 +262,7 @@ protected function formMultipleElements(FieldItemListInterface $items, array &$f
+          '#attributes' => ['class' => ['field-add-more-submit', 'button--small']],

I think we could use the #button_type render array key instead. With that this would be just a render array change which is acceptable in a minor.

_utsavsharma’s picture

StatusFileSize
new763 bytes
new1.19 KB

Tried to address the pointer in #14.

Prashant.c made their first commit to this issue’s fork.

prashant.c’s picture

Status: Needs work » Needs review
Issue tags: +ClaroContributionDay2023

Added '#button_type' => 'small' , kept the attributes

'#attributes' => ['class' => ['field-add-more-submit']], 

Raised a MR, changes needs to be reviewed.

Thanks!

smustgrave’s picture

Status: Needs review » Needs work

Seems the change at line 281 is out of scope. And issue summary mentions screenshots of a multi value widget which should be added to the user interface section of the summary

berdir’s picture

There is no change in core *if* you use Claro, we just move the class. Other themes that currently don't override it like that might change though. I suppose we could compare the backend with another theme, but not even sure which one?

primsi’s picture

StatusFileSize
new1.5 KB

Patch for composer projects.

berdir’s picture

Issue summary: View changes
Status: Needs work » Needs review

Removing seven as I think that's no longer a concern. Gin extends from claro, so it inherits this, so nothing should change there either.

smustgrave’s picture

Hiding old patches.

Tested by adding an unlimited text field to a random content type. The "Add another item" button remained unchanged by the MR so no regression.

nod_ made their first commit to this issue’s fork.

  • nod_ committed abcb2029 on 11.x
    Issue #3292488 by berdir, prashant.c, romina_ferrario, _utsavsharma,...
nod_’s picture

Status: Reviewed & tested by the community » Fixed

Committed abcb202 and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

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