Yoast\WP\SEO\Actions\Importing\Aioseo

Abstract_Aioseo_Settings_Importing_Action::import_single_setting()protectedYoast 1.0

Imports a single setting in the db after transforming it to adhere to Yoast conventions.

Метод класса: Abstract_Aioseo_Settings_Importing_Action{}

Хуков нет.

Возвращает

null. Ничего (null).

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->import_single_setting( $setting, $setting_value, $setting_mapping );
$setting(строка) (обязательный)
The name of the setting.
$setting_value(строка) (обязательный)
The values of the setting.
$setting_mapping(массив) (обязательный)
The mapping of the setting to Yoast formats.

Код Abstract_Aioseo_Settings_Importing_Action::import_single_setting() Yoast 22.4

protected function import_single_setting( $setting, $setting_value, $setting_mapping ) {
	$yoast_key = $setting_mapping['yoast_name'];

	// Check if we're supposed to save the setting.
	if ( $this->options->get_default( 'wpseo_titles', $yoast_key ) !== null ) {
		// Then, do any needed data transfomation before actually saving the incoming data.
		$transformed_data = \call_user_func( [ $this, $setting_mapping['transform_method'] ], $setting_value, $setting_mapping );

		$this->options->set( $yoast_key, $transformed_data );
	}
}