classes/PodsComponents.php
public function admin_ajax_settings( $component, $params ) {

		if ( ! isset( $this->components[ $component ] ) ) {
			wp_die( 'Invalid Component', '', array( 'back_link' => true ) );
		} elseif ( ! method_exists( $this->components[ $component ]['object'], 'options' ) ) {
			pods_error( 'Component options method does not exist', $this );
		}

		$options = $this->components[ $component ]['object']->options( $this->settings['components'][ $component ] );

		if ( empty( $this->settings['components'][ $component ] ) ) {
			$this->settings['components'][ $component ] = array();
		}

		foreach ( $options as $field_name => $field_option ) {
			$field_option = PodsForm::field_setup( $field_option, null, $field_option['type'] );

			if ( ! is_array( $field_option['group'] ) ) {
				$field_value = pods_v( 'pods_setting_' . $field_name, $params );

				$this->settings['components'][ $component ][ $field_name ] = $field_value;
			} else {
				foreach ( $field_option['group'] as $field_group_name => $field_group_option ) {
					$field_value = pods_v( 'pods_setting_' . $field_group_name, $params );

					$this->settings['components'][ $component ][ $field_group_name ] = $field_value;
				}
			}
		}

		$this->update_settings( $this->settings );

		return '1';
	}
public function admin_ajax_settings( $component, $params ) {

		if ( ! isset( $this->components[ $component ] ) ) {
			wp_die( 'Invalid Component', '', array( 'back_link' => true ) );
		} elseif ( ! method_exists( $this->components[ $component ]['object'], 'options' ) ) {
			pods_error( 'Component options method does not exist', $this );
		}

		$options = $this->components[ $component ]['object']->options( $this->settings['components'][ $component ] );

		if ( empty( $this->settings['components'][ $component ] ) ) {
			$this->settings['components'][ $component ] = array();
		}

		foreach ( $options as $field_name => $field_option ) {
			$field_option = PodsForm::field_setup( $field_option, null, $field_option['type'] );

			if ( ! is_array( $field_option['group'] ) ) {
				$field_value = pods_v( 'pods_setting_' . $field_name, $params );

				$this->settings['components'][ $component ][ $field_name ] = $field_value;
			} else {
				foreach ( $field_option['group'] as $field_group_name => $field_group_option ) {
					$field_value = pods_v( 'pods_setting_' . $field_group_name, $params );

					$this->settings['components'][ $component ][ $field_group_name ] = $field_value;
				}
			}
		}

		$this->update_settings( $this->settings );

		return '1';
	}
public function admin_ajax_settings ( $ component , $ params ) { if ( ! isset ( $ this -> components [ $ component ] ) ) { wp_die ( 'Invalid Component' , '' , array ( 'back_link' => true ) ) ; } elseif ( ! method_exists ( $ this -> components [ $ component ] [ 'object' ] , 'options' ) ) { pods_error ( 'Component options method does not exist' , $ this ) ; } $ options = $ this -> components [ $ component ] [ 'object' ] -> options ( $ this -> settings [ 'components' ] [ $ component ] ) ; if ( empty ( $ this -> settings [ 'components' ] [ $ component ] ) ) { $ this -> settings [ 'components' ] [ $ component ] = array ( ) ; } foreach ( $ options as $ field_name => $ field_option ) { $ field_option = PodsForm :: field_setup ( $ field_option , null , $ field_option [ 'type' ] ) ; if ( ! is_array ( $ field_option [ 'group' ] ) ) { $ field_value = pods_v ( 'pods_setting_' . $ field_name , $ params ) ; $ this -> settings [ 'components' ] [ $ component ] [ $ field_name ] = $ field_value ; } else { foreach ( $ field_option [ 'group' ] as $ field_group_name => $ field_group_option ) { $ field_value = pods_v ( 'pods_setting_' . $ field_group_name , $ params ) ; $ this -> settings [ 'components' ] [ $ component ] [ $ field_group_name ] = $ field_value ; } } } $ this -> update_settings ( $ this -> settings ) ; return '1' ; }
Handle admin AJAX settings saving.

@param string $component Component name.
@param array  $params    AJAX parameters.

@return string
Handle admin AJAX settings saving .