Merge pull request #1103 from IT-Can/error-array-565
updated version of pull request #565
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 2ee734a..5069a44 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -235,6 +235,20 @@
// --------------------------------------------------------------------
/**
+ * Get Array of Error Messages
+ *
+ * Returns the error messages as an array
+ *
+ * @return array
+ */
+ public function error_array()
+ {
+ return $this->_error_array;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Error String
*
* Returns the error messages as a string, wrapped in the error delimiters
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index d652f1c..6505e74 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -75,6 +75,7 @@
- Minor speed optimizations and method & property visibility declarations in the Calendar Library.
- Removed SHA1 function in the :doc:`Encryption Library <libraries/encryption>`.
- Added $config['csrf_regeneration'] to the CSRF protection in the :doc:`Security library <libraries/security>`, which makes token regeneration optional.
+ - Added function error_array() to return all error messages as an array in the Form_validation class.
- Core
diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst
index e7875bc..09a192b 100644
--- a/user_guide_src/source/libraries/form_validation.rst
+++ b/user_guide_src/source/libraries/form_validation.rst
@@ -930,6 +930,15 @@
Permits you to set custom error messages. See :ref:`setting-error-messages`
+$this->form_validation->error_array();
+========================================
+
+ .. php:method:: error_array ()
+
+ :rtype: Array
+
+ Returns the error messages as an array.
+
.. _helper-functions:
****************