Skip to content

Instantly share code, notes, and snippets.

@niksamokhvalov
Last active September 30, 2015 08:38
Show Gist options
  • Save niksamokhvalov/315252f6b3ca22f77745 to your computer and use it in GitHub Desktop.
Save niksamokhvalov/315252f6b3ca22f77745 to your computer and use it in GitHub Desktop.
Пример описания интерфейса для «Админ-хелпера»
<?php
/**
* Подразумевается, что для каждого админского раздела, пусть и в рамках одного модуля,
* будет создаваться свой interface.php
*/
namespace Vasya\Supermodule\HeaderFooter;
use DigitalWand\AdminHelper\AdminInterface;
class HeaderFooterInterface extends AdminInterface
{
public function getFields()
{
return [
[
'NAME' => GetMessage('ELEMENT'),
'FIELDS' => [
'ID' => [
'WIDGET' => new NumberWidget(),
'TITLE' => 'ID',
'FILTER' => true,
'READONLY' => true,
],
'ACTIVE' => [
'WIDGET' => new CheckboxWidget(),
'TITLE' => GetMessage('ACTIVE_TITLE'),
],
'EXPORT_ENABLED' => [
'WIDGET' => new CheckboxWidget(),
'TITLE' => GetMessage('EXPORT_ENABLED'),
'SHOW' => $this->isEditor()
],
]
],
[
'NAME' => GetMessage('ADDITIONAL'),
'FIELDS' => [
'SITE_NAME' => [
'WIDGET' => new ListWidget(),
'TITLE' => GetMessage('SITE_ID_TITLE'),
'ITEMS' => CEvpHBSite::GetListData('NAME', 'NAME'),
'FILTER' => '%',
'FORCE_SELECT' => true,
'VIRTUAL' => true,
'HEADER' => false
],
'NEW_BANNERS' => [
'TITLE' => GetMessage('USE_NEW_BANNERS_TITLE'),
'TYPE' => 'CHECKBOX',
'SHOW' => $this->isGeneralEditor()
],
]
]
];
}
public function getHelpers()
{
return [
HeaderFooterEditHelper::className(),
HeaderFooterListHelper::className(),
];
}
public function getButtons()
{
return [
'ITEMS' => 'Элементы',
'ITEM' => 'Элемент',
'ITEM_ADD' => 'Добавить элемент',
'ITEM_EDIT' => 'Обновить элемент',
'ITEM_DELETE' => 'Удалить элемент',
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment