Yoast\WP\SEO\Actions

Integrations_Action::set_integration_active()publicYoast 1.0

Sets an integration state.

{} Это метод класса: Integrations_Action{}

Хуков нет.

Возвращает

Объект. The response object.

Использование

$Integrations_Action = new Integrations_Action();
$Integrations_Action->set_integration_active( $integration_name, $params );
$integration_name(строка) (обязательный)
The name of the integration to activate/deactivate.
$params(массив) (обязательный)
The values to store.

Код Integrations_Action::set_integration_active() Yoast 19.7.1

public function set_integration_active( $integration_name, $params ) {
	$option_name  = $integration_name . '_integration_active';
	$success      = true;
	$option_value = $this->options_helper->get( $option_name );

	if ( $option_value !== $params['active'] ) {
		$success = $this->options_helper->set( $option_name, $params['active'] );
	}

	if ( $success ) {
		return (object) [
			'success' => true,
			'status'  => 200,
		];
	}
	return (object) [
		'success' => false,
		'status'  => 500,
		'error'   => 'Could not save the option in the database',
	];
}