Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Body.php
Go to the documentation of this file.
1 <?php
7 
10 
11 class Body implements Layout\GeneratorInterface
12 {
16  const TYPE = 'body';
17 
21  private $pageConfig;
22 
28  public function __construct(\Magento\Framework\View\Page\Config $pageConfig)
29  {
30  $this->pageConfig = $pageConfig;
31  }
32 
38  public function getType()
39  {
40  return self::TYPE;
41  }
42 
50  public function process(Layout\Reader\Context $readerContext, Layout\Generator\Context $generatorContext)
51  {
52  $structure = $readerContext->getPageConfigStructure();
53  $this->processBodyClasses($structure);
54  return $this;
55  }
56 
63  protected function processBodyClasses(Structure $pageStructure)
64  {
65  foreach ($pageStructure->getBodyClasses() as $class) {
66  $this->pageConfig->addBodyClass($class);
67  }
68  return $this;
69  }
70 }
$_option $_optionId $class
Definition: date.phtml:13
__construct(\Magento\Framework\View\Page\Config $pageConfig)
Definition: Body.php:28
process(Layout\Reader\Context $readerContext, Layout\Generator\Context $generatorContext)
Definition: Body.php:50
processBodyClasses(Structure $pageStructure)
Definition: Body.php:63