src/controllers/MediaHolderController.php
public function getDateFilterForm() {

		// Display a form that allows filtering from a specified date.

		$children = MediaPage::get()->filter('ParentID', $this->data()->ID);
		$form = Form::create(
			$this,
			'getDateFilterForm',
			FieldList::create(
				$date = DateField::create(
					'from',
					'From'
				)->setMinDate($children->min('Date'))->setMaxDate($children->max('Date')),
				HiddenField::create(
					'category'
				),
				HiddenField::create(
					'tag'
				)
			),
			FieldList::create(
				FormAction::create(
					'dateFilter',
					'Filter'
				),
				FormAction::create(
					'clearFilters',
					'Clear'
				)
			)
		);
		$form->setFormMethod('get');

		// Remove validation if clear has been triggered.

		$request = $this->getRequest();
		if($request->getVar('action_clearFilters')) {
			$form->unsetValidator();
		}

		// Allow extension customisation.

		$this->extend('updateFilterForm', $form);

		// Display existing request filters.

		$form->loadDataFrom($request->getVars());
		return $form;
	}
public function getDateFilterForm() {

		// Display a form that allows filtering from a specified date.

		$children = MediaPage::get()->filter('ParentID', $this->data()->ID);
		$form = Form::create(
			$this,
			'getDateFilterForm',
			FieldList::create(
				$date = DateField::create(
					'from',
					'From'
				)->setMinDate($children->min('Date'))->setMaxDate($children->max('Date')),
				HiddenField::create(
					'category'
				),
				HiddenField::create(
					'tag'
				)
			),
			FieldList::create(
				FormAction::create(
					'dateFilter',
					'Filter'
				),
				FormAction::create(
					'clearFilters',
					'Clear'
				)
			)
		);
		$form->setFormMethod('get');

		// Remove validation if clear has been triggered.

		$request = $this->getRequest();
		if($request->getVar('action_clearFilters')) {
			$form->unsetValidator();
		}

		// Allow extension customisation.

		$this->extend('updateFilterForm', $form);

		// Display existing request filters.

		$form->loadDataFrom($request->getVars());
		return $form;
	}
public function getDateFilterForm ( ) { // Display a form that allows filtering from a specified date. $ children = MediaPage :: get ( ) -> filter ( 'ParentID' , $ this -> data ( ) -> ID ) ; $ form = Form :: create ( $ this , 'getDateFilterForm' , FieldList :: create ( $ date = DateField :: create ( 'from' , 'From' ) -> setMinDate ( $ children -> min ( 'Date' ) ) -> setMaxDate ( $ children -> max ( 'Date' ) ) , HiddenField :: create ( 'category' ) , HiddenField :: create ( 'tag' ) ) , FieldList :: create ( FormAction :: create ( 'dateFilter' , 'Filter' ) , FormAction :: create ( 'clearFilters' , 'Clear' ) ) ) ; $ form -> setFormMethod ( 'get' ) ; // Remove validation if clear has been triggered. $ request = $ this -> getRequest ( ) ; if ( $ request -> getVar ( 'action_clearFilters' ) ) { $ form -> unsetValidator ( ) ; } // Allow extension customisation. $ this -> extend ( 'updateFilterForm' , $ form ) ; // Display existing request filters. $ form -> loadDataFrom ( $ request -> getVars ( ) ) ; return $ form ; }
Retrieve a simple date filter form.

@return form
Retrieve a simple date filter form .