PHP code example of liventin / base.module.options.provider.js.buttons.row
1. Go to this page and download the library: Download liventin/base.module.options.provider.js.buttons.row library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
liventin / base.module.options.provider.js.buttons.row example snippets
$provider = $srvOptions->getProvider('buttons');
return $provider
->setAlign('left') // left | center | right
->setButtons([
[
'title' => 'Экспорт полей',
'js' => 'alert("hello");', // выполняется по клику (в контексте кнопки)
],
[
'title' => 'Обновить',
'align' => 'right', // (опционально) переопределить выравнивание для кнопки
'js' => 'BX.reload();',
],
])
->getParamsToArray();
class ExportButtons implements Option
{
public static function getType(): string { return 'buttons'; }
public static function getParams(): array
{
/* @var \Base\Module\Src\Options\Providers\ButtonsProvider $provider */
$provider = \Base\Module\Service\Container::get(\Base\Module\Service\Options\OptionsService::SERVICE_CODE)
->getProvider('buttons');
return $provider
->setAlign('right')
->setButtons([
['title' => 'Экспорт', 'js' => 'BX.PopupWindowManager.create(...)'],
])
->getParamsToArray();
}
}