WP_Theme_JSON::get_svg_filters
Converts all filter (duotone) presets into SVGs.
Метод класса: WP_Theme_JSON{}
Хуков нет.
Возвращает
Строку. SVG filters.
Использование
$WP_Theme_JSON = new WP_Theme_JSON(); $WP_Theme_JSON->get_svg_filters( $origins );
- $origins(массив) (обязательный)
- List of origins to process.
Список изменений
| С версии 5.9.1 | Введена. |
Код WP_Theme_JSON::get_svg_filters() WP Theme JSON::get svg filters WP 7.0
public function get_svg_filters( $origins ) {
$blocks_metadata = static::get_blocks_metadata();
$setting_nodes = static::get_setting_nodes( $this->theme_json, $blocks_metadata );
$filters = '';
foreach ( $setting_nodes as $metadata ) {
$node = _wp_array_get( $this->theme_json, $metadata['path'], array() );
if ( empty( $node['color']['duotone'] ) ) {
continue;
}
$duotone_presets = $node['color']['duotone'];
foreach ( $origins as $origin ) {
if ( ! isset( $duotone_presets[ $origin ] ) ) {
continue;
}
foreach ( $duotone_presets[ $origin ] as $duotone_preset ) {
$filters .= WP_Duotone::get_filter_svg_from_preset( $duotone_preset );
}
}
}
return $filters;
}