* @copyright 2007-2022 Apollotheme * @license http://apollotheme.com - prestashop template provider */ namespace LeoElements; use LeoElements\Modules\DynamicTags\Module as TagsModule; use LeoElements\Leo_Helper; if ( ! defined( '_PS_VERSION_' ) ) { exit; // Exit if accessed directly. } /** * Elementor media control. * * A base control for creating a media chooser control. Based on the WordPress * media library. Used to select an image from the WordPress media library. * * @since 1.0.0 */ class Control_Media extends Control_Base_Multiple { /** * Get media control type. * * Retrieve the control type, in this case `media`. * * @since 1.0.0 * @access public * * @return string Control type. */ public function get_type() { return 'media'; } /** * Get media control default values. * * Retrieve the default value of the media control. Used to return the default * values while initializing the media control. * * @since 1.0.0 * @access public * * @return array Control default value. */ public function get_default_value() { return [ 'url' => '', 'id' => '', ]; } /** * Import media images. * * Used to import media control files from external sites while importing * Elementor template JSON file, and replacing the old data. * * @since 1.0.0 * @access public * * @param array $settings Control settings * * @return array Control settings. */ public function on_import( $settings ) { if ( empty( $settings['url'] ) ) { return $settings; } $settings = Plugin::$instance->templates_manager->get_import_images_instance()->import( $settings ); if ( ! $settings ) { $settings = [ 'id' => '', 'url' => Utils::get_placeholder_image_src(), ]; } return $settings; } /** * Enqueue media control scripts and styles. * * Used to register and enqueue custom scripts and styles used by the media * control. * * @since 1.0.0 * @access public */ public function enqueue() {} /** * Render media 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 1.0.0 * @access public */ public function content_template() { ?>