示例#1
0
 /**
  * Create node translation seo metadata.
  *
  * @param NodeTranslationInterface $translation
  *
  * @return SeoMetadataInterface
  */
 public function create(NodeTranslationInterface $translation)
 {
     $seoMetadata = $this->seoMetadataManager->create();
     $seoMetadata->setLang($translation->getLang());
     $seoMetadata->setTitle($translation->getTitle());
     $this->seoMetadataManager->add($seoMetadata);
     return $seoMetadata;
 }
示例#2
0
 /**
  * On delete sitemap node.
  *
  * @param NodeInterface $node
  */
 public function onDeleteNode(NodeInterface $node)
 {
     foreach ($node->getTranslations() as $translation) {
         if (null !== ($route = $translation->getRoute())) {
             $this->deleteNodeRoute($node, $route);
         }
         if (null !== ($seoMetadata = $translation->getSeoMetadata())) {
             $this->seoMetadataManager->remove($seoMetadata);
         }
     }
 }
 /**
  * On success.
  *
  * @param string $locale
  * @param NodeInterface $node
  *
  * @return string
  */
 public function onSuccess($locale, NodeInterface $node)
 {
     $this->eventDispatcher->dispatch(TadckaTreeEvents::NODE_EDIT_SUCCESS, new TreeNodeEvent($locale, $node));
     $this->seoMetadataManager->save();
     return $this->translator->trans('success.node_seo_save', array(), 'TadckaSitemapBundle');
 }