Automattic\WooCommerce\Internal\Admin\Onboarding
OnboardingFonts::install_font_faces()
Install font faces.
Метод класса: OnboardingFonts{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$result = OnboardingFonts::install_font_faces( $slug_font_families_to_install, $installed_font_families, $font_faces_from_collection );
- $slug_font_families_to_install(массив) (обязательный)
- Font families to install.
- $installed_font_families(массив) (обязательный)
- Installed font families.
- $font_faces_from_collection(массив) (обязательный)
- Font faces from collection.
Код OnboardingFonts::install_font_faces() OnboardingFonts::install font faces WC 9.5.1
private static function install_font_faces( $slug_font_families_to_install, $installed_font_families, $font_faces_from_collection ) { foreach ( $slug_font_families_to_install as $slug ) { $font_family = $installed_font_families[ $slug ]; $font_faces = $font_faces_from_collection[ $slug ]; $font_faces_to_install = self::FONT_FAMILIES_TO_INSTALL[ $slug ]['fontWeights']; foreach ( $font_faces as $font_face ) { if ( ! in_array( $font_face['fontWeight'], $font_faces_to_install, true ) ) { continue; } $slug = \WP_Font_Utils::get_font_face_slug( $font_face ); $font_face_installed = FontFace::get_installed_font_faces_by_slug( $slug ); if ( $font_face_installed ) { continue; } $wp_error = FontFace::insert_font_face( $font_face, $font_family->ID ); if ( is_wp_error( $wp_error ) ) { wc_get_logger()->error( sprintf( /* translators: %s: error message */ __( 'Font Face installation error: %s', 'woocommerce' ), $wp_error->get_error_message() ), array( 'source' => self::SOURCE_LOGGER ) ); } } } }