Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field action menus #16415

Merged
merged 2 commits into from
Jan 10, 2025
Merged

Field action menus #16415

merged 2 commits into from
Jan 10, 2025

Conversation

brandonkelly
Copy link
Member

Description

Adds action menus to custom fields within element edit pages, with “Edit field” (if admin changes are allowed) and “Copy field handle” items:

The action menu for a custom field labeled “Featured?”

(Both of these actions require that the current user is an admin, but the underlying support for field action menus is not admin-exclusive.)

Since all fields will now have a “Copy field handle” action, the “Show field handles in edit forms” admin user preference has been removed.

Action menus are populated from an actionMenuItems array within the config passed to craft\helpers\Cp::fieldHtml(). Field layout elements can register items via craft\fieldlayoutelements\BaseField::actionMenuItems(). And custom field types can register additional action items via their getActionMenuItems() method.

@brandonkelly brandonkelly changed the title Field action buttons Field action menus Jan 10, 2025
[ci skip]
@brandonkelly brandonkelly merged commit a7384fb into 5.6 Jan 10, 2025
@brandonkelly brandonkelly deleted the feature/field-action-buttons branch January 10, 2025 18:16
@mmikkel
Copy link
Contributor

mmikkel commented Jan 12, 2025

...I have some mixed feelings about this one 😅

Love to see the "Edit field" action finally added to element edit forms. I think the field actions menu is a good idea, with a lot of potential use cases.

The "Copy Field Handle" action specifically, feels like a step backwards to me though. To simply view a field's handle, devs now have to click twice to open a modal. Copying the handle requires a third click inside the modal, after moving the cursor to the center of the viewport. Compared to the inline field handles we've had for years, that feels kinda cumbersome.

If retaining the inline field handles is off the table, maybe it'd be possible to render the field handle inline in the field actions menu – without requiring additional clicks and that modal? I think that could hit the sweet spot in terms of surfacing the handles in an effective enough way, whilst still helping to streamline this stuff (i.e. "field actions").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants