Problem/Motivation

Hello,
I need to delete multiple aliases that i can filter in a custom view.
Deleting them one by one is tedious. The delete action would be nice to have as a bulk operation.

Proposed resolution

Add a new action and make it available in custom views.

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

olivier.br created an issue. See original summary.

joachim’s picture

You've done something wrong with your branches -- the MR shows no changes.

I'm really not sure about this feature. I can see it would be very useful. But I don't feel it belongs in this module, whose focus is quite tight.

However, core or another path alias module would have no reason to add this, since there's no Views support for path aliases anywhere else, and Views bulk operations is the main place that actions are used.

I'm going to ponder it.

olivier.br’s picture

olivier.br’s picture

Status: Active » Needs review
justcaldwell’s picture

+1 to this feature.

I'm not sure, but it seems like DeletePathAliasAction might be necessary. DeleteAction acts on the target content, DeletePathAliasAction acts on the selected alias.

Or maybe you're asking if DeletePathAliasAction can just extend DeleteAction instead of EntityActionBase?

joachim’s picture

Status: Needs review » Needs work

Can we just use DeleteAction as it is?

justcaldwell’s picture

I don't think so.

As it stands, DeleteAction is already available via the bulk node actions form and it deletes selected target content, not the alias. I think a separate plugin is necessary to specifically act on path_alias entities.

joachim’s picture

> As it stands, DeleteAction is already available via the bulk node actions form and it deletes selected target content, not the alias. I think a separate plugin is necessary to specifically act on path_alias entities.

Yes, because it's the core/modules/node/config/install/system.action.node_delete_action.yml config entity.

We'd have config/install/system.action.path_alias_delete_action.yml, but it can use the DeleteAction class because that works with an entity type.

We need this code to fire for path_alias entities:

  protected function isApplicable(EntityTypeInterface $entity_type) {
    return $entity_type->hasLinkTemplate('delete-multiple-form');
  }
justcaldwell’s picture

Of course! 🤦🏻‍♂️

I'll try to update the MR early next week. Thanks for your patience.

justcaldwell’s picture

I took a pass at using DeleteAction as-is. Adding config/install/system.action.path_alias_delete_action.yml alone is not enough.

Per Claude, core only creates delete_action derivatives for entities that define a delete-multiple-form link template and delete-multiple-confirm handler form — path_alias does neither, so the derivative entity:delete_action:path_alias does not exist.

From what I can tell, the options are:

  1. Alter the path_alias entity to define the link template and handler, as well as an associated route, OR
  2. Create a custom DeletePathAliasAction plugin, which brings us full circle.