GrafiteInc / CMS

Decoupled CMS for any Laravel app, gain control of: pages, blogs, galleries, events, images, custom modules and more.
https://cms.grafite.ca
MIT License
495 stars 104 forks source link

Custom menu with custom view #147

Closed REPTILEHAUS closed 6 years ago

REPTILEHAUS commented 6 years ago

Im integrating into an existing site - i have the default theme and im trying to add a new file for partials/footer-menu.blade.php and calling it with the menu helper for an optional view@menu('footer-1', 'cms-frontend::partials.footer-menu') but the optional view doesnt appear to be used, instead i get tags output with no other html.

using @theme('partials.footer-menu') gives me undefined variable links

any ideas ?

REPTILEHAUS commented 6 years ago

Found the culprit, see comment below, tried to submit a PR but had issues

        if (!is_null($view)) {
            $response = view($view, ['links' => $links, 'linksAsHtml' => $response, 'processed_links' => $processedLinks]);
        }

        if (Gate::allows('cms', Auth::user())) {
           //  $response = implode($processedLinks); this guy is overriding the template response
            $response .= '<a href="'.url(config('cms.backend-route-prefix', 'cms').'/menus/'.$menu->id.'/edit').'" class="btn btn-sm ml-2 btn-outline-secondary"><span class="fa fa-edit"></span> Edit</a>';
        }

        return $response;
Barrykilby commented 6 years ago

I'm seeing something I think is similar - when a user is not logged in the 'cms-frontend::partials.footer-menu' is applied but when they login it is not to the custom formatting is lost.

I have tried playing about with what you have posted above but i'm not sure if my issues are different as i'm not seeing any change.

REPTILEHAUS commented 6 years ago

Yeah I noticed that too.. when logged in it shows unformatted links and when logged out it shows them correctly.. my edit above fixes that

mlantz commented 6 years ago

Will review and issue a release tonight with fix, thanks

REPTILEHAUS commented 6 years ago

Savage. cheers man, great CMS solution btw

Barrykilby commented 6 years ago

Thank you that would be most appreciated.

mlantz commented 6 years ago

I'm going to close this cause I'm pretty sure its all fixed in latest release. Feel free to open a new one if its still causing issues.