/** * Process node online. * * @param string $locale * @param Messages $messages * @param NodeInterface $node * * @return bool */ public function process($locale, Messages $messages, NodeInterface $node) { if (null === ($nodeTranslation = $node->getTranslation($locale))) { $messages->addError($this->translator->trans('node_translation_not_found', array('%locale%' => $locale), 'TadckaSitemapBundle')); return false; } $constraints = array(new NodeRouteNotEmpty(), new NodeParentIsOnline()); $violation = $this->validator->validateValue($nodeTranslation, $constraints); if (0 < $violation->count()) { foreach ($violation as $value) { $messages->addError($value->getMessage()); } return false; } if (null !== ($route = $nodeTranslation->getRoute())) { if ($route->isVisible()) { $this->visibilityManager->setInvisible($locale, $node); } else { $this->visibilityManager->setVisible($locale, $node); } } return true; }