Skip to content

Commit

Permalink
pass fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed May 30, 2012
1 parent 6d9895a commit 0ac088b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions classes/class-wc-settings-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ public function process_admin_options() {

if ( count( $this->errors ) > 0 ) {
$this->display_errors();
return false;
} else {
update_option( $this->plugin_id . $this->id . '_settings', $this->sanitized_fields );
return true;
}
}

Expand Down Expand Up @@ -118,7 +120,7 @@ function format_settings( $value ) {
* @since 1.0.0
* @uses method_exists()
*/
function generate_settings_html ( $form_fields ) {
function generate_settings_html ( $form_fields = false ) {

if ( ! $form_fields )
$form_fields = $this->form_fields;
Expand Down Expand Up @@ -331,8 +333,14 @@ function generate_multiselect_html ( $key, $data ) {
* @since 1.0.0
* @uses method_exists()
*/
function validate_settings_fields () {
foreach ( $this->form_fields as $k => $v ) {
function validate_settings_fields( $form_fields = false ) {

if ( ! $form_fields )
$form_fields = $this->form_fields;

$this->sanitized_fields = array();

foreach ( $form_fields as $k => $v ) {
if ( ! isset( $v['type'] ) || ( $v['type'] == '' ) ) { $v['type'] == 'text'; } // Default to "text" field type.

if ( method_exists( $this, 'validate_' . $v['type'] . '_field' ) ) {
Expand Down

0 comments on commit 0ac088b

Please sign in to comment.