Skip to content

Commit 676a0dd

Browse files
committed
updated error_array bcit-ci#565
1 parent 963386b commit 676a0dd

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

system/libraries/Form_validation.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,20 @@ public function error($field = '', $prefix = '', $suffix = '')
234234

235235
// --------------------------------------------------------------------
236236

237+
/**
238+
* Get Array of Error Messages
239+
*
240+
* Returns the error messages as an array
241+
*
242+
* @return array
243+
*/
244+
public function error_array()
245+
{
246+
return $this->_error_array;
247+
}
248+
249+
// --------------------------------------------------------------------
250+
237251
/**
238252
* Error String
239253
*

user_guide_src/source/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Release Date: Not Released
7575
- Minor speed optimizations and method & property visibility declarations in the Calendar Library.
7676
- Removed SHA1 function in the :doc:`Encryption Library <libraries/encryption>`.
7777
- Added $config['csrf_regeneration'] to the CSRF protection in the :doc:`Security library <libraries/security>`, which makes token regeneration optional.
78+
- Added function error_array() to return all error messages as an array in the Form_validation class.
7879

7980
- Core
8081

user_guide_src/source/libraries/form_validation.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,15 @@ $this->form_validation->set_message();
930930

931931
Permits you to set custom error messages. See :ref:`setting-error-messages`
932932

933+
$this->form_validation->error_array();
934+
========================================
935+
936+
.. php:method:: error_array ()
937+
938+
:rtype: Array
939+
940+
Returns the error messages as an array.
941+
933942
.. _helper-functions:
934943

935944
****************

0 commit comments

Comments
 (0)