- Issue was unassigned.
- Status changed to Needs work
9 months ago 1:01pm 6 August 2024 - πΊπΈUnited States mlncn Minneapolis, MN, USA
Patch does not apply, probably only needs minor re-roll.
I see it disables the action links for form mode manager globally. This is probably a useful option but personally i would go for being able to hide or rename any specific action or operations link generated by Form mode manager, if i were to take this on. But a couple of alter hooks makes that possible too.
In an `example.module` file in your custom Example moduleβ presuming you are not using bundle subclasses for your content, the ProgramApplication parts can be dropped and this will still work:
use Drupal\example\Entity\ProgramApplication; /** * Implements hook_menu_local_actions_alter(). */ function example_menu_local_actions_alter(&$local_actions) { // Remove "Create as" link for the content form mode 'form_mode_edit_only'. unset($local_actions['form_mode_manager.action:node.form_mode_edit_only']); // Shorten "Create content as form_mode" link to "Create form mode". $local_actions['form_mode_manager.action:node.application_forms']['title'] = t("Create application forms"); } /** * Implements hook_entity_operation_alter(). */ function example_entity_operation_alter(&$operations, $entity) { if ($entity instanceof ProgramApplication and isset($operations['application_forms'])) { // Shorten the edit link e.g. it the per-node dropdown on the content admin listing page. $operations['application_forms']['title'] = t("Edit application forms"); } }
- First commit to issue fork.
- π§πͺBelgium tim-diels Belgium π§πͺ
tim-diels β changed the visibility of the branch 3.x to hidden.
- Merge request !21Add ability to hide local actions from admin/content β (Open) created by tim-diels
- π§πͺBelgium tim-diels Belgium π§πͺ
Created MR for 3.x based on the work done above.
@mlncn I like the suggestion you make, but it will take more time and is more complex to get this done. Maybe split that to a new feature request?
Test is failing probably because the cache is not getting cleared properly to hide the link.
But to me this also seems to be incomplete and it should however take care for individual entity types. Now its a global setting but only hiding on the admin/content page. So either have a global setting to hide it everywhere (not a fan of this) or have the setting per entity type.
So I guess this code will need some refactoring to have this as an option for every entity type.