Yoast\WP\SEO\Actions\Configuration

First_Time_Configuration_Action::save_configuration_state()publicYoast 1.0

Stores the first time configuration state.

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

Хуков нет.

Возвращает

Объект. The response object.

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

$First_Time_Configuration_Action = new First_Time_Configuration_Action();
$First_Time_Configuration_Action->save_configuration_state( $params );
$params(массив) (обязательный)
The values to store.

Код First_Time_Configuration_Action::save_configuration_state() Yoast 19.2

public function save_configuration_state( $params ) {
	// If the finishedSteps param is not present in the REST request, it's a malformed request.
	if ( ! isset( $params['finishedSteps'] ) ) {
		return (object) [
			'success' => false,
			'status'  => 400,
			'error'   => 'Bad request',
		];
	}

	// Sanitize input.
	$finished_steps = \array_map( '\sanitize_text_field', \wp_unslash( $params['finishedSteps'] ) );

	$success = $this->options_helper->set( 'configuration_finished_steps', $finished_steps );

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

	// If all the five steps of the configuration have been completed, set first_time_install option to false.
	if ( \count( $params['finishedSteps'] ) === 3 ) {
		$this->options_helper->set( 'first_time_install', false );
	}

	return (object) [
		'success' => true,
		'status'  => 200,
	];
}