Example #1
0
 /**
  * checks if content should be displayed.
  *
  * @param StructureInterface $content
  * @param string|null        $context
  *
  * @return bool
  */
 public function inNavigation(StructureInterface $content, $context = null)
 {
     $contexts = $content->getNavContexts();
     if ($content->getNodeState() !== Structure::STATE_PUBLISHED) {
         // if node state is not published do not show page
         return false;
     }
     if (is_array($contexts) && ($context === null || in_array($context, $contexts))) {
         // all contexts or content has context
         return true;
     }
     // do not show
     return false;
 }