Problem/Motivation

There should be validation to set minimum and maximum value for the "Maximum number of bundle sub-menus to display" field.

Steps to reproduce

  1. Enable the module "Admin Toolbar Extra Tools"
  2. Go to "/admin/config/user-interface/admin-toolbar-tools"
  3. In the "Maximum number of bundle sub-menus to display" try to enter like 9000, 10000 or -5, -10 and save the form. Currently all values are accepted.

Proposed resolution

Add #min and #max properties to the field "max_bundle_number" in "admin_toolbar/admin_toolbar_tools/src/Form/AdminToolbarToolsSettingsForm.php"

Remaining tasks

Code changes and decision about value for #max.

User interface changes

NA

API changes

NA

Data model changes

NA

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

Prashant.c created an issue. See original summary.

sidharth_soman’s picture

StatusFileSize
new724 bytes

I don't really think there's a need to include the '#max' property since there is already a warning about performance issues given a large number of sub-menus.

For now, here's a patch with max=500 and min=1.

prashant.c’s picture

Status: Active » Needs review

sandeep_k’s picture

StatusFileSize
new90.99 KB
new84.64 KB
new62.89 KB
new101.1 KB

Verified and tested patch f3408119.patch on Drupal version- 9.5.11-dev. The patch was applied successfully and looks good to me.

Testing Steps:

  • Enable the module "Admin Toolbar Extra Tools"
  • Go to> admin/config/user-interface/admin-toolbar-tools- Shared before results.
  • Download the shared patch and Apply.
  • Reverify this issue on admin/config/user-interface/admin-toolbar-tools.

Testing Results:
f3408119.patch was applied successfully & validations are added now for min (1)and max (500) values.

Moving this ticket to RTBC.

sandeep_k’s picture

Status: Needs review » Reviewed & tested by the community

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

adriancid’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

justcaldwell’s picture

Just noting that this change broke prior functionality with little/no notice. In the past a value of zero resulted in creating links for all entities with no need to designate a max number.

In our case, the previous value of '0' was forced to '1' so all but the first of each bundle link disappeared unexpectedly. At a minimum, seems like there should have been an update that set 'invalid' values to the module default of 20.