/** * Overrides the default function to check Date fields format, identified by * "_dateformat" suffix, and erases the field if it's not correct. */ protected function loadFormData() { $app = JFactory::getApplication(); $filters = $app->getUserState($this->context . '.filter', array()); $error_dateformat = false; foreach ($filters as $key => $value) { if (strpos($key, '_dateformat') && !empty($value) && !$this->isValidDate($value)) { $filters[$key] = ''; $error_dateformat = true; } } if ($error_dateformat) { $app->enqueueMessage(JText::_("COM_SOMOSMAESTROS_SEARCH_FILTER_DATE_FORMAT"), "warning"); $app->setUserState($this->context . '.filter', $filters); } return parent::loadFormData(); }
/** * Method to get the data that should be injected in the form. * * @return mixed The data for the form. * * @since 3.5 */ protected function loadFormData() { $data = parent::loadFormData(); // Set the selected filter values for pages that use the JLayouts for filtering $data->list['sortTable'] = $this->state->get('list.ordering'); $data->list['directionTable'] = $this->state->get('list.direction'); return $data; }