Skip to content

Allow hiding action buttons while maintaining DefaultRowAction functionality #7511

@eminjk

Description

@eminjk

Short description of what this feature will allow to do:
Currently, to use an action as a setDefaultRowAction(), that action must be present (and visible) on the Index page. If a developer wants the "click-to-edit" behavior without actually showing an "Edit" button in the actions column, they must currently use CSS (like d-none) to hide the button. This feature would introduce a built-in PHP method (e.g., displayAsHidden()) that renders the action's metadata/URL for JavaScript functionality but prevents it from being rendered as a visible button or link in the UI.

Example of how to use this feature
This would allow for a clean "click-only" interface without manually injecting CSS or overriding templates:

public function configureCrud(Crud $crud): Crud
{
   return $crud->setDefaultRowAction(Action::EDIT);
}

public function configureActions(Actions $actions): Actions
{
    // Create an action that exists but isn't visible as a button
    $editHidden = Action::new(Action::EDIT)
        ->displayAsHidden(); // Proposed method

    return $actions
        ->add(Crud::PAGE_INDEX, $editHidden);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions