Ejemplo n.º 1
0
 /**
  * Override URL rewrite data, basing on current CMS page
  *
  * @param \Magento\UrlRewrite\Model\UrlRewrite $model
  * @return void
  */
 private function _handleCmsPageUrlRewrite($model)
 {
     $cmsPage = $this->_getCmsPage();
     if ($cmsPage->getId()) {
         if ($model->isObjectNew()) {
             $model->setEntityType(self::ENTITY_TYPE_CMS_PAGE)->setEntityId($cmsPage->getId());
         }
         if ($model->getRedirectType() && !$model->getIsAutogenerated()) {
             $targetPath = $this->cmsPageUrlPathGenerator->getUrlPath($cmsPage);
         } else {
             $targetPath = $this->cmsPageUrlPathGenerator->getCanonicalUrlPath($cmsPage);
         }
         $model->setTargetPath($targetPath);
     }
 }