本文整理匯總了PHP中Magento\Framework\View\Page\Config::addBodyClass方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::addBodyClass方法的具體用法?PHP Config::addBodyClass怎麽用?PHP Config::addBodyClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\View\Page\Config
的用法示例。
在下文中一共展示了Config::addBodyClass方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addDefaultBodyClasses
/**
* Add default body classes for current page layout
*
* @return $this
*/
protected function addDefaultBodyClasses()
{
$this->pageConfig->addBodyClass($this->request->getFullActionName('-'));
$pageLayout = $this->getPageLayout();
if ($pageLayout) {
$this->pageConfig->addBodyClass('page-layout-' . $pageLayout);
}
return $this;
}
示例2: _prepareLayout
/**
* Prepare global layout
*
* @return $this
*/
protected function _prepareLayout()
{
$page = $this->getPage();
$this->_addBreadcrumbs($page);
$this->pageConfig->addBodyClass('cms-' . $page->getIdentifier());
$this->pageConfig->getTitle()->set($page->getTitle());
$this->pageConfig->setKeywords($page->getMetaKeywords());
$this->pageConfig->setDescription($page->getMetaDescription());
$pageMainTitle = $this->getLayout()->getBlock('page.main.title');
if ($pageMainTitle) {
// Setting empty page title if content heading is absent
$cmsTitle = $page->getContentHeading() ?: ' ';
$pageMainTitle->setPageTitle($this->escapeHtml($cmsTitle));
}
return parent::_prepareLayout();
}
示例3: _prepareLayout
/**
* Prepare global layout
*
* @return $this
*/
protected function _prepareLayout()
{
$page = $this->getPage();
// show breadcrumbs
if ($this->_scopeConfig->getValue('web/default/show_cms_breadcrumbs', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) && ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) && $page->getIdentifier() !== $this->_scopeConfig->getValue('web/default/cms_home_page', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) && $page->getIdentifier() !== $this->_scopeConfig->getValue('web/default/cms_no_route', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) {
$breadcrumbs->addCrumb('home', array('label' => __('Home'), 'title' => __('Go to Home Page'), 'link' => $this->_storeManager->getStore()->getBaseUrl()));
$breadcrumbs->addCrumb('cms_page', array('label' => $page->getTitle(), 'title' => $page->getTitle()));
}
$this->pageConfig->addBodyClass('cms-' . $page->getIdentifier());
$head = $this->getLayout()->getBlock('head');
if ($head) {
$head->setTitle($page->getTitle());
$head->setKeywords($page->getMetaKeywords());
$head->setDescription($page->getMetaDescription());
}
$pageMainTitle = $this->getLayout()->getBlock('page.main.title');
if ($pageMainTitle) {
// Setting empty page title if content heading is absent
$cmsTitle = $page->getContentHeading() ?: ' ';
$pageMainTitle->setPageTitle($this->escapeHtml($cmsTitle));
}
return parent::_prepareLayout();
}
示例4: execute
/**
* @return \Magento\Framework\View\Result\Page
*/
public function execute()
{
$this->pageConfig->addBodyClass('swagger-section');
return $this->pageFactory->create();
}
示例5: addBodyClass
/**
* {@inheritdoc}
*/
public function addBodyClass($className)
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'addBodyClass');
if (!$pluginInfo) {
return parent::addBodyClass($className);
} else {
return $this->___callPlugins('addBodyClass', func_get_args(), $pluginInfo);
}
}
示例6: addBodyClass
/**
* Add body class to page configuration api
*
* @param string $bodyClass
* @return $this
*/
public function addBodyClass($bodyClass)
{
$this->pageConfig->addBodyClass($bodyClass);
return $this;
}