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

Add "New Item" shortcut menu #1142

Open
bennothommo opened this issue Jun 6, 2024 · 1 comment
Open

Add "New Item" shortcut menu #1142

bennothommo opened this issue Jun 6, 2024 · 1 comment

Comments

@bennothommo
Copy link
Member

Package targeted

Winter CMS

Description

One of the friction points I've found with the CMS is that if you want to quickly add something, like say a blog post, to the site, it currently requires multiple clicks and page loads to get to where you need to go to add the item. Using the blog posts example, it's a case of clicking the "Blog" main menu item, then clicking "Posts" in the side menu, then clicking the "New post" button on the top of the Posts list (I'm aware there's a "New post" shortcut in the sidebar, but a lot of plugins don't provide that).

A methodology I've seen on other sites is providing shortcuts to quickly create something - for example, on Figma, the buttons to create a new design or new Figjam diagram are immediately available when logged in. To this, I wonder if we provide a "New item" shortcut menu that plugins can hook into to provide shortcuts to quickly add an item that the plugin provides. Here's a mockup of what I'm thinking:

New Menu Mockup

The idea being, we limit the scope of this menu to be simply for "adding" something to the site. Of course, there's no way to enforce this - we just have to trust that plugin developers will respect that scope - but if followed, it would be an easy way for someone to jump straight into creating an item from anywhere within the Backend.

I imagine that such a link (or links) could be created using a method in the Plugin definition file like with navigation items being registered through the registerNavigation method. This could potentially be registerCreateMenuLinks, supporting an array of links with a minimal set of options:

public function registerCreateMenuLinks()
{
    return [
        [
            'title' => 'New Layout',
            'icon' => 'th-large',
            'url' => Backend::url('cms/layouts/new'),
            'rank' => 100,
        ],
        [
            'title' => 'New Page',
            'icon' => 'copy',
            'url' => Backend::url('cms/pages/new'),
            'rank' => 101,
        ],
    ];
}

Links would be grouped together by plugin name in the menu itself, so that it's immediately clear which plugin is providing the link.

Will this change be backwards-compatible?

It will be a new feature, so no backwards compatibility needs to be considered.

@LukeTowers
Copy link
Member

@bennothommo I'm not opposed to this and it was either planned or actually implemented in the Spatial project @jaxwilko and I were working on ages ago. I think API wise it might be best to tie into the QuickAction API in some way.

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

No branches or pull requests

2 participants