/** * Generate permanent rewrites based on current rewrites * * @param int $storeId * @return array */ protected function generateRewritesBasedOnCurrentRewrites($storeId) { $urls = []; foreach ($this->urlMatcher->findAllByFilter($this->createCurrentUrlRewritesFilter($storeId)) as $url) { $targetPath = null; if ($url->getRedirectType()) { $targetPath = str_replace($this->category->getOrigData('url_key'), $this->category->getData('url_key'), $url->getTargetPath()); $redirectType = $url->getRedirectType(); } elseif ($this->category->getData('save_rewrites_history')) { $targetPath = str_replace($this->category->getOrigData('url_key'), $this->category->getData('url_key'), $url->getRequestPath()); $redirectType = OptionProvider::PERMANENT; } if ($targetPath && $url->getRequestPath() != $targetPath) { $urls[] = $this->createUrlRewrite($storeId, $url->getRequestPath(), $targetPath, $redirectType); } } return $urls; }
/** * {@inheritdoc} */ public function getOrigData($key = null) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getOrigData'); if (!$pluginInfo) { return parent::getOrigData($key); } else { return $this->___callPlugins('getOrigData', func_get_args(), $pluginInfo); } }