Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Kalamov\Components\Router\Controllers;
- use Bitrix\Iblock\InheritedProperty\SectionValues;
- use Kalamov\Helpers\Cache;
- abstract class BaseController
- {
- /** @var $cacheManager Cache */
- protected $cacheManager;
- protected $section;
- public function __construct(array $section)
- {
- $this->cacheManager = new Cache();
- $this->section = $section;
- $this->setRouteProperties();
- }
- /**
- * Метод, в котором формируется и возвращается массив данных для последующей записи в $arResult
- *
- * @return array
- */
- abstract public function getData(): array;
- /**
- * Устанавливаем Seo информацию из штатной вкладки "SEO" на странице редактирования раздела в админке
- *
- * @return $this
- */
- protected function setRouteProperties(): self
- {
- global $APPLICATION;
- $seo = new SectionValues($this->section['IBLOCK_ID'], $this->section['ID']);
- $meta = $seo->getValues();
- $APPLICATION->SetTitle($meta['SECTION_META_TITLE']);
- $APPLICATION->SetPageProperty('title', $meta['SECTION_META_TITLE']);
- $APPLICATION->SetPageProperty('keywords', $meta['SECTION_META_KEYWORDS']);
- $APPLICATION->SetPageProperty('description', $meta['SECTION_META_DESCRIPTION']);
- return $this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement