# _wp_connectors_get_connector_script_module_data()

URL: https://chugunov.pro/api-wordpress/functions/_wp_connectors_get_connector_script_module_data/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 7.0.0.

## Сигнатура

```php
_wp_connectors_get_connector_script_module_data( $data ): array<string,
```

## Описание

Предоставляет настройки коннекторов модулю скрипта connectors-wp-admin.

## Возвращаемое значение

`array<string,`

## Исходный код

Файл: `wp-includes/connectors.php:674`

```php
function _wp_connectors_get_connector_script_module_data( array $data ): array {
	$registry = AiClient::defaultRegistry();

	if ( ! function_exists( 'validate_plugin' ) ) {
		require_once ABSPATH . 'wp-admin/includes/plugin.php';
	}

	$connectors = array();
	foreach ( wp_get_connectors() as $connector_id => $connector_data ) {
		$auth     = $connector_data['authentication'];
		$auth_out = array( 'method' => $auth['method'] );

		if ( 'api_key' === $auth['method'] ) {
			$auth_out['settingName']    = $auth['setting_name'] ?? '';
			$auth_out['credentialsUrl'] = $auth['credentials_url'] ?? null;
			$key_source                 = _wp_connectors_get_api_key_source( $auth['setting_name'] ?? '', $auth['env_var_name'] ?? '', $auth['constant_name'] ?? '' );
			$auth_out['keySource']      = $key_source;

			if ( 'ai_provider' === $connector_data['type'] ) {
				try {
					$auth_out['isConnected'] = $registry->hasProvider( $connector_id ) && $registry->isProviderConfigured( $connector_id );
				} catch ( Exception $e ) {
					$auth_out['isConnected'] = false;
				}
			} else {
				$auth_out['isConnected'] = 'none' !== $key_source;
			}
		}

		$connector_out = array(
			'name'           => $connector_data['name'],
			'description'    => $connector_data['description'],
			'logoUrl'        => ! empty( $connector_data['logo_url'] ) ? $connector_data['logo_url'] : null,
			'type'           => $connector_data['type'],
			'authentication' => $auth_out,
		);

		if ( ! empty( $connector_data['plugin']['file'] ) ) {
			$file         = $connector_data['plugin']['file'];
			$is_activated = (bool) call_user_func( $connector_data['plugin']['is_active'] );
			$is_installed = $is_activated || 0 === validate_plugin( $file );

			$connector_out['plugin'] = array(
				'file'        => $file,
				'isInstalled' => $is_installed,
				'isActivated' => $is_activated,
			);
		}

		$connectors[ $connector_id ] = $connector_out;
	}
	ksort( $connectors );
	$data['connectors']        = $connectors;
	$data['isFileModDisabled'] = ! wp_is_file_mod_allowed( 'install_plugins' );
	return $data;
}
```

## История изменений

- 7.0.0 — Introduced.

## Связанные

Использует: `AiClient::defaultRegistry`, [`_wp_connectors_get_api_key_source`](https://chugunov.pro/api-wordpress/functions/_wp_connectors_get_api_key_source/), [`wp_get_connectors`](https://chugunov.pro/api-wordpress/functions/wp_get_connectors/), [`wp_is_file_mod_allowed`](https://chugunov.pro/api-wordpress/functions/wp_is_file_mod_allowed/), [`validate_plugin`](https://chugunov.pro/api-wordpress/functions/validate_plugin/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/_wp_connectors_get_connector_script_module_data/
