silverstripe-subsites/code/admin/SubsiteAdmin.php

45 lines
1.0 KiB
PHP
Raw Normal View History

2007-08-18 13:38:11 +02:00
<?php
2016-09-22 16:38:29 +02:00
2017-05-24 12:32:05 +02:00
namespace SilverStripe\Subsites\Admin;
2016-09-22 16:38:29 +02:00
use SilverStripe\Admin\ModelAdmin;
2017-05-24 12:32:05 +02:00
use SilverStripe\Subsites\Forms\GridFieldSubsiteDetailForm;
2017-05-24 13:36:04 +02:00
use SilverStripe\Subsites\Model\Subsite;
2017-05-24 12:32:05 +02:00
/**
* Admin interface to manage and create {@link Subsite} instances.
2017-05-24 12:32:05 +02:00
*
* @package subsites
*/
2017-05-24 15:26:28 +02:00
class SubsiteAdmin extends ModelAdmin
{
2017-05-24 12:32:05 +02:00
2017-05-24 15:26:28 +02:00
private static $managed_models = [Subsite::class];
2017-05-24 15:26:28 +02:00
private static $url_segment = 'subsites';
2017-05-24 12:32:05 +02:00
private static $menu_title = 'Subsites';
2013-05-24 06:39:25 +02:00
private static $menu_icon = 'subsites/images/subsites.png';
2017-05-24 12:32:05 +02:00
2017-05-24 15:26:28 +02:00
public $showImportForm = false;
2017-05-24 15:26:28 +02:00
private static $tree_class = Subsite::class;
2017-05-24 15:26:28 +02:00
public function getEditForm($id = null, $fields = null)
{
$form = parent::getEditForm($id, $fields);
2017-05-24 15:26:28 +02:00
$grid = $form->Fields()->dataFieldByName(Subsite::class);
if ($grid) {
2017-05-29 13:44:19 +02:00
$grid->getConfig()->removeComponentsByType(GridFieldDetailForm::class);
2017-05-24 15:26:28 +02:00
$grid->getConfig()->addComponent(new GridFieldSubsiteDetailForm());
}
2017-05-24 15:26:28 +02:00
return $form;
}
2007-08-18 13:38:11 +02:00
}