This function’s access is marked private. This means it is not intended for use by other plugin or theme developers, only in this plugin itself. It is listed here for completeness.

Form_Edit_Page_Handler::save_containers( array $containers, array $mappings, WP_Error $errors )

Saves containers.

Description

Parameters

$containers

(array) (Required) Array of $container_id => $container_data pairs.

$mappings

(array) (Required) Array of mappings to pass-through and modify.

$errors

(WP_Error) (Required) Error object to append errors to.

Return

(array) Modified mappings.

Source

File: src/db-objects/forms/form-edit-page-handler.php

	private function save_containers( $containers, $mappings, $errors ) {
		$container_manager = $this->form_manager->get_child_manager( 'containers' );

		foreach ( $containers as $id => $data ) {
			$data['form_id'] = key( $mappings['forms'] );

			if ( $this->is_temp_id( $id ) ) {
				$container = $container_manager->create();
			} else {
				$container = $container_manager->get( $id );
				if ( ! $container ) {
					$container = $container_manager->create();
				}
			}

			foreach ( $data as $key => $value ) {
				$container->$key = $value;
			}

			$status = $container->sync_upstream();
			if ( is_wp_error( $status ) ) {
				$errors->add( $status->get_error_code(), $status->get_error_message(), array(
					'id'   => $id,
					'data' => $data,
				) );
			} else {
				$mappings['containers'][ $id ] = $container->id;
			}
		}

		return $mappings;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.