我有简单的古腾堡块和谷歌字体选择。
el (SelectControl,
{
value: fontFamily,
label: __('Шрифт'),
options: [
{
value: 'Georgia',
label: 'Georgia'
},
{
value: 'PT Sans',
label: 'PT Sans'
},
{
value: 'Amatic SC',
label: 'Amatic SC'
},
],
onChange: onChangefontFamily,
},),
php:
function google_fonts_url() {
$fonts_url = '';
$font_families = array();
$font_families[] = 'Amatic SC|PT Sans:400,400i';
$query_args = array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,cyrillic' ),
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
return $fonts_url; }
我只需要从谷歌加载选定的字体。
如何从选择中获取 val ?