ngs keys for each widget. */ public function get_widgets_frontend_settings_keys() { $keys = []; foreach ( $this->get_widget_types() as $widget_type_name => $widget_type ) { $widget_type_keys = $widget_type->get_frontend_settings_keys(); if ( $widget_type_keys ) { $keys[ $widget_type_name ] = $widget_type_keys; } } return $keys; } /** * Widgets with styles. * * This method returns the list of all the widgets in the `/includes/` * folder that have styles. * * @since 3.24.0 * @access public * * @return array The names of the widgets that have styles. */ public function widgets_with_styles(): array { return [ 'counter', 'divider', 'google_maps', 'heading', 'image', 'image-carousel', 'menu-anchor', 'rating', 'social-icons', 'spacer', 'testimonial', 'text-editor', 'video', ]; } /** * Widgets with responsive styles. * * This method returns the list of all the widgets in the `/includes/` * folder that have responsive styles. * * @since 3.24.0 * @access public * * @return array The names of the widgets that have responsive styles. */ public function widgets_with_responsive_styles(): array { return [ 'accordion', 'alert', 'icon-box', 'icon-list', 'image-box', 'image-gallery', 'progress', 'star-rating', 'tabs', 'toggle', ]; } /** * Enqueue widgets scripts. * * Enqueue all the scripts defined as a dependency for each widget. * * @since 1.3.0 * @access public */ public function enqueue_widgets_scripts() { foreach ( $this->get_widget_types() as $widget ) { $widget->enqueue_scripts(); } } /** * Enqueue widgets styles * * Enqueue all the styles defined as a dependency for each widget * * @access public */ public function enqueue_widgets_styles() { foreach ( $this->get_widget_types() as $widget ) { $widget->enqueue_styles(); } } /** * Retrieve inline editing configuration. * * Returns general inline editing configurations like toolbar types etc. * * @access public * @since 1.8.0 * * @return array { * Inline editing configuration. * * @type array $toolbar { * Toolbar types and the actions each toolbar includes. * Note: Wysiwyg controls uses the advanced toolbar, textarea controls * uses the basic toolbar and text controls has no toolbar. * * @type array $basic Basic actions included in the edit tool. * @type array $advanced Advanced actions included in the edit tool. * } * } */ public function get_inline_editing_config() { $basic_tools = [ 'bold', 'underline', 'italic', ]; $advanced_tools = array_merge( $basic_tools, [ 'createlink', 'unlink', 'h1' => [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'blockquote', 'pre', ], 'list' => [ 'insertOrderedList', 'insertUnorderedList', ], ] ); return [ 'toolbar' => [ 'basic' => $basic_tools, 'advanced' => $advanced_tools, ], ]; } /** * Widgets manager constructor. * * Initializing Elementor widgets manager. * * @since 1.0.0 * @access public */ public function __construct() { $this->require_files(); add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] ); } /** * Register ajax actions. * * Add new actions to handle data after an ajax requests returned. * * @since 2.0.0 * @access public * * @param Ajax $ajax_manager */ public function register_ajax_actions( Ajax $ajax_manager ) { $ajax_manager->register_ajax_action( 'render_widget', [ $this, 'ajax_render_widget' ] ); $ajax_manager->register_ajax_action( 'editor_get_wp_widget_form', [ $this, 'ajax_get_wp_widget_form' ] ); $ajax_manager->register_ajax_action( 'get_widgets_config', [ $this, 'ajax_get_widget_types_controls_config' ] ); $ajax_manager->register_ajax_action( 'get_widgets_default_value_translations', function ( array $data ) { return $this->ajax_get_widgets_default_value_translations( $data ); } ); } /** * @param $experiment_name * @param $classes * @return void */ public function register_promoted_active_widgets( string $experiment_name, array $classes ) : void { if ( ! Plugin::$instance->experiments->is_feature_active( $experiment_name ) || empty( $classes ) ) { return; } foreach ( $classes as $class_name ) { $this->register( new $class_name() ); } } }