Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/blocks/bitrix/60.1.openlines_buttons/ |
Upload File : |
<?php if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die(); } use Bitrix\Landing\Hook\Page\B24button; use Bitrix\Landing\LandingBlock; use Bitrix\Landing\Site; use Bitrix\Landing\Site\Type; use Bitrix\Landing\Landing; class OlWidgetBlock extends LandingBlock { public function init(array $params = []) { $site = Site::getList([ 'select' => ['CODE'], 'filter' => [ 'ID' => $params['site_id'] ] ])->fetch(); if (!$site) { return; } $this->params['SITE_TYPE'] = Type::getSiteSpecialType($site['CODE']); $hooks = Site::getHooks($params['site_id']); $hooksLanding = Landing::getHooks($params['landing_id']); if ( !array_key_exists('B24BUTTON', $hooks) || !array_key_exists('B24BUTTON', $hooksLanding) || !array_key_exists('B24BUTTON_CODE', $hooks['B24BUTTON']->getPageFields()) || !array_key_exists('B24BUTTON_CODE', $hooksLanding['B24BUTTON']->getPageFields()) ) { return; // something wrong } $buttonUsePage = $hooksLanding['B24BUTTON']->getPageFields()['B24BUTTON_USE']->getValue(); if ($buttonUsePage === 'Y') { $buttonCode = $hooksLanding['B24BUTTON']->getPageFields()['B24BUTTON_CODE']->getValue(); } else { $buttonCode = $hooks['B24BUTTON']->getPageFields()['B24BUTTON_CODE']->getValue(); } if ($buttonCode === 'N') { $this->params['BUTTON_ID'] = 'N'; return; } if ($buttonId = B24button::getButtonIdByCode($buttonCode)) { $this->params['BUTTON_ID'] = (int)$buttonId; } } }