WP_REST_Font_Faces_Controller::get_settings_from_post()protectedWP 6.5.0

Gets the font face's settings from the post.

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

Хуков нет.

Возвращает

Массив. Font face settings array.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_settings_from_post( $post );
$post(WP_Post) (обязательный)
Font face post object.

Список изменений

С версии 6.5.0 Введена.

Код WP_REST_Font_Faces_Controller::get_settings_from_post() WP 6.7.1

protected function get_settings_from_post( $post ) {
	$settings   = json_decode( $post->post_content, true );
	$properties = $this->get_item_schema()['properties']['font_face_settings']['properties'];

	// Provide required, empty settings if needed.
	if ( null === $settings ) {
		$settings = array(
			'fontFamily' => '',
			'src'        => array(),
		);
	}

	// Only return the properties defined in the schema.
	return array_intersect_key( $settings, $properties );
}