/** * Validate element value * * If a translation adapter is registered, any error messages will be * translated according to the current locale, using the given error code; * if no matching translation is found, the original message will be * utilized. * * Note: The *filtered* value is validated. * * @param mixed $value * @param mixed $context * @return boolean */ public function isValid($value, $context = null) { $validators = $this->getValidators(); if (!$this->getValidator('IsDate')) { // Always as first validator $isDate = new \MUtil_Validate_Date_IsDate(); $isDate->setDateFormat($this->_dateFormat); array_unshift($validators, $isDate); $this->setValidators($validators); } if ($format = $this->getDateFormat()) { // Set the dataFormat if settable foreach ($validators as $validator) { if ($validator instanceof \MUtil_Validate_Date_FormatInterface || method_exists($validator, 'setDateFormat')) { $validator->setDateFormat($format); } } } return parent::isValid($value, $context); }