當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Config::addBodyClass方法代碼示例

本文整理匯總了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;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:14,代碼來源:Page.php

示例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();
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:21,代碼來源:Page.php

示例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();
 }
開發者ID:pavelnovitsky,項目名稱:magento2,代碼行數:28,代碼來源:Page.php

示例4: execute

 /**
  * @return \Magento\Framework\View\Result\Page
  */
 public function execute()
 {
     $this->pageConfig->addBodyClass('swagger-section');
     return $this->pageFactory->create();
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:8,代碼來源:Index.php

示例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);
     }
 }
開發者ID:CSYE6225,項目名稱:UnixSysProgramming,代碼行數:12,代碼來源:Interceptor.php

示例6: addBodyClass

 /**
  * Add body class to page configuration api
  *
  * @param string $bodyClass
  * @return $this
  */
 public function addBodyClass($bodyClass)
 {
     $this->pageConfig->addBodyClass($bodyClass);
     return $this;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:11,代碼來源:Body.php


注:本文中的Magento\Framework\View\Page\Config::addBodyClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。