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

Only group collections in CP after 5 #1640

Closed
sebszocinski opened this Issue Nov 1, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@sebszocinski

sebszocinski commented Nov 1, 2017

Not sure if this has already been asked or not, but I feel like collections should only group under a Collections menu tab if there is say 5 or more... less then that I feel it should show all of them in the top level like it does if there is only 1.

Can this at least be an option so we can choose? So many clients forget the term Collections and keep asking me "Where are the in the CP?" or "How do I edit " etc and can never find it.

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Nov 1, 2017

I don't think we'll implement this, however, you could do it with an addon. I've added a method in 2.7.2 that'll let you remove an existing item.

https://docs.statamic.com/addons/control-panel

You could listen for when the nav is created, then modify it.
Remove the existing collections item group, and add your own.

Something like this:

class CollectionWangjanglerListener extends Listener
{
    public $events = [
        'cp.nav.created' => 'wangjangle'
    ];

    public function wangjangle($nav)
    {
        $nav->remove('content.collections'); // this method is available from 2.7.2

        $nav->addTo('content', function ($item) {
            $item->add(Nav::item('Blog')->route('entries.show', 'blog')->icon('book'));
            $item->add(Nav::item('Events')->route('entries.show', 'events')->icon('calendar'));
        });
    }
}

image

@jasonvarga jasonvarga closed this Nov 1, 2017

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