Skip to content

setActive($current, $root) working only for Home #28

@jozefrebjak

Description

@jozefrebjak

I can't get working another link to set active, it's working only for home route / for me, but it seems in a code that it's correct.

Here is my menu:

/**
     * Returns the main menu
     *
     * @throws InvalidArgumentException
     * @throws ReflectionException
     * @throws RouterException
     */
    public function __toString(): string
    {
        return $this->builder
            ->html('<li class="menu-title"><span data-key="t-menu">Menu</span></li>')
            ->link(route_to('home'), '<i class="ri-home-4-line"></i> <span data-key="t-landing">Home</span><span class="badge badge-pill bg-danger" data-key="t-new">New</span>')
            ->link(route_to('client-list'), '<i class="ri-user-follow-line"></i> <span data-key="t-landing">Clients</span><span class="badge badge-pill bg-danger" data-key="t-new">New</span>')
            ->render();

It adds active to home route, but no to client-list route witch is http://localhost/clients. I am just extending Menu.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions