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

Remove admin\base\Module menu builder methods and replace with AdminMenuBuilder class #1045

Closed
nadar opened this issue Oct 24, 2016 · 1 comment
Assignees
Milestone

Comments

@nadar
Copy link
Contributor

nadar commented Oct 24, 2016

In order to make the admin menu build process more flexible an AdminMenuBuilder class should replace the protected methods (node, group, itemApi , etc.) inside the admin base module class.

Therfore the bootstrap process has been changed in order to run only in admin context.

@nadar nadar added this to the 1.0.0-rc2 milestone Oct 24, 2016
@nadar nadar self-assigned this Oct 24, 2016
nadar added a commit that referenced this issue Oct 24, 2016
`luya\admin\components\AdminMenuBuilder` object instead of an array. A
deprecated message is triggered when using the old menu builder
functions. #1045
@nadar
Copy link
Contributor Author

nadar commented Oct 24, 2016

Upgrade info inside of the admin modules getMenu() function:

Change this:

 public function getMenu()
    {
        return $this
            ->nodeRoute('menu_node_cms', 'content_copy', 'cmsadmin-default-index', 'cmsadmin/default/index', 'luya\cms\models\NavItem')
            ->node('menu_node_cmssettings', 'settings')
                ->group('menu_group_env')
                    ->itemRoute('menu_group_item_env_permission', "cmsadmin/permission/index", 'gavel')
                    ->itemApi('menu_group_item_env_container', 'cmsadmin-navcontainer-index', 'label_outline', 'api-cms-navcontainer')
                    ->itemApi('menu_group_item_env_layouts', 'cmsadmin-layout-index', 'view_quilt', 'api-cms-layout')
                ->group('menu_group_elements')
                    ->itemApi('menu_group_item_elements_group', 'cmsadmin-blockgroup-index', 'view_module', 'api-cms-blockgroup')
                    ->itemApi('menu_group_item_elements_blocks', 'cmsadmin-block-index', 'format_align_left', 'api-cms-block')
            ->menu();
    }

To:

public function getMenu()
    {
        return (new AdminMenuBuilder($this))
            ->nodeRoute('menu_node_cms', 'content_copy', 'cmsadmin-default-index', 'cmsadmin/default/index', 'luya\cms\models\NavItem')
            ->node('menu_node_cmssettings', 'settings')
                ->group('menu_group_env')
                    ->itemRoute('menu_group_item_env_permission', "cmsadmin/permission/index", 'gavel')
                    ->itemApi('menu_group_item_env_container', 'cmsadmin-navcontainer-index', 'label_outline', 'api-cms-navcontainer')
                    ->itemApi('menu_group_item_env_layouts', 'cmsadmin-layout-index', 'view_quilt', 'api-cms-layout')
                ->group('menu_group_elements')
                    ->itemApi('menu_group_item_elements_group', 'cmsadmin-blockgroup-index', 'view_module', 'api-cms-blockgroup')
                    ->itemApi('menu_group_item_elements_blocks', 'cmsadmin-block-index', 'format_align_left', 'api-cms-block');
    }

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

1 participant