Source of file TeamAdmin.php
Size: 1,419 Bytes - Last Modified: 2021-12-23T10:59:45+00:00
/var/www/docs.ssmods.com/process/src/src/TeamAdmin.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 | <?php namespace WWN\Team; use SilverStripe\Admin\ModelAdmin; use SilverStripe\Forms\Form; use SilverStripe\Forms\GridField\GridField; use Symbiote\GridFieldExtensions\GridFieldOrderableRows; /** * TeamAdmin * * @package wwn-team */ class TeamAdmin extends ModelAdmin { /** * @var string */ private static $menu_icon_class = 'font-icon-torso'; /** * @var string */ private static $menu_title = 'Team'; /** * @var string */ private static $url_segment = 'team'; /** * @var array */ private static $managed_models = [ 'WWN\Team\TeamMember', 'WWN\Team\TeamGroup', 'WWN\Team\TeamPlatoon', ]; /** * @param null $id * @param null $fields * * @return Form */ public function getEditForm($id = null, $fields = null): Form { $form = parent::getEditForm($id, $fields); $model = singleton($this->modelClass); if (class_exists(GridFieldOrderableRows::class) && $model->hasField('SortOrder') ) { $gridField = $form->Fields() ->dataFieldByName($this->sanitiseClassName($this->modelClass)); if ($gridField instanceof GridField) { $gridField->getConfig() ->addComponent(new GridFieldOrderableRows('SortOrder')); } } return $form; } } |