Ejemplo n.º 1
0
 /**
  * Set the API breadcrumbs to the view
  * @param zibo\library\smarty\view\SmartyView $view
  * @param string $namespace current namespace
  * @param string $class current class
  * @return null
  */
 private function setBreadcrumbsToView(SmartyView $view, $namespace = null, $class = null)
 {
     $translator = $this->getTranslator();
     $breadcrumbs = new Breadcrumbs();
     $breadcrumbs->setId('breadcrumbs');
     $breadcrumbs->setLabel($translator->translate(self::TRANSLATION_NAVIGATION));
     $breadcrumbs->addBreadcrumb($this->request->getBasePath(), $translator->translate(self::TRANSLATION_NAVIGATION_HOME));
     $view->set('breadcrumbs', $breadcrumbs);
     if (empty($namespace)) {
         return;
     }
     $tokens = explode(ApiBrowser::NAMESPACE_SEPARATOR, $namespace);
     $namespace = null;
     foreach ($tokens as $token) {
         $namespace = $namespace . $token . ApiBrowser::NAMESPACE_SEPARATOR;
         $breadcrumbs->addBreadcrumb($this->namespaceAction . $namespace, $token);
     }
     if ($class) {
         $breadcrumbs->addBreadcrumb($this->classAction . $namespace . $class, $class);
     }
 }