API_Action::add_config_data( awsmug\Torro_Forms\APIAPI_Config $config )

Adds the necessary API-API configuration data.

Description

See also

Parameters

$config

(awsmug\Torro_Forms\APIAPI_Config) (Required) The plugin's API-API configuration.

Source

File: src/modules/actions/api-action.php

	protected function add_config_data( $config ) {
		$authentication_fields = $this->get_authentication_fields();
		if ( empty( $authentication_fields ) ) {
			return;
		}

		$options = $this->get_options();

		$authentication_data = array_filter( array_intersect_key( $options, $authentication_fields ) );
		if ( empty( $authentication_data ) ) {
			return;
		}

		$config_key = $this->api_structure()->get_config_key();

		if ( $config->exists( $config_key, 'authentication_data' ) ) {
			$authentication_data = array_merge( (array) $config->get( $config_key, 'authentication_data' ), $authentication_data );
		}

		$config->set( $config_key, 'authentication_data', $authentication_data );
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.