Carbon_Fields\Container\Container::save PHP Méthode

save() public méthode

Load submitted data and save each field in the container
See also: is_valid_save()
public save ( $data )
    public function save($data)
    {
        foreach ($this->fields as $field) {
            $field->set_value_from_input();
            $field->save();
        }
    }

Usage Example

 /**
  * Perform save operation after successful is_valid_save() check.
  * The call is propagated to all fields in the container.
  *
  * @param mixed $user_data
  **/
 public function save($user_data = null)
 {
     try {
         parent::save($user_data);
     } catch (Incorrect_Syntax_Exception $e) {
         $this->errors[] = $e->getMessage();
     }
     do_action('carbon_after_save_theme_options', $user_data);
     if (!headers_sent()) {
         wp_redirect(add_query_arg(array('settings-updated' => 'true')));
     }
 }