Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
layout.php
1<?php
2
4
10
11Loc::loadMessages(__FILE__);
12
13class Layout extends Page
14{
15 protected const DEFAULT_BREAKPOINT = 'tablet';
20 protected function getItems(): array
21 {
22 return [
23 'mobile' => 'on mobile',
24 'tablet' => 'on tablet',
25 'desktop' => 'on desktop',
26 'all' => 'never',
27 ];
28 }
29
34 protected function getMap(): array
35 {
36 return [
37 'BREAKPOINT' => new Field\Select('BREAKPOINT', [
38 'title' => 'Adaptive view',
39 'options' => $this->getItems(),
40 ]),
41 ];
42 }
43
48 public function getTitle(): string
49 {
50 return 'Layout breakpoint title';
51// return Loc::getMessage('LANDING_HOOK_VIEW_NAME');
52 }
53
58 public function enabled(): bool
59 {
60 if ($this->issetCustomExec())
61 {
62 return true;
63 }
64
65 return (bool)$this->fields['BREAKPOINT']->getValue();
66 }
67
72 public function exec(): void
73 {
74 if ($this->execCustom())
75 {
76 return;
77 }
78
79 $breakpoint = trim(HtmlFilter::encode($this->fields['BREAKPOINT']));
80 if(!$breakpoint)
81 {
82 $breakpoint = self::DEFAULT_BREAKPOINT;
83 }
84
85 // Manager::setPageView('BodyClass', $bodyClass);
86 Manager::setPageView('MainClass', 'landing-layout-breakpoint--' . $breakpoint);
87 }
88}
static setPageView(string $marker, string $content, bool $skipTrim=false)
Definition manager.php:465
static loadMessages($file)
Definition loc.php:64