/** * Return an instance of the renderer class based on the type of the slide. * * @since 4.0.0 * * @param array $data The data of the slide. * @return object An instance of the appropriate renderer class. */ public static function create_slide($data) { if (is_null(self::$default_type)) { $default_settings = BQW_SliderPro_Settings::getSlideSettings(); self::$default_type = $default_settings['content_type']['default_value']; } $type = isset($data['settings']['content_type']) ? $data['settings']['content_type'] : self::$default_type; foreach (self::$registered_types as $registered_type_name => $registered_type_class) { if ($type === $registered_type_name) { return new $registered_type_class(); } } }
/** * Return the setting fields associated with the content type. * * If the content type is set to 'posts', the names of the * registered post types will be loaded. * * @since 4.0.0 * * @param string $type The slide's content type. * @param array $slide_settings The slide's settings. */ public function load_content_type_settings($type, $slide_settings = NULL) { $slide_default_settings = BQW_SliderPro_Settings::getSlideSettings(); if ($type === 'posts') { $post_names = $this->get_post_names(); include 'views/posts-slide-settings.php'; } else { if ($type === 'gallery') { include 'views/gallery-slide-settings.php'; } else { if ($type === 'flickr') { include 'views/flickr-slide-settings.php'; } else { include 'views/custom-slide-settings.php'; } } } }
/** * Initialize the renderer. * * @since 4.0.0 */ public function __construct() { parent::__construct(); $this->default_settings = BQW_SliderPro_Settings::getSlideSettings(); }