code: public function setPagesFlags($varValue, Contao\DataContainer $dc)
  	{
  		if ($dc->activeRecord && $dc->activeRecord->type == 'search')
  		{
  			$GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['mandatory'] = false;
  			unset($GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['orderField']);
  		}
  
  		return $varValue;
  	}
docs: Dynamically change attributes of the "pages" field
  
  @param mixed                $varValue
  @param Contao\DataContainer $dc
  
  @return mixed