Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
80 lines (70 sloc) 1.68 KB
<?php
namespace Admin\Http\Sections;
use AdminColumn;
use AdminDisplay;
use AdminForm;
use AdminFormElement;
use SleepingOwl\Admin\Contracts\Display\DisplayInterface;
use SleepingOwl\Admin\Contracts\Form\FormInterface;
use SleepingOwl\Admin\Contracts\Initializable;
use SleepingOwl\Admin\Display\Column\Order;
use SleepingOwl\Admin\Display\Tree\OrderTreeType;
use SleepingOwl\Admin\Navigation\Badge;
use SleepingOwl\Admin\Section;
/**
* Class Pages
*
* @property \App\Model\Page $model
*
* @see http://sleepingowladmin.ru/docs/model_configuration_section
*/
class PageOrders extends Section implements Initializable
{
/**
* @see http://sleepingowladmin.ru/docs/model_configuration#ограничение-прав-доступа
*
* @var bool
*/
protected $checkAccess = false;
/**
* @var string
*/
protected $title = 'Pages (order)';
/**
* @var string
*/
protected $alias;
/**
* Initialize class.
*/
public function initialize()
{
$this->addToNavigation()->setIcon('fa fa-sitemap')->setBadge(new Badge('New'));
}
/**
* @return DisplayInterface
*/
public function onDisplay()
{
return AdminDisplay::tree(OrderTreeType::class)->setValue('title');
}
/**
* @param int $id
*
* @return FormInterface
*/
public function onEdit($id)
{
return AdminForm::form()->setElements([
AdminFormElement::text('title', 'Title')->required(),
AdminFormElement::ckeditor('text', 'Text')
]);
}
/**
* @return FormInterface
*/
public function onCreate()
{
return $this->onEdit(null);
}
}