CI_Form_validation::_get_error_message PHP Method

_get_error_message() protected method

Get the error message for the rule
protected _get_error_message ( string $rule, string $field ) : string
$rule string The rule name
$field string The field name
return string
    protected function _get_error_message($rule, $field)
    {
        // check if a custom message is defined through validation config row.
        if (isset($this->_field_data[$field]['errors'][$rule])) {
            return $this->_field_data[$field]['errors'][$rule];
        } elseif (isset($this->_error_messages[$rule])) {
            return $this->_error_messages[$rule];
        } elseif (FALSE !== ($line = $this->CI->lang->line('form_validation_' . $rule))) {
            return $line;
        } elseif (FALSE !== ($line = $this->CI->lang->line($rule, FALSE))) {
            return $line;
        }
        return $this->CI->lang->line('form_validation_error_message_not_set') . '(' . $rule . ')';
    }