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

Feature/dev 1165 edit element additional toolbar menu #13847

Merged

Conversation

i-just
Copy link
Contributor

@i-just i-just commented Oct 19, 2023

Description

  • element edit pages now contain an additional menu, which is placed after the save button; most buttons were moved to it;

  • the additional menu also shows in a slideout, but in there, we don’t show any destructive options

  • destructive items are at the end of the list

  • base\Element class has a new getAdditionalMenuComponents() method, which should be used to add items to the additional menu;

  • there’s also EVENT_DEFINE_ADDITIONAL_MENU_COMPONENTS event which can be used to add items to the menu;

    • the exception is the User element where EVENT_REGISTER_USER_ACTIONS is still used;
    • another deviation for the user edit form is that action components should reference data-form="userform" - see UsersController::actionEditUser() for more an example
  • each component should be an array that can consist of:
    'label' => text to show in the a or button tag; can be an empty string
    'tag' => optional; defaults to a; you can use button too and hr if you want to add a visual separator between items
    'data' => optional; data attributes
    'aria' => optional; aria attributes
    'options' => optional; any other attributes, e.g. class

Related issues

dev-1165

@i-just i-just marked this pull request as ready for review October 19, 2023 07:33
…bar-menu

# Conflicts:
#	src/controllers/ElementsController.php
#	src/web/assets/cp/dist/cp.js
#	src/web/assets/cp/dist/cp.js.map
#	src/web/assets/cp/dist/css/cp.css
#	src/web/assets/cp/dist/css/cp.css.map
#	src/web/assets/garnish/dist/garnish.js
#	src/web/assets/garnish/dist/garnish.js.map
…bar-menu

# Conflicts:
#	src/web/assets/cp/dist/cp.js
#	src/web/assets/cp/dist/cp.js.map
@brandonkelly brandonkelly deleted the feature/dev-1165-edit-element-additional-toolbar-menu branch November 19, 2023 19:37
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