Promo block * @copyright Tamaranga */ class IndexPromoBlock extends Block { /** @var string Иконка блока с объявлением */ public $listings_icon = ''; /** @var string Изображение для блока с магазином, если блок выключен */ public $listings_image = ''; /** @var string Заголовок блока с объявлением */ public $listings_title = ''; /** @var string Описание блока с объявлением */ public $listings_descr = ''; /** @var string Текст на кнопке создать объявление */ public $listings_button = ''; /** @var string Цвет кнопки создать объявление */ public $listings_background = '#74b31b'; /** @var string Адрес перехода кнопки создать магазин */ public $listings_url = ''; public function init() { parent::init(); $this->setTemplate('index/promo', 'site'); $this->setKey('promo'); $this->setTitle(_t('site', 'Promo')); } public function data() { $data = parent::data(); return $data; } public function settingsForm($form) { $form ->text('listings_title', _t('@', 'Title'), _t('listings', 'Shop among thousands of offers - it\'s quick and easy!', true)) ->boundaryInit(['title' => _t('@listings', 'Add Listing')]); $form ->images('listings_icon', _t('@', 'Icon'), 1) ->boundaryIn('listings_title') ->preload(bff::path('/static/img/default/icon_listings_add.svg')); $form ->images('listings_image', _t('@', 'Image'), 1) ->preload(bff::path('/static/img/default/image_listings_add.jpg')) ->boundaryIn('listings_title'); $form ->wysiwyg('listings_descr', _t('@', 'Description'), _t('listings', 'Buy exactly what you need at the best price. All your shopping history in one place - it\'s convenient!', true)) ->boundaryIn('listings_title') ->text('listings_button', _t('@site', 'Button'), _t('listings', 'Post Private Listing', true)) ->boundaryIn('listings_title') ->color('listings_background', _t('@site', 'Button Color'), $this->listings_background) ->boundaryIn('listings_title') ->text('listings_url', _t('@', 'URL'), '', false) ->onValue(function ($value) { if (empty($value)) { $value = Listings::url('item.add'); } return $value; }) ->boundaryIn('listings_title') ; } public function settings() { $settings = []; return array_merge($settings, [ 'listings_icon', 'listings_image', 'listings_title', 'listings_descr', 'listings_button', 'listings_background', 'listings_url', ]); } }