public static function error( $fieldKey, $template = null )
    {

        if (!session_id()) {
            session_start();
        }

        if (isset( $_SESSION[ static::SESSION_DATA_KEY ] )) {
            if (count($_SESSION[ static::SESSION_DATA_KEY ]) > 0) {
                self::$errors = $_SESSION[ static::SESSION_DATA_KEY ];
                unset( $_SESSION[ static::SESSION_DATA_KEY ] );
            }
        }

        if (isset( self::$errors[ $fieldKey ] )) {
            $message = self::$errors[ $fieldKey ];
            if (!is_null($template)) {
                $message = str_ireplace(":message", $message, $template);
            }

            return $message;
        }

        return "";
    }
public static function error( $fieldKey, $template = null )
    {

        if (!session_id()) {
            session_start();
        }

        if (isset( $_SESSION[ static::SESSION_DATA_KEY ] )) {
            if (count($_SESSION[ static::SESSION_DATA_KEY ]) > 0) {
                self::$errors = $_SESSION[ static::SESSION_DATA_KEY ];
                unset( $_SESSION[ static::SESSION_DATA_KEY ] );
            }
        }

        if (isset( self::$errors[ $fieldKey ] )) {
            $message = self::$errors[ $fieldKey ];
            if (!is_null($template)) {
                $message = str_ireplace(":message", $message, $template);
            }

            return $message;
        }

        return "";
    }
public static function error ( $ fieldKey , $ template = null ) { if ( ! session_id ( ) ) { session_start ( ) ; } if ( isset ( $ _SESSION [ static :: SESSION_DATA_KEY ] ) ) { if ( count ( $ _SESSION [ static :: SESSION_DATA_KEY ] ) > 0 ) { self :: $ errors = $ _SESSION [ static :: SESSION_DATA_KEY ] ; unset ( $ _SESSION [ static :: SESSION_DATA_KEY ] ) ; } } if ( isset ( self :: $ errors [ $ fieldKey ] ) ) { $ message = self :: $ errors [ $ fieldKey ] ; if ( ! is_null ( $ template ) ) { $ message = str_ireplace ( ":message" , $ message , $ template ) ; } return $ message ; } return "" ; }
Get error message of a field

@param $fieldKey
@return mixed
Get error message of a field