form->getData($this->field); return $this->type == 'optional' || (is_array($value) && !empty($value[$primaryLocale])); } /** * Check if field value is empty and optional. * @return boolean */ function isEmptyAndOptional() { $value = $this->form->getData($this->field); return $this->type == 'optional' && empty($value); } /** * Get the field associated with the check. * @return string */ function getField() { return $this->field; } /** * Get the error message associated with a failed validation check. * @return string */ function getMessage() { $primaryLocale = Locale::getPrimaryLocale(); $allLocales = Locale::getAllLocales(); return parent::getMessage() . ' (' . $allLocales[$primaryLocale] . ')'; } } ?>