Problem/Motivation

#3302583: Allow config actions to be addressed via a shorthand alias added the ability to use shorthand notation for config actions to reduce the noise in things that leverage the Config Actions API - see #3292285: Add the ability to define configuration actions in recipes.

I would be handy if the excellent PluginNotFoundException was augmented to include details about the shortand action IDs that are available if the config is a config entity and has shorthand actions.

Proposed resolution

Catch PluginNotFoundException and augment them somehow.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork drupal-3302833

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:

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

alexpott created an issue. See original summary.

thejimbirch’s picture

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

akhil babu made their first commit to this issue’s fork.

akhil babu changed the visibility of the branch 3302833-imporve-exception to hidden.

akhil babu’s picture

Status: Active » Needs work

I tried to create an MR for this, but I am not able to rebase it properly

akhil babu changed the visibility of the branch 11.x to hidden.

akhil babu changed the visibility of the branch 11.x-1 to hidden.

akhil babu changed the visibility of the branch 3302833-imporve-exception-2 to hidden.

akhil babu’s picture

StatusFileSize
new3.36 KB

These are the changes
https://www.drupal.org/files/issues/2024-08-14/Screenshot%20from%202024-08-14%2018-56-14_1.png

akhil babu’s picture

StatusFileSize
new27.45 KB

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

b_sharpe changed the visibility of the branch 3302833-imporve-exception-3 to hidden.

b_sharpe changed the visibility of the branch 3302833-improve-pluginnotfound-exception to hidden.

b_sharpe’s picture

Status: Needs work » Needs review
prashant.c’s picture

Status: Needs review » Needs work

There are still a lot of conflicts that need rebase. Can we create a new branch and add changes to that?

b_sharpe’s picture

Status: Needs work » Needs review

@Prashant.c where are the conflicts? The fork is 1 commit ahead of upstream... Please provide more details.

prashant.c’s picture

@b_sharpe

Yes, I was checking on Drupal core 11.x, now checked on the recipes project code itself and it is up-to-date, no rebase needed.

The changes look good to me. Thanks

alexpott’s picture

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

It'd be great if this had test coverage. Also I think this issue can be made against drupal/core and not the recipes initiative as the code is in core.

akhil babu’s picture

Status: Needs work » Needs review

Added the tests.

Also I think this issue can be made against drupal/core and not the recipes initiative as the code is in core.

Not sure how to do it. Create a new issue against Drupal core and close this one?

thejimbirch’s picture

Project: Recipes Initiative » Drupal core
Component: Code » configuration entity system
Issue tags: +Recipes initiative

I am changing the issue to be against core.

I believe you will just need to open a new MR targeting core, not the recipes project.

akhil babu changed the visibility of the branch 3302833-PluginNotFound to hidden.

akhil babu’s picture

Thanks @thejimbirch. I have opened a new MR against core

akhil babu’s picture

Updated the test to validate the config action names.

smustgrave’s picture

Status: Needs review » Needs work

Left a small comment on the MR.

akhil babu’s picture

Thanks @smustgrave. Alexpott added a comment in the MR to add a test to verify the valid config actions. Drupal\Core\Config\Action\ConfigActionManager::getShorthandActionIdsForEntityType gives the list of shorthand actions per entity type, but this method is protected. So @alexpot suggested to hardcode the exception message.
https://drupal.slack.com/archives/C1BMUQ9U6/p1724325139885199

oily’s picture

@akhil babu I believe it is a question of changing the assertion itself. You can still 'hard coding' text in the (new) assertion and follow the advice of @alex pott by not using a Reflection method if you follow #27

oily’s picture

Status: Needs work » Needs review

smustgrave changed the visibility of the branch 3302833-improve-pluginnotfound-exception to hidden.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests +Needs Review Queue Initiative

Hiding 9274

The MRs were relatively the same but 9274 was checking the current config action list at this point in time. 9411 checks the start of the exception without verifying the full list. The test was meant to just test the exception.

But believe feedback has been addressed.

The one failed test run seems unrelated https://git.drupalcode.org/issue/drupal-3302833/-/pipelines/273490

 Line   core/tests/Drupal/Tests/Core/Update/UpdateRegistryTest.php              
 ------ ------------------------------------------------------------------------ 
  244    Path in include_once()                                                  
         "vfs://drupal/sites/default/modules/module_a/module_a.post_update.php"  
         is not a file or it does not exist.                                     
  245    Path in include_once()                                                  
         "vfs://drupal/sites/default/modules/module_b/module_b.post_update.php"  
         is not a file or it does not exist.         
alexpott’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Reviewed & tested by the community » Fixed

Backported to 10.3.x as this is helpful.

Committed e9461d7 and pushed to 11.x. Thanks!
Committed and pushed e573df5fd0 to 11.0.x and 7bf317d4c4 to 10.4.x and 5fe48edb3b to 10.3.x. Thanks!

  • alexpott committed 5fe48edb on 10.3.x
    Issue #3302833 by akhil babu, b_sharpe, alexpott, oily, smustgrave:...

  • alexpott committed 7bf317d4 on 10.4.x
    Issue #3302833 by akhil babu, b_sharpe, alexpott, oily, smustgrave:...

  • alexpott committed e573df5f on 11.0.x
    Issue #3302833 by akhil babu, b_sharpe, alexpott, oily, smustgrave:...

  • alexpott committed 43e738a6 on 11.x
    Issue #3302833 by akhil babu, b_sharpe, alexpott, oily, smustgrave:...

Status: Fixed » Closed (fixed)

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