'',
'library' => '',
];
}
/**
* Render Icons control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 2.6.0
*/
public function contentTemplate()
{
?>
<# if ( 'inline' === data.skin ) { #>
renderInlineSkin(); ?>
<# } else { #>
renderMediaSkin(); ?>
<# } #>
getControlUid(); ?>
<# if ( data.description ) { #>
{{{ data.description }}}
<# } #>
true,
'dynamic' => [
'categories' => ['image'],
'returnType' => 'object',
],
'search_bar' => true,
'recommended' => false,
'skin' => 'media',
'exclude_inline_options' => [],
];
}
// public function supportSvgImport($mimes)
public function onImport($settings)
{
if (empty($settings['library']) || 'svg' !== $settings['library'] || empty($settings['value']['url'])) {
return $settings;
}
// add_filter('upload_mimes', [$this, 'supportSvgImport'], 100);
$imported = Plugin::$instance->templates_manager->getImportImagesInstance()->import($settings['value']);
// remove_filter('upload_mimes', [$this, 'supportSvgImport'], 100);
if (!$imported) {
$settings['value'] = '';
$settings['library'] = '';
} else {
$settings['value'] = $imported;
}
return $settings;
}
}