/** * Append the CMS page viewed identifier and title to the list of tracked variables * * @return array */ public function getVariables() { $variables = []; if ($this->page->getId()) { $variables['cms.identifier'] = $this->page->getIdentifier(); $variables['cms.title'] = $this->page->getTitle(); } return $variables; }
/** * Generate CMS page url key based on url_key entered by merchant or page title * * @param \Magento\Cms\Model\Page $cmsPage * @return string */ public function generateUrlKey($cmsPage) { $urlKey = $cmsPage->getIdentifier(); return $this->filterManager->translitUrl($urlKey === '' || $urlKey === null ? $cmsPage->getTitle() : $urlKey); }
/** * Prepare breadcrumbs * * @param \Magento\Cms\Model\Page $page * @throws \Magento\Framework\Exception\LocalizedException * @return void */ protected function _addBreadcrumbs(\Magento\Cms\Model\Page $page) { if ($this->_scopeConfig->getValue('web/default/show_cms_breadcrumbs', ScopeInterface::SCOPE_STORE) && ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) && $page->getIdentifier() !== $this->_scopeConfig->getValue('web/default/cms_home_page', ScopeInterface::SCOPE_STORE) && $page->getIdentifier() !== $this->_scopeConfig->getValue('web/default/cms_no_route', ScopeInterface::SCOPE_STORE)) { $breadcrumbsBlock->addCrumb('home', ['label' => __('Home'), 'title' => __('Go to Home Page'), 'link' => $this->_storeManager->getStore()->getBaseUrl()]); $breadcrumbsBlock->addCrumb('cms_page', ['label' => $page->getTitle(), 'title' => $page->getTitle()]); } }
/** * @return \Magento\Framework\Phrase|string */ protected function getTitle() { return $this->pageMock->getId() ? $this->pageMock->getTitle() : __('New Page'); }