removeByName([ 'ConfigHD', 'Animation', 'Loop', 'Animate', 'ThumbnailNav', 'SliderControlNav', 'SliderDirectionNav', 'CarouselControlNav', 'CarouselDirectionNav', 'CarouselThumbnailCt', ]); $grid = $fields->dataFieldByName('Slides'); if ($grid) { $config = $grid->getConfig(); $columns = new GridFieldEditableColumns(); $columns->setDisplayFields([ 'Hide' => [ 'title' => 'Hide it?', 'field' => CheckboxField::class, ], ]); $config->addComponent($columns); } return $fields; } /** * @return mixed */ public function getSlideShow() { if($this->items) { return $this->items; } $date = date('Y-m-d H:i:s'); $this->items = $this->Slides()->filter([ 'Hide' => '0', ])->filterByCallback(function($item, $list) use ($date) { $on = $item->getField('DateOn'); $off = $item->getField('DateOff'); return ($on <= $date) && (!$off || $off > $date); })->sort('SortOrder'); return $this->items; } }