WP_REST_Font_Faces_Controller::get_settings_from_post
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 REST Font Faces Controller::get settings from post WP 6.9.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 );
}