Skip to content

Latest commit

 

History

History
83 lines (71 loc) · 1.91 KB

4.1.md

File metadata and controls

83 lines (71 loc) · 1.91 KB

Upgrading from 4.0 to 4.1

Menu syntax was updated

In Sharp 4.0, it was allowed to declare the entity key, for menus, like this:

    "menu" => [
        [
            "label" => "Equipment",
            "entities" => [
                "spaceship" => [
                    "label" => "Spaceships",
                    "icon" => "fa-space-shuttle"
                ]
            ]
        ]
    ]

The key => value array syntax is now forbidden, for consistency. The right way is:

    "menu" => [
        [
            "label" => "Equipment",
            "entities" => [
                [
                    "entity" => "spaceship",  // notice the change here
                    "label" => "Spaceships",
                    "icon" => "fa-space-shuttle"
                ]
            ]
        ]
    ]

Notice there is now a dedicated doc section for menus.

Dashboards were generalized

The "only one Dashboard" limitation is gone, bringing more control and features (policies). As a consequence, if you previously declared a Dashboard, you'll need to adapt your configuration in sharp.php, as documented here, going from this:

    return [
        "entities" => [
            [...]
        ],
        "dashboard" => \App\Sharp\Dashboard::class
    ];

to this:

    return [
        "entities" => [
            [...]
        ],
        "dashboards" => [
            "dashboard" => [
                "view" => \App\Sharp\Dashboard::class
            ]
        ],
        [...]
        "menu" => [
            [
                "label" => "Company",
                "entities" => [
                    [
                        "label" => "My Dashboard",
                        "icon" => "fa-dashboard",
                        "dashboard" => "dashboard"
                    ],
                    [...]
                ]
            ]
        ]
    ];