/** * Make the page breadcrumbs. * * @param PageInterface $page */ public function make(PageInterface $page) { $breadcrumbs = [$page->getTitle() => $this->request->path()]; $this->loadParent($page, $breadcrumbs); foreach (array_reverse($breadcrumbs) as $key => $url) { $this->breadcrumbs->add($key, $url); } }
/** * Handle the command. * * @param BreadcrumbCollection $breadcrumbs */ public function handle(BreadcrumbCollection $breadcrumbs) { $disk = $this->folder->getDisk(); $uri = 'admin/files/browser/' . $disk->getSlug(); foreach (explode('/', $this->folder->path()) as $name) { $breadcrumbs->add($name, $uri = $uri . '/' . $name); } }
/** * Handle the event. */ public function handle() { if ($this->request->path() == 'admin/login') { $this->breadcrumbs->add('streams::breadcrumb.login', '#'); } if ($this->request->path() == 'installer/install') { $this->breadcrumbs->add('streams::breadcrumb.install', '#'); } }
/** * Fired when builder is ready to build. * * @param RoleRepositoryInterface $roles * @param BreadcrumbCollection $breadcrumbs * @param MessageBag $messages * @param Redirector $redirect * @return \Illuminate\Http\RedirectResponse */ public function onReady(RoleRepositoryInterface $roles, BreadcrumbCollection $breadcrumbs, MessageBag $messages, Redirector $redirect) { $this->setEntry($role = $roles->find($this->getEntry())); if ($role->getSlug() === 'admin') { $messages->warning('anomaly.module.users::warning.modify_admin_role'); $this->setFormResponse($redirect->to('admin/users/roles')); return; } $breadcrumbs->add($role->getName(), 'admin/users/roles/edit/' . $role->getId()); $breadcrumbs->add('anomaly.module.users::breadcrumb.permissions', 'admin/users/roles/permissions/' . $role->getId()); }
/** * Fired when builder is ready to build. * * @param UserRepositoryInterface $users * @param BreadcrumbCollection $breadcrumbs * @param MessageBag $messages * @param Redirector $redirect * @return \Illuminate\Http\RedirectResponse */ public function onReady(UserRepositoryInterface $users, RoleRepositoryInterface $roles, BreadcrumbCollection $breadcrumbs, MessageBag $messages, Redirector $redirect) { $this->setEntry($user = $users->find($this->getEntry())); if ($user->hasRole($roles->findBySlug('admin'))) { $messages->warning('anomaly.module.users::warning.modify_admin_user'); $this->setFormResponse($redirect->to('admin/users')); return; } $breadcrumbs->add($user->getDisplayName(), 'admin/users/edit/' . $user->getId()); $breadcrumbs->add('anomaly.module.users::breadcrumb.permissions', 'admin/users/permissions/' . $user->getId()); }
/** * Handle the command. * * @param Container $container * @param ViewTemplate $template * @param BreadcrumbCollection $breadcrumbs */ public function handle(Container $container, ViewTemplate $template, BreadcrumbCollection $breadcrumbs) { $tree = $this->builder->getTree(); $tree->addData('tree', $tree); if ($handler = $tree->getOption('data')) { $container->call($handler, compact('tree')); } if ($layout = $tree->getOption('layout_view')) { $template->put('layout', $layout); } if ($title = $tree->getOption('title')) { $template->put('title', $title); } if ($breadcrumb = $tree->getOption('breadcrumb')) { $breadcrumbs->put($breadcrumb, '#'); } }
/** * Handle the command. * * @param Request $request * @param Authorizer $authorizer * @param BreadcrumbCollection $breadcrumbs */ public function handle(Request $request, Authorizer $authorizer, BreadcrumbCollection $breadcrumbs) { $links = $this->builder->getControlPanelNavigation(); /** * If we already have an active link * then we don't need to do this. */ if ($active = $links->active()) { return; } /* @var NavigationLinkInterface $link */ foreach ($links as $link) { /** * Get the HREF for both the active * and loop iteration link. */ $href = array_get($link->getAttributes(), 'data-href', array_get($link->getAttributes(), 'href')); $activeHref = ''; if ($active && $active instanceof NavigationLinkInterface) { $activeHref = array_get($active->getAttributes(), 'data-href', array_get($active->getAttributes(), 'href')); } /** * If the request URL does not even * contain the HREF then skip it. */ if (!str_contains($request->url(), $href)) { continue; } /** * Compare the length of the active HREF * and loop iteration HREF. The longer the * HREF the more detailed and exact it is and * the more likely it is the active HREF and * therefore the active link. */ $hrefLength = strlen($href); $activeHrefLength = strlen($activeHref); if ($hrefLength > $activeHrefLength) { $active = $link; } } // No active link! if (!$active) { return; } // Active navigation link! $active->setActive(true); // Authorize the active link. if (!$authorizer->authorize($active->getPermission())) { abort(403); } // Add the bread crumb. if (($breadcrumb = $active->getBreadcrumb()) !== false) { $breadcrumbs->put($breadcrumb ?: $active->getTitle(), $active->getHref()); } }
/** * Handle the command. * * @param Container $container * @param ViewTemplate $template * @param BreadcrumbCollection $breadcrumbs */ public function handle(Container $container, ViewTemplate $template, BreadcrumbCollection $breadcrumbs) { $form = $this->builder->getForm(); if ($handler = $form->getOption('data')) { $container->call($handler, compact('form')); } if ($layout = $form->getOption('layout_view')) { $template->put('layout', $layout); } if ($title = $form->getOption('title')) { $template->put('title', $title); } // Move this to options so we can read it. $this->builder->setFormOption('read_only', $this->builder->isReadOnly()); $form->addData('form', $form); if ($breadcrumb = $form->getOption('breadcrumb', 'streams::form.mode.' . $this->builder->getFormMode())) { $breadcrumbs->put($breadcrumb, '#'); } }
/** * Handle the command. * * @param BreadcrumbCollection $breadcrumbs */ public function handle(BreadcrumbCollection $breadcrumbs) { $breadcrumbs->add($this->category->getName(), $this->dispatch(new GetCategoryPath($this->category))); }
/** * Handle the command. * * @param Request $request * @param BreadcrumbCollection $breadcrumbs */ public function handle(Request $request, BreadcrumbCollection $breadcrumbs) { $breadcrumbs->add(trans('module::breadcrumb.archive'), $request->fullUrl()); }
/** * Handle the command. * * @param Request $request * @param Authorizer $authorizer * @param BreadcrumbCollection $breadcrumbs */ public function handle(Request $request, Authorizer $authorizer, BreadcrumbCollection $breadcrumbs) { $controlPanel = $this->builder->getControlPanel(); $sections = $controlPanel->getSections(); /* * If we already have an active section * then we don't need to do this. */ if ($active = $sections->active()) { return; } /* @var SectionInterface $section */ foreach ($sections as $section) { if (($matcher = $section->getMatcher()) && str_is($matcher, $request->path())) { $active = $section; } /* * Get the HREF for both the active * and loop iteration section. */ $href = $section->getPermalink() ?: array_get($section->getAttributes(), 'href'); $activeHref = ''; if ($active && $active instanceof SectionInterface) { $activeHref = $active->getPermalink() ?: array_get($active->getAttributes(), 'href'); } /* * If the request URL does not even * contain the HREF then skip it. */ if (!str_contains($request->url(), $href)) { continue; } /* * Compare the length of the active HREF * and loop iteration HREF. The longer the * HREF the more detailed and exact it is and * the more likely it is the active HREF and * therefore the active section. */ $hrefLength = strlen($href); $activeHrefLength = strlen($activeHref); if ($hrefLength > $activeHrefLength) { $active = $section; } } /** * If we have an active section determined * then mark it as such. * * @var SectionInterface $active * @var SectionInterface $section */ if ($active) { if ($active->getParent()) { $active->setActive(true); $section = $sections->get($active->getParent(), $sections->first()); $section->setHighlighted(true); $breadcrumbs->put($section->getBreadcrumb() ?: $section->getTitle(), $section->getHref()); } else { $active->setActive(true)->setHighlighted(true); } } elseif ($active = $sections->first()) { $active->setActive(true)->setHighlighted(true); } // No active section! if (!$active) { return; } // Authorize the active section. if (!$authorizer->authorize($active->getPermission())) { abort(403); } // Add the bread crumb. if (($breadcrumb = $active->getBreadcrumb()) !== false) { $breadcrumbs->put($breadcrumb ?: $active->getTitle(), $active->getHref()); } }
/** * Handle the command. * * @param BreadcrumbCollection $breadcrumbs */ public function handle(BreadcrumbCollection $breadcrumbs) { $breadcrumbs->add($this->disk->getName(), 'admin/files/browser/' . $this->disk->getSlug()); }
/** * Return a form for an existing page type field and assignment. * * @param AssignmentFormBuilder $form * @param StreamRepositoryInterface $streams * @param TypeRepositoryInterface $types * @param BreadcrumbCollection $breadcrumbs * @param $id * @return \Symfony\Component\HttpFoundation\Response */ public function assignment(AssignmentFormBuilder $form, StreamRepositoryInterface $streams, TypeRepositoryInterface $types, BreadcrumbCollection $breadcrumbs, $id, $assignment) { $type = $types->find($id); $breadcrumbs->put('streams::breadcrumb.assignments', 'admin/pages/types/assignments/' . $type->getId()); return $form->render($assignment); }
/** * Handle the command. * * @param Request $request * @param BreadcrumbCollection $breadcrumbs */ public function handle(Request $request, BreadcrumbCollection $breadcrumbs) { $breadcrumbs->add(trans('anomaly.module.posts::breadcrumb.tagged', ['tag' => $this->tag]), $request->fullUrl()); }
/** * Handle the command. * * @param BreadcrumbCollection $breadcrumbs */ public function handle(BreadcrumbCollection $breadcrumbs) { $breadcrumbs->add($this->type->getName(), $this->dispatch(new GetTypePath($this->type))); }
/** * Handle the command. * * @param Request $request * @param BreadcrumbCollection $breadcrumbs */ public function handle(Request $request, BreadcrumbCollection $breadcrumbs) { $breadcrumbs->add($this->post->getTitle(), $request->fullUrl()); }
/** * Handle the command. * * @param SettingRepositoryInterface $settings * @param BreadcrumbCollection $breadcrumbs */ public function handle(SettingRepositoryInterface $settings, BreadcrumbCollection $breadcrumbs) { $breadcrumbs->add('anomaly.module.posts::addon.name', $settings->get('anomaly.module.posts::module_segment', 'posts')); }
/** * Return a form for an existing post type field and assignment. * * @param AssignmentFormBuilder $form * @param TypeRepositoryInterface $types * @param BreadcrumbCollection $breadcrumbs * @param $id * @return \Symfony\Component\HttpFoundation\Response */ public function assignment(AssignmentFormBuilder $form, TypeRepositoryInterface $types, BreadcrumbCollection $breadcrumbs, $id, $assignment) { $type = $types->find($id); $breadcrumbs->put('module::breadcrumb.fields', 'admin/posts/types/fields/' . $type->getId()); return $form->render($assignment); }
/** * Handle the command. * * @param Repository $config * @param BreadcrumbCollection $breadcrumbs */ public function handle(Repository $config, BreadcrumbCollection $breadcrumbs) { $breadcrumbs->add('anomaly.module.posts::breadcrumb.posts', $config->get('anomaly.module.posts::paths.module')); }