Файловый менеджер - Редактировать - /home/freeclou/app.optimyar.com/front-web/build/assets/resources/agGrid/modules.tar
Назад
ajax/module.php 0000755 00000015615 15111605150 0007473 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Ajax; use Elementor\Core\Base\Module as BaseModule; use Elementor\Core\Utils\Exceptions; use Elementor\Plugin; use Elementor\Utils; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Elementor ajax manager. * * Elementor ajax manager handler class is responsible for handling Elementor * ajax requests, ajax responses and registering actions applied on them. * * @since 2.0.0 */ class Module extends BaseModule { const NONCE_KEY = 'elementor_ajax'; /** * Ajax actions. * * Holds all the register ajax action. * * @since 2.0.0 * @access private * * @var array */ private $ajax_actions = []; /** * Ajax requests. * * Holds all the register ajax requests. * * @since 2.0.0 * @access private * * @var array */ private $requests = []; /** * Ajax response data. * * Holds all the response data for all the ajax requests. * * @since 2.0.0 * @access private * * @var array */ private $response_data = []; /** * Current ajax action ID. * * Holds all the ID for the current ajax action. * * @since 2.0.0 * @access private * * @var string|null */ private $current_action_id = null; /** * Ajax manager constructor. * * Initializing Elementor ajax manager. * * @since 2.0.0 * @access public */ public function __construct() { add_action( 'wp_ajax_elementor_ajax', [ $this, 'handle_ajax_request' ] ); } /** * Get module name. * * Retrieve the module name. * * @since 1.7.0 * @access public * * @return string Module name. */ public function get_name() { return 'ajax'; } /** * Register ajax action. * * Add new actions for a specific ajax request and the callback function to * be handle the response. * * @since 2.0.0 * @access public * * @param string $tag Ajax request name/tag. * @param callable $callback The callback function. */ public function register_ajax_action( $tag, $callback ) { if ( ! did_action( 'elementor/ajax/register_actions' ) ) { _doing_it_wrong( __METHOD__, esc_html( sprintf( 'Use `%s` hook to register ajax action.', 'elementor/ajax/register_actions' ) ), '2.0.0' ); } $this->ajax_actions[ $tag ] = compact( 'tag', 'callback' ); } /** * Handle ajax request. * * Verify ajax nonce, and run all the registered actions for this request. * * Fired by `wp_ajax_elementor_ajax` action. * * @since 2.0.0 * @access public */ public function handle_ajax_request() { if ( ! $this->verify_request_nonce() ) { $this->add_response_data( false, esc_html__( 'Token Expired.', 'elementor' ) ) ->send_error( Exceptions::UNAUTHORIZED ); } $editor_post_id = 0; if ( ! empty( $_REQUEST['editor_post_id'] ) ) { $editor_post_id = absint( $_REQUEST['editor_post_id'] ); Plugin::$instance->db->switch_to_post( $editor_post_id ); } /** * Register ajax actions. * * Fires when an ajax request is received and verified. * * Used to register new ajax action handles. * * @since 2.0.0 * * @param self $this An instance of ajax manager. */ do_action( 'elementor/ajax/register_actions', $this ); if ( ! empty( $_REQUEST['actions'] ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, each action should sanitize its own data. $this->requests = json_decode( wp_unslash( $_REQUEST['actions'] ), true ); } foreach ( $this->requests as $id => $action_data ) { $this->current_action_id = $id; if ( ! isset( $this->ajax_actions[ $action_data['action'] ] ) ) { $this->add_response_data( false, esc_html__( 'Action not found.', 'elementor' ), Exceptions::BAD_REQUEST ); continue; } if ( $editor_post_id ) { $action_data['data']['editor_post_id'] = $editor_post_id; } try { $data = $action_data['data'] ?? []; $results = call_user_func( $this->ajax_actions[ $action_data['action'] ]['callback'], $data, $this ); if ( false === $results ) { $this->add_response_data( false ); } else { $this->add_response_data( true, $results ); } } catch ( \Exception $e ) { $this->add_response_data( false, $e->getMessage(), $e->getCode() ); } } $this->current_action_id = null; $this->send_success(); } /** * Get current action data. * * Retrieve the data for the current ajax request. * * @since 2.0.1 * @access public * * @return bool|mixed Ajax request data if action exist, False otherwise. */ public function get_current_action_data() { if ( ! $this->current_action_id ) { return false; } return $this->requests[ $this->current_action_id ]; } /** * Create nonce. * * Creates a cryptographic token to * give the user an access to Elementor ajax actions. * * @since 2.3.0 * @access public * * @return string The nonce token. */ public function create_nonce() { return wp_create_nonce( self::NONCE_KEY ); } /** * Verify request nonce. * * Whether the request nonce verified or not. * * @since 2.3.0 * @access public * * @return bool True if request nonce verified, False otherwise. */ public function verify_request_nonce() { return wp_verify_nonce( Utils::get_super_global_value( $_REQUEST, '_nonce' ), self::NONCE_KEY ); } protected function get_init_settings() { return [ 'url' => admin_url( 'admin-ajax.php' ), 'nonce' => $this->create_nonce(), ]; } /** * Ajax success response. * * Send a JSON response data back to the ajax request, indicating success. * * @since 2.0.0 * @access protected */ private function send_success() { $response = [ 'success' => true, 'data' => [ 'responses' => $this->response_data, ], ]; $json = wp_json_encode( $response ); while ( ob_get_status() ) { ob_end_clean(); } header( 'Content-Type: application/json; charset=UTF-8' ); echo $json; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped wp_die( '', '', [ 'response' => null ] ); } /** * Ajax failure response. * * Send a JSON response data back to the ajax request, indicating failure. * * @since 2.0.0 * @access protected * * @param null $code */ private function send_error( $code = null ) { wp_send_json_error( [ 'responses' => $this->response_data, ], $code ); } /** * Add response data. * * Add new response data to the array of all the ajax requests. * * @since 2.0.0 * @access protected * * @param bool $success True if the requests returned successfully, False * otherwise. * @param mixed $data Optional. Response data. Default is null. * * @param int $code Optional. Response code. Default is 200. * * @return Module An instance of ajax manager. */ private function add_response_data( $success, $data = null, $code = 200 ) { $this->response_data[ $this->current_action_id ] = [ 'success' => $success, 'code' => $code, 'data' => $data, ]; return $this; } } connect/apps/base-app.php 0000755 00000051057 15111605150 0011347 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Connect\Apps; use Elementor\Core\Admin\Admin_Notices; use Elementor\Core\Common\Modules\Connect\Admin; use Elementor\Core\Utils\Collection; use Elementor\Core\Utils\Http; use Elementor\Core\Utils\Str; use Elementor\Plugin; use Elementor\Tracker; use Elementor\Utils; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } abstract class Base_App { const OPTION_NAME_PREFIX = 'elementor_connect_'; const OPTION_CONNECT_SITE_KEY = self::OPTION_NAME_PREFIX . 'site_key'; const SITE_URL = 'https://my.elementor.com/connect/v1'; const API_URL = 'https://my.elementor.com/api/connect/v1'; const HTTP_RETURN_TYPE_OBJECT = 'object'; const HTTP_RETURN_TYPE_ARRAY = 'array'; protected $data = []; protected $auth_mode = ''; /** * @var Http */ protected $http; /** * @since 2.3.0 * @access protected * @abstract * TODO: make it public. */ abstract protected function get_slug(); /** * @since 2.8.0 * @access public * TODO: make it abstract. */ public function get_title() { return $this->get_slug(); } /** * @since 2.3.0 * @access protected * @abstract */ abstract protected function update_settings(); /** * @since 2.3.0 * @access public * @static */ public static function get_class_name() { return get_called_class(); } /** * @access public * @abstract */ public function render_admin_widget() { // PHPCS - the method get_title return a plain string. echo '<h2>' . $this->get_title() . '</h2>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped if ( $this->is_connected() ) { $remote_user = $this->get( 'user' ); $title = sprintf( /* translators: %s: Remote user. */ esc_html__( 'Connected as %s', 'elementor' ), '<strong>' . esc_html( $remote_user->email ) . '</strong>' ); $label = esc_html__( 'Disconnect', 'elementor' ); $url = $this->get_admin_url( 'disconnect' ); $attr = ''; printf( '%s <a %s href="%s">%s</a>', // PHPCS - the variable $title is already escaped above. $title, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped // PHPCS - the variable $attr is a plain string. $attr, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped esc_attr( $url ), esc_html( $label ) ); } else { echo 'Not Connected'; } echo '<hr>'; $this->print_app_info(); if ( current_user_can( 'manage_options' ) ) { printf( '<div><a href="%s">%s</a></div>', esc_url( $this->get_admin_url( 'reset' ) ), esc_html__( 'Reset Data', 'elementor' ) ); } echo '<hr>'; } /** * @since 2.3.0 * @access protected */ protected function get_option_name() { return static::OPTION_NAME_PREFIX . $this->get_slug(); } /** * @since 2.3.0 * @access public */ public function admin_notice() { $notices = $this->get( 'notices' ); if ( ! $notices ) { return; } $this->print_notices( $notices ); $this->delete( 'notices' ); } public function get_app_token_from_cli_token( $cli_token ) { $response = $this->request( 'get_app_token_from_cli_token', [ 'cli_token' => $cli_token, ] ); if ( is_wp_error( $response ) ) { // PHPCS - the variable $response does not contain a user input value. wp_die( $response, $response->get_error_message() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } // Use state as usual. $_REQUEST['state'] = $this->get( 'state' ); $_REQUEST['code'] = $response->code; } /** * @since 2.3.0 * @access public */ public function action_authorize() { if ( $this->is_connected() ) { $this->add_notice( esc_html__( 'Already connected.', 'elementor' ), 'info' ); $this->redirect_to_admin_page(); return; } $this->set_client_id(); $this->set_request_state(); $this->redirect_to_remote_authorize_url(); } public function action_reset() { $this->redirect_to_admin_page(); } /** * @since 2.3.0 * @access public */ public function action_get_token() { if ( $this->is_connected() ) { $this->redirect_to_admin_page(); } //phpcs:ignore WordPress.Security.NonceVerification.Recommended - The user as been authorized before in 'connect'. $state = Utils::get_super_global_value( $_REQUEST, 'state' ); if ( $state !== $this->get( 'state' ) ) { $this->add_notice( 'Get Token: Invalid Request.', 'error' ); $this->redirect_to_admin_page(); } $response = $this->request( 'get_token', [ 'grant_type' => 'authorization_code', 'code' => Utils::get_super_global_value( $_REQUEST, 'code' ), //phpcs:ignore WordPress.Security.NonceVerification.Recommended 'redirect_uri' => rawurlencode( $this->get_admin_url( 'get_token' ) ), 'client_id' => $this->get( 'client_id' ), ] ); if ( is_wp_error( $response ) ) { $notice = 'Cannot Get Token:' . $response->get_error_message(); $this->add_notice( $notice, 'error' ); $this->redirect_to_admin_page(); } $this->delete( 'state' ); $this->set( (array) $response ); if ( ! empty( $response->data_share_opted_in ) && current_user_can( 'manage_options' ) ) { Tracker::set_opt_in( true ); } $this->after_connect(); // Add the notice *after* the method `after_connect`, so an app can redirect without the notice. $this->add_notice( esc_html__( 'Connected successfully.', 'elementor' ) ); $this->redirect_to_admin_page(); } /** * @since 2.3.0 * @access public */ public function action_disconnect() { if ( $this->is_connected() ) { $this->disconnect(); $this->add_notice( esc_html__( 'Disconnected successfully.', 'elementor' ) ); } $this->redirect_to_admin_page(); } /** * @since 2.8.0 * @access public */ public function action_reconnect() { $this->disconnect(); $this->action_authorize(); } /** * @since 2.3.0 * @access public */ public function get_admin_url( $action, $params = [] ) { $params = [ 'app' => $this->get_slug(), 'action' => $action, 'nonce' => wp_create_nonce( $this->get_slug() . $action ), ] + $params; $admin_url = Str::encode_idn_url( get_admin_url() ); $admin_url .= 'admin.php?page=' . Admin::PAGE_ID; return add_query_arg( $params, $admin_url ); } /** * @since 2.3.0 * @access public */ public function is_connected() { return (bool) $this->get( 'access_token' ); } /** * @since 2.3.0 * @access protected */ protected function init() {} /** * @since 2.3.0 * @access protected */ protected function init_data() {} /** * @since 2.3.0 * @access protected */ protected function after_connect() {} /** * @since 2.3.0 * @access public */ public function get( $key, $default_value = null ) { $this->init_data(); return isset( $this->data[ $key ] ) ? $this->data[ $key ] : $default_value; } /** * @since 2.3.0 * @access protected */ protected function set( $key, $value = null ) { $this->init_data(); if ( is_array( $key ) ) { $this->data = array_replace_recursive( $this->data, $key ); } else { $this->data[ $key ] = $value; } $this->update_settings(); } /** * @since 2.3.0 * @access protected */ protected function delete( $key = null ) { $this->init_data(); if ( $key ) { unset( $this->data[ $key ] ); } else { $this->data = []; } $this->update_settings(); } /** * @since 2.3.0 * @access protected */ protected function add( $key, $value, $default_value = '' ) { $new_value = $this->get( $key, $default_value ); if ( is_array( $new_value ) ) { $new_value[] = $value; } elseif ( is_string( $new_value ) ) { $new_value .= $value; } elseif ( is_numeric( $new_value ) ) { $new_value += $value; } $this->set( $key, $new_value ); } /** * @since 2.3.0 * @access protected */ protected function add_notice( $content, $type = 'success' ) { $this->add( 'notices', compact( 'content', 'type' ), [] ); } /** * @param $action * @param array $request_body * @param false $as_array * * @return mixed|\WP_Error */ protected function request( $action, $request_body = [], $as_array = false ) { $request_body = $this->get_connect_info() + $request_body; return $this->http_request( 'POST', $action, [ 'timeout' => 25, 'body' => $request_body, 'headers' => $this->is_connected() ? [ 'X-Elementor-Signature' => $this->generate_signature( $request_body ) ] : [], ], [ 'return_type' => $as_array ? static::HTTP_RETURN_TYPE_ARRAY : static::HTTP_RETURN_TYPE_OBJECT, ] ); } /** * Get Base Connect Info * * Returns an array of connect info. * * @return array */ protected function get_base_connect_info() { return [ 'app' => $this->get_slug(), 'access_token' => $this->get( 'access_token' ), 'client_id' => $this->get( 'client_id' ), 'local_id' => get_current_user_id(), 'site_key' => $this->get_site_key(), 'home_url' => trailingslashit( home_url() ), ]; } /** * Get all the connect information * * @return array */ protected function get_connect_info() { $connect_info = $this->get_base_connect_info(); $additional_info = []; /** * Additional connect info. * * Filters the connection information when connecting to Elementor servers. * This hook can be used to add more information or add more data. * * @param array $additional_info Additional connecting information array. * @param Base_App $this The base app instance. */ $additional_info = apply_filters( 'elementor/connect/additional-connect-info', $additional_info, $this ); return array_merge( $connect_info, $additional_info ); } /** * @param $endpoint * * @return array */ protected function generate_authentication_headers( $endpoint ) { $connect_info = ( new Collection( $this->get_connect_info() ) ) ->map_with_keys( function ( $value, $key ) { // For bc `get_connect_info` returns the connect info with underscore, // headers with underscore are not valid, so all the keys with underscore will be replaced to hyphen. return [ str_replace( '_', '-', $key ) => $value ]; } ) ->replace_recursive( [ 'endpoint' => $endpoint ] ) ->sort_keys(); return $connect_info ->merge( [ 'X-Elementor-Signature' => $this->generate_signature( $connect_info->all() ) ] ) ->all(); } /** * Send an http request * * @param $method * @param $endpoint * @param array $args * @param array $options * * @return mixed|\WP_Error */ protected function http_request( $method, $endpoint, $args = [], $options = [] ) { $options = wp_parse_args( $options, [ 'return_type' => static::HTTP_RETURN_TYPE_OBJECT, ] ); $args = array_replace_recursive( [ 'headers' => $this->is_connected() ? $this->generate_authentication_headers( $endpoint ) : [], 'method' => $method, 'timeout' => 10, ], $args ); $response = $this->http->request_with_fallback( $this->get_generated_urls( $endpoint ), $args ); if ( is_wp_error( $response ) && empty( $options['with_error_data'] ) ) { // PHPCS - the variable $response does not contain a user input value. wp_die( $response, [ 'back_link' => true ] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } $body = wp_remote_retrieve_body( $response ); $response_code = (int) wp_remote_retrieve_response_code( $response ); if ( ! $response_code ) { return new \WP_Error( 500, 'No Response' ); } // Server sent a success message without content. if ( 'null' === $body ) { $body = true; } $body = json_decode( $body, static::HTTP_RETURN_TYPE_ARRAY === $options['return_type'] ); if ( false === $body ) { return new \WP_Error( 422, 'Wrong Server Response' ); } if ( 201 === $response_code ) { return $body; } if ( 200 !== $response_code ) { // In case $as_array = true. $body = (object) $body; $message = isset( $body->message ) ? $body->message : wp_remote_retrieve_response_message( $response ); $code = (int) ( isset( $body->code ) ? $body->code : $response_code ); if ( ! $code ) { $code = $response_code; } if ( 401 === $code ) { $this->delete(); $should_retry = ! in_array( $this->auth_mode, [ 'xhr', 'cli' ], true ); if ( $should_retry ) { $this->action_authorize(); } } if ( isset( $options['with_error_data'] ) && true === $options['with_error_data'] ) { return new \WP_Error( $code, $message, $body ); } return new \WP_Error( $code, $message ); } return $body; } /** * Create a signature for the http request * * @param array $payload * * @return false|string */ private function generate_signature( $payload = [] ) { return hash_hmac( 'sha256', wp_json_encode( $payload, JSON_NUMERIC_CHECK ), $this->get( 'access_token_secret' ) ); } /** * @since 2.3.0 * @access protected */ protected function get_api_url() { return static::API_URL . '/' . $this->get_slug(); } /** * @since 2.3.0 * @access protected */ protected function get_remote_site_url() { return static::SITE_URL . '/' . $this->get_slug(); } /** * @since 2.3.0 * @access protected */ protected function get_remote_authorize_url() { $redirect_uri = $this->get_auth_redirect_uri(); $allowed_query_params_to_propagate = [ 'utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'source', 'screen_hint', ]; $query_params = ( new Collection( $_GET ) ) // phpcs:ignore ->only( $allowed_query_params_to_propagate ) ->merge( [ 'action' => 'authorize', 'response_type' => 'code', 'client_id' => $this->get( 'client_id' ), 'auth_secret' => $this->get( 'auth_secret' ), 'state' => $this->get( 'state' ), 'redirect_uri' => rawurlencode( $redirect_uri ), 'may_share_data' => current_user_can( 'manage_options' ) && ! Tracker::is_allow_track(), 'reconnect_nonce' => wp_create_nonce( $this->get_slug() . 'reconnect' ), ] ); $utm_campaign = get_transient( 'elementor_core_campaign' ); if ( ! empty( $utm_campaign ) ) { foreach ( [ 'source', 'medium', 'campaign' ] as $key ) { if ( ! empty( $utm_campaign[ $key ] ) ) { $query_params->offsetSet( 'utm_' . $key, $utm_campaign[ $key ] ); } } } return add_query_arg( $query_params->all(), $this->get_remote_site_url() ); } /** * @since 2.3.0 * @access protected */ protected function redirect_to_admin_page( $url = '' ) { if ( ! $url ) { $url = Admin::$url; } switch ( $this->auth_mode ) { case 'popup': $this->print_popup_close_script( $url ); break; case 'cli': case 'rest': $this->admin_notice(); die; default: wp_safe_redirect( $url ); die; } } /** * @since 2.3.0 * @access protected */ protected function set_client_id() { $source = Utils::get_super_global_value( $_REQUEST, 'source' ) ?? ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verification is not required here. $response = $this->request( 'get_client_id', [ 'source' => esc_attr( $source ), ] ); if ( is_wp_error( $response ) ) { // PHPCS - the variable $response does not contain a user input value. wp_die( $response, $response->get_error_message() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } $this->set( 'client_id', $response->client_id ); $this->set( 'auth_secret', $response->auth_secret ); } /** * @since 2.3.0 * @access protected */ protected function set_request_state() { $this->set( 'state', wp_generate_password( 12, false ) ); } protected function get_popup_success_event_data() { return []; } /** * @since 2.3.0 * @access protected */ protected function print_popup_close_script( $url ) { $data = $this->get_popup_success_event_data(); ?> <script> if ( opener && opener !== window ) { opener.jQuery( 'body' ).trigger( 'elementor/connect/success/<?php echo esc_attr( Utils::get_super_global_value( $_REQUEST, 'callback_id' ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verification is not required here. ?>', <?php echo wp_json_encode( $data ); ?> ); opener.dispatchEvent( new CustomEvent( 'elementor/connect/success' ), <?php echo wp_json_encode( $data ); ?> ); window.close(); opener.focus(); } else { location = '<?php echo esc_url( $url ); ?>'; } </script> <?php die; } /** * @since 2.3.0 * @access protected */ protected function disconnect() { if ( $this->is_connected() ) { // Try update the server, but not needed to handle errors. $this->request( 'disconnect' ); } $this->delete(); } /** * @since 2.3.0 * @access protected */ public function get_site_key() { $site_key = get_option( static::OPTION_CONNECT_SITE_KEY ); if ( ! $site_key ) { $site_key = md5( uniqid( wp_generate_password() ) ); update_option( static::OPTION_CONNECT_SITE_KEY, $site_key ); } return $site_key; } protected function redirect_to_remote_authorize_url() { switch ( $this->auth_mode ) { case 'cli': case 'rest': $this->get_app_token_from_cli_token( Utils::get_super_global_value( $_REQUEST, 'token' ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verification is not required here. return; default: wp_redirect( $this->get_remote_authorize_url() ); //phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- Safe redirect is used here. die; } } protected function get_auth_redirect_uri() { $redirect_uri = $this->get_admin_url( 'get_token' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verification is not required here. $val = Utils::get_super_global_value( $_REQUEST, 'redirect_to' ); if ( $val ) { $redirect_uri = add_query_arg( [ 'redirect_to' => $val ], $redirect_uri ); } switch ( $this->auth_mode ) { case 'popup': $redirect_uri = add_query_arg( [ 'mode' => 'popup', 'callback_id' => esc_attr( Utils::get_super_global_value( $_REQUEST, 'callback_id' ) ), //phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verification is not required here. ], $redirect_uri ); break; } return $redirect_uri; } protected function print_notices( $notices ) { switch ( $this->auth_mode ) { case 'cli': foreach ( $notices as $notice ) { printf( '[%s] %s', wp_kses_post( $notice['type'] ), wp_kses_post( $notice['content'] ) ); } break; case 'rest': // After `wp_send_json` the script will die. $this->delete( 'notices' ); wp_send_json( $notices ); break; default: /** * @var Admin_Notices $admin_notices */ $admin_notices = Plugin::$instance->admin->get_component( 'admin-notices' ); foreach ( $notices as $notice ) { $options = [ 'description' => wp_kses_post( wpautop( $notice['content'] ) ), 'type' => $notice['type'], 'icon' => false, ]; $admin_notices->print_admin_notice( $options ); } } } protected function get_app_info() { return []; } protected function print_app_info() { $app_info = $this->get_app_info(); foreach ( $app_info as $key => $item ) { if ( $item['value'] ) { $status = 'Exist'; $color = 'green'; } else { $status = 'Empty'; $color = 'red'; } // PHPCS - the values of $item['label'], $color, $status are plain strings. printf( '%s: <strong style="color:%s">%s</strong><br>', $item['label'], $color, $status ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } private function get_generated_urls( $endpoint ) { $base_urls = $this->get_api_url(); if ( ! is_array( $base_urls ) ) { $base_urls = [ $base_urls ]; } return array_map( function ( $base_url ) use ( $endpoint ) { return trailingslashit( $base_url ) . $endpoint; }, $base_urls ); } private function init_auth_mode() { $is_rest = defined( 'REST_REQUEST' ) && REST_REQUEST; $is_ajax = wp_doing_ajax(); if ( $is_rest || $is_ajax ) { // Set default to 'xhr' if rest or ajax request. $this->set_auth_mode( 'xhr' ); } $mode = Utils::get_super_global_value( $_REQUEST, 'mode' ); if ( $mode ) { $allowed_auth_modes = [ 'popup', ]; if ( defined( 'WP_CLI' ) && WP_CLI ) { $allowed_auth_modes[] = 'cli'; } if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) { $allowed_auth_modes[] = 'rest'; } if ( in_array( $mode, $allowed_auth_modes, true ) ) { $this->set_auth_mode( $mode ); } } } public function set_auth_mode( $mode ) { $this->auth_mode = $mode; } /** * @since 2.3.0 * @access public */ public function __construct() { add_action( 'admin_notices', [ $this, 'admin_notice' ] ); $this->init_auth_mode(); $this->http = new Http(); /** * Allow extended apps to customize the __construct without call parent::__construct. */ $this->init(); } } connect/apps/base-user-app.php 0000755 00000001061 15111605150 0012311 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Connect\Apps; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } abstract class Base_User_App extends Base_App { /** * @since 2.3.0 * @access protected */ protected function update_settings() { update_user_option( get_current_user_id(), $this->get_option_name(), $this->data ); } /** * @since 2.3.0 * @access protected */ protected function init_data() { $this->data = get_user_option( $this->get_option_name() ); if ( ! $this->data ) { $this->data = []; } } } connect/apps/common-app.php 0000755 00000001614 15111605150 0011717 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Connect\Apps; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } abstract class Common_App extends Base_User_App { const OPTION_CONNECT_COMMON_DATA_KEY = self::OPTION_NAME_PREFIX . 'common_data'; protected static $common_data = null; /** * @since 2.3.0 * @access public */ public function get_option_name() { return static::OPTION_NAME_PREFIX . 'common_data'; } /** * @since 2.3.0 * @access protected */ protected function init_data() { if ( is_null( self::$common_data ) ) { self::$common_data = get_user_option( static::get_option_name() ); if ( ! self::$common_data ) { self::$common_data = []; } } $this->data = & self::$common_data; } public function action_reset() { delete_user_option( get_current_user_id(), static::OPTION_CONNECT_COMMON_DATA_KEY ); parent::action_reset(); } } connect/apps/connect.php 0000755 00000000674 15111605150 0011307 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Connect\Apps; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Connect extends Common_App { public function get_title() { return esc_html__( 'Connect', 'elementor' ); } /** * @since 2.3.0 * @access public */ protected function get_slug() { return 'connect'; } /** * @since 2.3.0 * @access public */ public function render_admin_widget() {} } connect/apps/library.php 0000755 00000011104 15111605150 0011310 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Connect\Apps; use Elementor\Api; use Elementor\User; use Elementor\Plugin; use Elementor\Core\Common\Modules\Connect\Module as ConnectModule; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Library extends Common_App { public function get_title() { return esc_html__( 'Library', 'elementor' ); } /** * @since 2.3.0 * @access protected */ protected function get_slug() { return 'library'; } public function get_template_content( $id ) { if ( ! $this->is_connected() ) { return new \WP_Error( '401', esc_html__( 'Connecting to the Library failed. Please try reloading the page and try again', 'elementor' ) ); } $body_args = [ 'id' => $id, // Which API version is used. 'api_version' => ELEMENTOR_VERSION, // Which language to return. 'site_lang' => get_bloginfo( 'language' ), ]; /** * API: Template body args. * * Filters the body arguments send with the GET request when fetching the content. * * @since 1.0.0 * * @param array $body_args Body arguments. */ $body_args = apply_filters( 'elementor/api/get_templates/body_args', $body_args ); $template_content = $this->request( 'get_template_content', $body_args, true ); if ( is_wp_error( $template_content ) && 401 === $template_content->get_error_code() ) { // Normalize 401 message return new \WP_Error( 401, esc_html__( 'Connecting to the Library failed. Please try reloading the page and try again', 'elementor' ) ); } return $template_content; } public function localize_settings( $settings ) { $is_connected = $this->is_connected(); /** @var ConnectModule $connect */ $connect = Plugin::$instance->common->get_component( 'connect' ); $user_id = $this->get_user_id(); return array_replace_recursive( $settings, [ 'library_connect' => [ 'is_connected' => $is_connected, 'user_id' => $user_id, 'subscription_plans' => $connect->get_subscription_plans( 'template-library' ), // TODO: Remove `base_access_level`. 'base_access_level' => ConnectModule::ACCESS_LEVEL_CORE, 'base_access_tier' => ConnectModule::ACCESS_TIER_FREE, 'current_access_level' => ConnectModule::ACCESS_LEVEL_CORE, 'current_access_tier' => ConnectModule::ACCESS_TIER_FREE, 'plan_type' => ConnectModule::ACCESS_TIER_FREE, ], ] ); } public function library_connect_popup_seen() { User::set_introduction_viewed( [ 'introductionKey' => 'library_connect', ] ); } /** * @param \Elementor\Core\Common\Modules\Ajax\Module $ajax_manager */ public function register_ajax_actions( $ajax_manager ) { $ajax_manager->register_ajax_action( 'library_connect_popup_seen', [ $this, 'library_connect_popup_seen' ] ); } private function get_user_id() { $token = $this->get( 'access_token' ); if ( ! is_string( $token ) ) { return null; } $parts = explode( '.', $token ); if ( count( $parts ) !== 3 ) { return null; } try { $payload_encoded = $parts[1]; $payload_encoded = str_pad( $payload_encoded, strlen( $payload_encoded ) + ( 4 - strlen( $payload_encoded ) % 4 ) % 4, '=' ); $payload_json = base64_decode( strtr( $payload_encoded, '-_', '+/' ), true ); $payload = json_decode( $payload_json, true ); if ( ! isset( $payload['sub'] ) ) { return null; } return $payload['sub']; } catch ( Exception $e ) { error_log( 'JWT Decoding Error: ' . $e->getMessage() ); return null; } } /** * After Connect * * After Connecting to the library, re-fetch the library data to get it up to date. * * @since 3.7.0 */ protected function after_connect() { Api::get_library_data( true ); } protected function get_app_info() { return [ 'user_common_data' => [ 'label' => 'User Common Data', 'value' => get_user_option( $this->get_option_name(), get_current_user_id() ), ], 'connect_site_key' => [ 'label' => 'Site Key', 'value' => get_option( self::OPTION_CONNECT_SITE_KEY ), ], ]; } protected function get_popup_success_event_data() { return [ 'access_level' => ConnectModule::ACCESS_LEVEL_CORE, 'access_tier' => ConnectModule::ACCESS_TIER_FREE, 'plan_type' => ConnectModule::ACCESS_TIER_FREE, 'tracking_opted_in' => $this->get( 'data_share_opted_in' ) ?? false, 'user_id' => $this->get_user_id(), ]; } protected function init() { add_filter( 'elementor/editor/localize_settings', [ $this, 'localize_settings' ] ); add_filter( 'elementor/common/localize_settings', [ $this, 'localize_settings' ] ); add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] ); } } connect/rest/readme.md 0000755 00000004524 15111605150 0010734 0 ustar 00 # Elementor Library Connect REST API This module provides REST API endpoints for connecting and disconnecting your WordPress site to the Elementor Library, similar in purpose to the [Elementor CLI Library Connect command](https://developers.elementor.com/docs/cli/library-connect/). ## Overview The REST API allows programmatic connection and disconnection to the Elementor Library, which is useful for automation, integrations, and testing. **Note:** The REST API is intended for internal and advanced use, mirroring the functionality of the CLI command. ## Endpoints ### 1. Connect to Elementor Library - **URL:** `/index.php?rest_route=/elementor/v1/library/connect` - **Method:** `POST` - **Permissions:** Requires the `manage_options` capability (typically administrators). - **Body Parameters:** - `token` (string, required): The connect token from your Elementor account dashboard. #### Example Request ```http POST /index.php?rest_route=/elementor/v1/library/connect Content-Type: application/json Authorization: Basic {{encoded_wp_credentials}} { "token": "YOUR_CLI_TOKEN" } ``` #### Example Success Response ```json { "success": true, "message": "Connected successfully." } ``` #### Example Error Response ```json { "code": "elementor_library_not_connected", "message": "Failed to connect to Elementor Library.", "data": { "status": 500 } } ``` --- ### 2. Disconnect from Elementor Library - **URL:** `/index.php?rest_route=/elementor/v1/library/connect` - **Method:** `DELETE` - **Permissions:** Requires the `manage_options` capability. #### Example Request ```http DELETE /index.php?rest_route=/elementor/v1/library/connect Authorization: Basic {{encoded_wp_credentials}} ``` #### Example Success Response ```json { "success": true, "message": "Disconnected successfully." } ``` #### Example Error Response ```json { "code": "elementor_library_disconnect_error", "message": "Error message here", "data": { "status": 500 } } ``` --- ## Permissions All endpoints require the user to have the `manage_options` capability. ## Error Handling Errors are returned as standard WordPress REST API error objects, with a `code`, `message`, and HTTP status. ## Reference - For CLI usage and more context, see the [Elementor CLI Library Connect documentation](https://developers.elementor.com/docs/cli/library-connect/). connect/rest/rest-api.php 0000755 00000010230 15111605150 0011401 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Connect\Rest; use Elementor\Plugin; use WP_Http; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Elementor Library Connect REST API. * * REST API controller for handling library connect operations. */ class Rest_Api { /** * REST API namespace. */ const REST_NAMESPACE = 'elementor/v1'; /** * REST API base. */ const REST_BASE = 'library'; /** * Authentication mode. */ const AUTH_MODE = 'rest'; /** * Register REST API routes. * * @access public * @return void */ public function register_routes() { register_rest_route( self::REST_NAMESPACE, self::REST_BASE . '/connect', [ [ 'methods' => \WP_REST_Server::CREATABLE, 'callback' => [ $this, 'connect' ], 'permission_callback' => [ $this, 'connect_permissions_check' ], 'args' => [ 'token' => [ 'required' => true, 'type' => 'string', 'description' => 'Connect CLI token', ], ], ], ] ); register_rest_route( self::REST_NAMESPACE, self::REST_BASE . '/connect', [ [ 'methods' => \WP_REST_Server::DELETABLE, 'callback' => [ $this, 'disconnect' ], 'permission_callback' => [ $this, 'connect_permissions_check' ], ], ] ); } public function connect( \WP_REST_Request $request ) { $app = $this->get_connect_app(); if ( ! $app ) { return $this->elementor_library_app_not_available(); } $app->set_auth_mode( self::AUTH_MODE ); $_REQUEST['mode'] = self::AUTH_MODE; $_REQUEST['token'] = $request->get_param( 'token' ); try { $app->action_authorize(); $app->action_get_token(); if ( $app->is_connected() ) { return $this->success_response( [ 'message' => __( 'Connected successfully.', 'elementor' ) ], WP_Http::CREATED ); } else { return $this->error_response( 'elementor_library_not_connected', __( 'Failed to connect to Elementor Library.', 'elementor' ), WP_Http::INTERNAL_SERVER_ERROR ); } } catch ( \Exception $e ) { return $this->error_response( 'elementor_library_connect_error', $e->getMessage(), WP_Http::INTERNAL_SERVER_ERROR ); } } public function disconnect( \WP_REST_Request $request ) { $app = $this->get_connect_app(); if ( ! $app ) { return $this->elementor_library_app_not_available(); } $app->set_auth_mode( self::AUTH_MODE ); $_REQUEST['mode'] = self::AUTH_MODE; try { $app->action_disconnect(); return $this->success_response( [ 'message' => __( 'Disconnected successfully.', 'elementor' ) ], WP_Http::OK ); } catch ( \Exception $e ) { return $this->error_response( 'elementor_library_disconnect_error', $e->getMessage(), WP_Http::INTERNAL_SERVER_ERROR ); } } public function connect_permissions_check( \WP_REST_Request $request ) { return current_user_can( 'manage_options' ); } private function route_wrapper( callable $cb ) { try { $response = $cb(); } catch ( \Exception $e ) { return $this->error_response( 'unexpected_error', __( 'Something went wrong', 'elementor' ), WP_Http::INTERNAL_SERVER_ERROR ); } return $response; } private function error_response( $code, $message, $status = WP_Http::BAD_REQUEST ) { return new \WP_Error( $code, $message, [ 'status' => $status ] ); } private function success_response( $data = [], $status = WP_Http::OK ) { $response = rest_ensure_response( array_merge( [ 'success' => true ], $data ) ); $response->set_status( $status ); return $response; } private function elementor_library_app_not_available() { return $this->error_response( 'elementor_library_app_not_available', __( 'Elementor Library app is not available.', 'elementor' ), WP_Http::INTERNAL_SERVER_ERROR ); } /** * Get the connect app. * * @return \Elementor\Core\Common\Modules\Connect\Apps\Library|null */ private function get_connect_app() { $connect = Plugin::$instance->common->get_component( 'connect' ); if ( ! $connect ) { return null; } $app = $connect->get_app( 'library' ); if ( ! $app ) { $connect->init(); $app = $connect->get_app( 'library' ); } return $app; } } connect/admin.php 0000755 00000006345 15111605150 0010004 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Connect; use Elementor\Core\Admin\Menu\Admin_Menu_Manager; use Elementor\Plugin; use Elementor\Settings; use Elementor\Utils; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Admin { const PAGE_ID = 'elementor-connect'; public static $url = ''; private function get_valid_redirect_to_from_request() { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only reading a URL parameter. $raw = Utils::get_super_global_value( $_GET, 'redirect_to' ); if ( ! $raw ) { return ''; } $raw = esc_url_raw( $raw ); $validated = wp_validate_redirect( $raw, '' ); if ( ! $validated ) { return ''; } $admin_host = wp_parse_url( admin_url(), PHP_URL_HOST ); $dest_host = wp_parse_url( $validated, PHP_URL_HOST ); if ( $dest_host && $admin_host && ! hash_equals( $admin_host, $dest_host ) ) { return ''; } return $validated; } /** * @since 2.3.0 * @access public */ public function register_admin_menu( Admin_Menu_Manager $admin_menu ) { $admin_menu->register( static::PAGE_ID, new Connect_Menu_Item() ); } /** * @since 2.3.0 * @access public */ public function on_load_page() { if ( ! $this->user_has_enough_permissions() ) { wp_die( 'You do not have sufficient permissions to access this page.', 'You do not have sufficient permissions to access this page.', [ 'back_link' => true, ] ); } // Allow a per-request default landing URL when provided via a safe `redirect_to` parameter. $maybe_redirect_to = $this->get_valid_redirect_to_from_request(); if ( $maybe_redirect_to ) { self::$url = $maybe_redirect_to; } if ( isset( $_GET['action'], $_GET['app'] ) ) { $manager = Plugin::$instance->common->get_component( 'connect' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended $app_slug = Utils::get_super_global_value( $_GET, 'app' ); $app = $manager->get_app( $app_slug ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended $action = Utils::get_super_global_value( $_GET, 'action' ); $nonce_action = $app_slug . $action; if ( ! $app ) { wp_die( 'Unknown app: ' . esc_attr( $app_slug ) ); } if ( ! wp_verify_nonce( Utils::get_super_global_value( $_GET, 'nonce' ), $nonce_action ) ) { wp_die( 'Invalid Nonce', 'Invalid Nonce', [ 'back_link' => true, ] ); } $method = 'action_' . $action; if ( method_exists( $app, $method ) ) { call_user_func( [ $app, $method ] ); } } } private function user_has_enough_permissions() { if ( current_user_can( 'manage_options' ) ) { return true; } if ( 'library' === Utils::get_super_global_value( $_GET, 'app' ) ) { return current_user_can( 'edit_posts' ); } return false; } /** * @since 2.3.0 * @access public */ public function __construct() { self::$url = admin_url( 'admin.php?page=' . self::PAGE_ID ); add_action( 'elementor/admin/menu/register', [ $this, 'register_admin_menu' ] ); add_action( 'elementor/admin/menu/after_register', function ( Admin_Menu_Manager $admin_menu, array $hooks ) { if ( ! empty( $hooks[ static::PAGE_ID ] ) ) { add_action( 'load-' . $hooks[ static::PAGE_ID ], [ $this, 'on_load_page' ] ); } }, 10, 2 ); } } connect/connect-menu-item.php 0000755 00000002237 15111605150 0012237 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Connect; use Elementor\Core\Admin\Menu\Interfaces\Admin_Menu_Item_With_Page; use Elementor\Core\Common\Modules\Connect\Apps\Base_App; use Elementor\Plugin; use Elementor\Settings; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Connect_Menu_Item implements Admin_Menu_Item_With_Page { public function is_visible() { return false; } public function get_parent_slug() { return Settings::PAGE_ID; } public function get_label() { return esc_html__( 'Connect', 'elementor' ); } public function get_page_title() { return esc_html__( 'Connect', 'elementor' ); } public function get_capability() { return 'edit_posts'; } public function render() { $apps = Plugin::$instance->common->get_component( 'connect' )->get_apps(); ?> <style> .elementor-connect-app-wrapper{ margin-bottom: 50px; overflow: hidden; } </style> <div class="wrap"> <?php /** @var Base_App $app */ foreach ( $apps as $app ) { echo '<div class="elementor-connect-app-wrapper">'; $app->render_admin_widget(); echo '</div>'; } ?> </div><!-- /.wrap --> <?php } } connect/module.php 0000755 00000013651 15111605150 0010177 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Connect; use Elementor\Core\Base\Module as BaseModule; use Elementor\Core\Common\Modules\Connect\Apps\Base_App; use Elementor\Core\Common\Modules\Connect\Apps\Common_App; use Elementor\Core\Common\Modules\Connect\Apps\Connect; use Elementor\Core\Common\Modules\Connect\Apps\Library; use Elementor\Plugin; use Elementor\Utils; use WP_User_Query; use Elementor\Core\Common\Modules\Connect\Rest\Rest_Api; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Module extends BaseModule { const ACCESS_LEVEL_CORE = 0; const ACCESS_LEVEL_PRO = 1; const ACCESS_LEVEL_EXPERT = 20; const ACCESS_TIER_FREE = 'free'; const ACCESS_TIER_ESSENTIAL = 'essential'; const ACCESS_TIER_ESSENTIAL_OCT_2023 = 'essential-oct2023'; const ACCESS_TIER_ADVANCED = 'advanced'; const ACCESS_TIER_EXPERT = 'expert'; const ACCESS_TIER_AGENCY = 'agency'; const ACCESS_TIER_PRO_LEGACY = 'pro'; /** * @since 2.3.0 * @access public */ public function get_name() { return 'connect'; } /** * @var array */ protected $registered_apps = []; /** * Apps Instances. * * Holds the list of all the apps instances. * * @since 2.3.0 * @access protected * * @var Base_App[] */ protected $apps = []; /** * Registered apps categories. * * Holds the list of all the registered apps categories. * * @since 2.3.0 * @access protected * * @var array */ protected $categories = []; protected $admin_page; /** * @since 2.3.0 * @access public */ public function __construct() { $this->registered_apps = [ 'connect' => Connect::get_class_name(), 'library' => Library::get_class_name(), ]; // When using REST API the parent module is construct after the action 'elementor/init' // so this part of code make sure to register the module "apps". if ( did_action( 'elementor/init' ) ) { $this->init(); } else { // Note: The priority 11 is for allowing plugins to add their register callback on elementor init. add_action( 'elementor/init', [ $this, 'init' ], 11 ); } add_action( 'rest_api_init', [ $this, 'register_rest_routes' ] ); add_filter( 'elementor/tracker/send_tracking_data_params', function ( $params ) { return $this->add_tracking_data( $params ); } ); } /** * Register default apps. * * Registers the default apps. * * @since 2.3.0 * @access public */ public function init() { if ( is_admin() ) { $this->admin_page = new Admin(); } /** * Register Elementor apps. * * Fires after Elementor registers the default apps. * * @since 2.3.0 * * @param self $this The apps manager instance. */ do_action( 'elementor/connect/apps/register', $this ); foreach ( $this->registered_apps as $slug => $class ) { $this->apps[ $slug ] = new $class(); } } /** * Register app. * * Registers an app. * * @since 2.3.0 * @access public * * @param string $slug App slug. * @param string $class_name App full class name. * * @return self The updated apps manager instance. */ public function register_app( $slug, $class_name ) { $this->registered_apps[ $slug ] = $class_name; return $this; } /** * Get app instance. * * Retrieve the app instance. * * @since 2.3.0 * @access public * * @param $slug * * @return Base_App|null */ public function get_app( $slug ) { if ( isset( $this->apps[ $slug ] ) ) { return $this->apps[ $slug ]; } return null; } /** * @since 2.3.0 * @access public * @return Base_App[] */ public function get_apps() { return $this->apps; } /** * @since 2.3.0 * @access public */ public function register_category( $slug, $args ) { $this->categories[ $slug ] = $args; return $this; } /** * @since 2.3.0 * @access public */ public function get_categories() { return $this->categories; } /** * @param string $context Where this subscription plan should be shown. * * @return array */ public function get_subscription_plans( $context = '' ) { $base_url = Utils::has_pro() ? 'https://my.elementor.com/upgrade-subscription' : 'https://elementor.com/pro'; $promotion_url = $base_url . '/?utm_source=' . $context . '&utm_medium=wp-dash&utm_campaign=gopro'; return [ static::ACCESS_TIER_FREE => [ 'label' => null, 'promotion_url' => null, 'color' => null, ], static::ACCESS_TIER_ESSENTIAL => [ 'label' => 'Pro', 'promotion_url' => $promotion_url, 'color' => '#92003B', ], static::ACCESS_TIER_ESSENTIAL_OCT_2023 => [ 'label' => 'Advanced', // Should be the same label as "Advanced". 'promotion_url' => $promotion_url, 'color' => '#92003B', ], static::ACCESS_TIER_ADVANCED => [ 'label' => 'Advanced', 'promotion_url' => $promotion_url, 'color' => '#92003B', ], static::ACCESS_TIER_EXPERT => [ 'label' => 'Expert', 'promotion_url' => $promotion_url, 'color' => '#92003B', ], static::ACCESS_TIER_AGENCY => [ 'label' => 'Agency', 'promotion_url' => $promotion_url, 'color' => '#92003B', ], ]; } private function add_tracking_data( $params ) { $users = []; $users_query = new WP_User_Query( [ 'count_total' => false, // Disable SQL_CALC_FOUND_ROWS. 'meta_query' => [ 'key' => Common_App::OPTION_CONNECT_COMMON_DATA_KEY, 'compare' => 'EXISTS', ], ] ); foreach ( $users_query->get_results() as $user ) { $connect_common_data = get_user_option( Common_App::OPTION_CONNECT_COMMON_DATA_KEY, $user->ID ); if ( $connect_common_data ) { $users [] = [ 'id' => $user->ID, 'email' => $connect_common_data['user']->email, 'roles' => implode( ', ', $user->roles ), ]; } } $params['usages'][ $this->get_name() ] = [ 'site_key' => get_option( Base_App::OPTION_CONNECT_SITE_KEY ), 'count' => count( $users ), 'users' => $users, ]; return $params; } public function register_rest_routes() { $rest_api = new Rest_Api(); $rest_api->register_routes(); } } event-tracker/data/controller.php 0000755 00000003513 15111605150 0013123 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\EventTracker\Data; use Elementor\Core\Common\Modules\EventTracker\DB as Events_DB_Manager; use Elementor\Plugin; use WP_REST_Server; use Elementor\Data\V2\Base\Controller as Controller_Base; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Controller extends Controller_Base { public function get_name() { return 'send-event'; } public function register_endpoints() { $this->index_endpoint->register_items_route( \WP_REST_Server::CREATABLE, [ 'event_data' => [ 'description' => 'All the recorded event data in JSON format', 'type' => 'object', 'required' => true, ], ] ); } /** * Get Permissions Callback * * This endpoint should only accept POST requests, and currently we only track site administrator actions. * * @since 3.6.0 * * @param \WP_REST_Request $request * @return bool */ public function get_permission_callback( $request ) { if ( WP_REST_Server::CREATABLE !== $request->get_method() ) { return false; } return current_user_can( 'manage_options' ); } /** * Create Items * * Receives a request for adding an event data entry into the database. If the request contains event data, this * method initiates creation of a database entry with the event data in the Events DB table. * * @since 3.6.0 * * @param \WP_REST_Request $request * @return bool */ public function create_items( $request ) { $request_body = $request->get_json_params(); if ( empty( $request_body['event_data'] ) ) { return false; } /** @var Events_DB_Manager $event_tracker_db_manager */ $event_tracker_db_manager = Plugin::$instance->common ->get_component( 'event-tracker' ) ->get_component( 'events-db' ); $event_tracker_db_manager->create_entry( $request_body['event_data'] ); return true; } } event-tracker/db.php 0000755 00000011410 15111605150 0010407 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\EventTracker; use Elementor\Core\Base\Base_Object; use Elementor\Core\Common\Modules\Connect\Apps\Common_App; use Elementor\Core\Common\Modules\Connect\Apps\Library; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class DB extends Base_Object { /** * @var \wpdb */ private $wpdb; const TABLE_NAME = 'e_events'; const DB_VERSION_OPTION_KEY = 'elementor_events_db_version'; const CURRENT_DB_VERSION = '1.0.0'; /** * Get Table Name * * Returns the Events database table's name with the `wpdb` prefix. * * @since 3.6.0 * * @return string */ public function get_table_name() { return $this->wpdb->prefix . self::TABLE_NAME; } /** * Prepare Database for Entry * * The events database should have a limit of up to 1000 event entries stored daily. * Before adding a new entry to the database, we make sure that the limit of 1000 events is not reached. * If there are 1000 or more entries in the DB, we delete the earliest-inserted entry before inserting a new one. * * @since 3.6.0 */ public function prepare_db_for_entry() { $events = $this->get_event_ids_from_db(); if ( 1000 <= count( $events ) ) { $event_ids = []; foreach ( $events as $event ) { $event_ids[] = $event->id; } // Sort the array by entry ID array_multisort( $event_ids, SORT_ASC, $events ); // Delete the smallest ID (which is the earliest DB entry) $this->wpdb->delete( $this->get_table_name(), [ 'ID' => $events[0]->id ] ); } } /** * Create Entry * * Adds an event entry to the database. * * @since 3.6.0 */ public function create_entry( $event_data ) { $this->prepare_db_for_entry(); $connect = Plugin::$instance->common->get_component( 'connect' ); /** @var Library $library */ $library = $connect->get_apps()['library']; if ( ! isset( $event_data['details'] ) ) { $event_data['details'] = []; } if ( $library->is_connected() ) { $user_connect_data = get_user_option( Common_App::OPTION_CONNECT_COMMON_DATA_KEY ); // Add the user's client ID to the event. $event_data['details']['client_id'] = $user_connect_data['client_id']; } $event_data['details'] = wp_json_encode( $event_data['details'] ); $entry = [ 'event_data' => wp_json_encode( $event_data ), 'created_at' => $event_data['ts'], ]; $this->wpdb->insert( $this->get_table_name(), $entry ); } /** * Get Event IDs From DB * * Fetches the IDs of all events saved in the database. * * @since 3.6.0 * * @return array|object|null */ public function get_event_ids_from_db() { // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared return $this->wpdb->get_results( "SELECT id FROM {$this->get_table_name()}" ); } /** * Reset Table * * Empties the contents of the Events DB table. * * @since 3.6.0 */ public static function reset_table() { global $wpdb; $table_name = $wpdb->prefix . self::TABLE_NAME; // Delete all content of the table. // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared $wpdb->query( "TRUNCATE TABLE {$table_name}" ); } /** * Create Table * * Creates the `wp_e_events` database table. * * @since 3.6.0 * * @param string $query to that looks for the Events table in the DB. Used for checking if table was created. */ private function create_table( $query ) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; $table_name = $this->get_table_name(); $charset_collate = $this->wpdb->get_charset_collate(); $e_events_table = "CREATE TABLE `{$table_name}` ( id bigint(20) unsigned auto_increment primary key, event_data text null, created_at datetime not null ) {$charset_collate};"; // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared $this->wpdb->query( $e_events_table ); // Check if table was created successfully. // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared if ( $this->wpdb->get_var( $query ) === $table_name ) { update_option( self::DB_VERSION_OPTION_KEY, self::CURRENT_DB_VERSION, false ); } } /** * Add Indexes * * Adds an index to the events table for the creation date column. * * @since 3.6.0 */ private function add_indexes() { // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared $this->wpdb->query( 'ALTER TABLE ' . $this->get_table_name() . ' ADD INDEX `created_at_index` (`created_at`) ' ); } public function __construct() { global $wpdb; $this->wpdb = $wpdb; // Check if table exists. If not, create it. $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $this->get_table_name() ) ); // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared if ( $wpdb->get_var( $query ) !== $this->get_table_name() ) { $this->create_table( $query ); $this->add_indexes(); } } } event-tracker/module.php 0000755 00000001642 15111605150 0011315 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\EventTracker; use Elementor\Core\Base\Module as BaseModule; use Elementor\Core\Common\Modules\EventTracker\Data\Controller; use Elementor\Plugin; use Elementor\Tracker; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Event Tracker Module Class * * @since 3.6.0 */ class Module extends BaseModule { public function get_name() { return 'event-tracker'; } /** * Get init settings. * * @since 3.6.0 * @access protected * * @return array */ protected function get_init_settings() { return [ 'isUserDataShared' => Tracker::is_allow_track(), ]; } public function __construct() { // Initialize Events Database Table $this->add_component( 'events-db', new DB() ); // Handle User Data Deletion/Export requests. new Personal_Data(); Plugin::$instance->data_manager_v2->register_controller( new Controller() ); } } event-tracker/personal-data.php 0000755 00000003711 15111605150 0012561 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\EventTracker; use Elementor\Core\Base\Base_Object; use Elementor\Core\Common\Modules\EventTracker\DB as Events_DB_Manager; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Personal_Data extends Base_Object { const WP_KEY = 'elementor-event-tracker'; /** * Get Title * * @since 3.6.0 * * @return string */ private function get_title() { return esc_html__( 'Elementor Event Tracker', 'elementor' ); } /** * Erase all the submissions related to specific email. * * Since event data is saved globally per site and not per user, we remove all saved events from the DB upon a * user's data deletion request. * * @return array */ private function erase_data() { // Get number of events saved in the DB. /** @var Events_DB_Manager $event_tracker_db_manager */ $event_tracker_db_manager = Plugin::$instance->common ->get_component( 'event-tracker' ) ->get_component( 'events-db' ); $events = $event_tracker_db_manager->get_event_ids_from_db(); $events_count = count( $events ); DB::reset_table(); // Validate table deleted $updated_events = $event_tracker_db_manager->get_event_ids_from_db(); $updated_events_count = count( $updated_events ); return [ 'items_removed' => $events_count - $updated_events_count, 'items_retained' => 0, 'messages' => [], 'done' => 0 === $updated_events_count, ]; } /** * Add eraser to the list of erasers. * * @param $erasers * * @return array[] */ private function add_eraser( $erasers ) { return $erasers + [ self::WP_KEY => [ 'eraser_friendly_name' => $this->get_title(), 'callback' => function () { return $this->erase_data(); }, ], ]; } /** * Personal_Data constructor. */ public function __construct() { add_filter( 'wp_privacy_personal_data_erasers', function ( $exporters ) { return $this->add_eraser( $exporters ); } ); } } events-manager/module.php 0000755 00000004412 15111605150 0011455 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\EventsManager; use Elementor\Core\Base\Module as BaseModule; use Elementor\Core\Common\Modules\Connect\Apps\Base_App; use Elementor\Core\Experiments\Manager as Experiments_Manager; use Elementor\Utils; use Elementor\Plugin; use Elementor\Tracker; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Module extends BaseModule { const EXPERIMENT_NAME = 'editor_events'; public function get_name() { return 'events-manager'; } public static function get_editor_events_config() { $can_send_events = ! empty( ELEMENTOR_EDITOR_EVENTS_MIXPANEL_TOKEN ) && Tracker::is_allow_track() && ! Tracker::has_terms_changed( '2025-07-07' ) && Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME ); $settings = [ 'can_send_events' => $can_send_events, 'elementor_version' => ELEMENTOR_VERSION, 'site_url' => hash( 'sha256', get_site_url() ), 'wp_version' => get_bloginfo( 'version' ), 'user_agent' => esc_html( Utils::get_super_global_value( $_SERVER, 'HTTP_USER_AGENT' ) ), 'site_language' => get_locale(), 'site_key' => get_option( Base_App::OPTION_CONNECT_SITE_KEY ), 'subscription_id' => self::get_subscription_id(), 'subscription' => self::get_subscription(), 'token' => ELEMENTOR_EDITOR_EVENTS_MIXPANEL_TOKEN, ]; return $settings; } public static function get_experimental_data(): array { return [ 'name' => static::EXPERIMENT_NAME, 'title' => esc_html__( 'Elementor Editor Events', 'elementor' ), 'description' => esc_html__( 'Editor events processing', 'elementor' ), 'hidden' => true, 'release_status' => Experiments_Manager::RELEASE_STATUS_ALPHA, 'default' => Experiments_Manager::STATE_INACTIVE, 'new_site' => [ 'default_active' => true, 'minimum_installation_version' => '3.32.0', ], ]; } private static function get_subscription_id() { $subscription = self::get_subscription(); return $subscription['subscription_id'] ?? null; } private static function get_subscription() { if ( ! Utils::has_pro() ) { return null; } $license_data = get_option( '_elementor_pro_license_v2_data' ); if ( ! isset( $license_data['value'] ) ) { return null; } return json_decode( $license_data['value'], true ); } } finder/categories/create.php 0000755 00000005635 15111605150 0012123 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Finder\Categories; use Elementor\Core\Common\Modules\Finder\Base_Category; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Create Category * * Provides items related to creation of new posts/pages/templates etc. */ class Create extends Base_Category { /** * Get title. * * @since 2.3.0 * @access public * * @return string */ public function get_title() { return esc_html__( 'Create', 'elementor' ); } public function get_id() { return 'create'; } /** * Get category items. * * @since 2.3.0 * @access public * * @param array $options * * @return array */ public function get_category_items( array $options = [] ) { $result = []; $registered_document_types = Plugin::$instance->documents->get_document_types(); // TODO: Remove - Support 'post' backwards compatibility - See `Documents_Manager::register_default_types()`. unset( $registered_document_types['post'] ); $elementor_supported_post_types = array_flip( get_post_types_by_support( 'elementor' ) ); foreach ( $registered_document_types as $document_name => $document_class ) { $document_properties = $document_class::get_properties(); if ( empty( $document_properties['show_in_finder'] ) ) { continue; } if ( ! empty( $document_properties['cpt'] ) ) { foreach ( $document_properties['cpt'] as $cpt ) { unset( $elementor_supported_post_types[ $cpt ] ); } } $result[ $document_name ] = $this->create_item_url_by_document_class( $document_class ); } foreach ( $elementor_supported_post_types as $post_type => $val ) { $result[ $post_type ] = $this->create_item_url_by_post_type( $post_type ); } return $result; } private function create_item_url_by_post_type( $post_type ) { $post_type_object = get_post_type_object( $post_type ); // If there is an old post type from inactive plugins. if ( ! $post_type_object ) { return false; } return $this->get_create_new_template( sprintf( /* translators: %s: Post type singular name. */ __( 'Add New %s', 'elementor' ), $post_type_object->labels->singular_name ), Plugin::$instance->documents->get_create_new_post_url( $post_type ) ); } private function create_item_url_by_document_class( $document_class ) { $result = $this->get_create_new_template( $document_class::get_add_new_title(), $document_class::get_create_url() ); $lock_behavior = $document_class::get_lock_behavior_v2(); $is_locked = ! empty( $lock_behavior ) && $lock_behavior->is_locked(); if ( $is_locked ) { $result['lock'] = $lock_behavior->get_config(); } return $result; } private function get_create_new_template( $add_new_title, $url ) { return [ 'title' => $add_new_title, 'icon' => 'plus-circle-o', 'url' => $url, 'keywords' => [ $add_new_title, 'post', 'page', 'template', 'new', 'create' ], ]; } } finder/categories/edit.php 0000755 00000005271 15111605150 0011601 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Finder\Categories; use Elementor\Core\Base\Document; use Elementor\Core\Common\Modules\Finder\Base_Category; use Elementor\Plugin; use Elementor\TemplateLibrary\Source_Local; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Edit Category * * Provides items related to editing of posts/pages/templates etc. */ class Edit extends Base_Category { /** * Get title. * * @since 2.3.0 * @access public * * @return string */ public function get_title() { return esc_html__( 'Edit', 'elementor' ); } public function get_id() { return 'edit'; } /** * Is dynamic. * * Determine if the category is dynamic. * * @since 2.3.0 * @access public * * @return bool */ public function is_dynamic() { return true; } /** * Get category items. * * @since 2.3.0 * @access public * * @param array $options * * @return array */ public function get_category_items( array $options = [] ) { $post_types = get_post_types( [ 'exclude_from_search' => false, ] ); $post_types[] = Source_Local::CPT; $document_types = Plugin::$instance->documents->get_document_types( [ 'is_editable' => true, 'show_in_finder' => true, ] ); $recently_edited_query_args = [ 'no_found_rows' => true, 'post_type' => $post_types, 'post_status' => [ 'publish', 'draft', 'private', 'pending', 'future' ], 'posts_per_page' => '10', 'meta_query' => [ [ 'key' => '_elementor_edit_mode', 'value' => 'builder', ], [ 'relation' => 'or', [ 'key' => Document::TYPE_META_KEY, 'compare' => 'NOT EXISTS', ], [ 'key' => Document::TYPE_META_KEY, 'value' => array_keys( $document_types ), ], ], ], 'orderby' => 'modified', 's' => $options['filter'], ]; $recently_edited_query = new \WP_Query( $recently_edited_query_args ); $items = []; /** @var \WP_Post $post */ foreach ( $recently_edited_query->posts as $post ) { $document = Plugin::$instance->documents->get( $post->ID ); if ( ! $document ) { continue; } $is_template = Source_Local::CPT === $post->post_type; $description = $document->get_title(); $icon = 'document-file'; if ( $is_template ) { $description = esc_html__( 'Template', 'elementor' ) . ' / ' . $description; $icon = 'post-title'; } $items[] = [ 'icon' => $icon, 'title' => esc_html( $post->post_title ), 'description' => $description, 'url' => $document->get_edit_url(), 'actions' => [ [ 'name' => 'view', 'url' => $document->get_permalink(), 'icon' => 'preview-medium', ], ], ]; } return $items; } } finder/categories/general.php 0000755 00000004522 15111605150 0012267 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Finder\Categories; use Elementor\Core\Common\Modules\Finder\Base_Category; use Elementor\Core\RoleManager\Role_Manager; use Elementor\Plugin; use Elementor\TemplateLibrary\Source_Local; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * General Category * * Provides general items related to Elementor Admin. */ class General extends Base_Category { /** * Get title. * * @since 2.3.0 * @access public * * @return string */ public function get_title() { return esc_html__( 'General', 'elementor' ); } public function get_id() { return 'general'; } /** * Get category items. * * @since 2.3.0 * @access public * * @param array $options * * @return array */ public function get_category_items( array $options = [] ) { return [ 'saved-templates' => [ 'title' => esc_html__( 'Saved Templates', 'elementor' ), 'icon' => 'library-save', 'url' => Source_Local::get_admin_url(), 'keywords' => [ 'template', 'section', 'page', 'library' ], ], 'system-info' => [ 'title' => esc_html__( 'System Info', 'elementor' ), 'icon' => 'info-circle-o', 'url' => admin_url( 'admin.php?page=elementor-system-info' ), 'keywords' => [ 'system', 'info', 'environment', 'elementor' ], ], 'role-manager' => [ 'title' => esc_html__( 'Role Manager', 'elementor' ), 'icon' => 'person', 'url' => Role_Manager::get_url(), 'keywords' => [ 'role', 'manager', 'user', 'elementor' ], ], 'knowledge-base' => [ 'title' => esc_html__( 'Knowledge Base', 'elementor' ), 'url' => admin_url( 'admin.php?page=go_knowledge_base_site' ), 'keywords' => [ 'help', 'knowledge', 'docs', 'elementor' ], ], 'theme-builder' => [ 'title' => esc_html__( 'Theme Builder', 'elementor' ), 'icon' => 'library-save', 'url' => Plugin::$instance->app->get_settings( 'menu_url' ), 'keywords' => [ 'template', 'header', 'footer', 'single', 'archive', 'search', '404', 'library' ], ], 'kit-library' => [ 'title' => esc_html__( 'Website Templates', 'elementor' ), 'icon' => 'kit-parts', 'url' => Plugin::$instance->app->get_base_url() . '&source=finder#/kit-library', 'keywords' => [ 'Website Templates', 'kit library', 'kit', 'library', 'site parts', 'parts', 'assets', 'templates' ], ], ]; } } finder/categories/settings.php 0000755 00000004534 15111605150 0012515 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Finder\Categories; use Elementor\Core\Common\Modules\Finder\Base_Category; use Elementor\Modules\ElementManager\Module as ElementManagerModule; use Elementor\Settings as ElementorSettings; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Settings Category * * Provides items related to Elementor's settings. */ class Settings extends Base_Category { /** * Get title. * * @since 2.3.0 * @access public * * @return string */ public function get_title() { return esc_html__( 'Settings', 'elementor' ); } public function get_id() { return 'settings'; } /** * Get category items. * * @since 2.3.0 * @access public * * @param array $options * * @return array */ public function get_category_items( array $options = [] ) { return [ 'general-settings' => [ 'title' => esc_html__( 'General Settings', 'elementor' ), 'url' => ElementorSettings::get_settings_tab_url( 'general' ), 'keywords' => [ 'general', 'settings', 'elementor' ], ], 'integrations' => [ 'title' => esc_html__( 'Integrations', 'elementor' ), 'url' => ElementorSettings::get_settings_tab_url( 'integrations' ), 'keywords' => [ 'integrations', 'settings', 'elementor' ], ], 'advanced' => [ 'title' => esc_html__( 'Advanced', 'elementor' ), 'url' => ElementorSettings::get_settings_tab_url( 'advanced' ), 'keywords' => [ 'advanced', 'settings', 'elementor' ], ], 'performance' => [ 'title' => esc_html__( 'Performance', 'elementor' ), 'url' => ElementorSettings::get_settings_tab_url( 'performance' ), 'keywords' => [ 'performance', 'settings', 'elementor' ], ], 'experiments' => [ 'title' => esc_html__( 'Experiments', 'elementor' ), 'url' => ElementorSettings::get_settings_tab_url( 'experiments' ), 'keywords' => [ 'settings', 'elementor', 'experiments' ], ], 'features' => [ 'title' => esc_html__( 'Features', 'elementor' ), 'url' => ElementorSettings::get_settings_tab_url( 'experiments' ), 'keywords' => [ 'settings', 'elementor', 'features' ], ], 'element-manager' => [ 'title' => esc_html__( 'Element Manager', 'elementor' ), 'url' => admin_url( 'admin.php?page=' . ElementManagerModule::PAGE_ID ), 'keywords' => [ 'settings', 'elements', 'widgets', 'manager' ], ], ]; } } finder/categories/site.php 0000755 00000004047 15111605150 0011620 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Finder\Categories; use Elementor\Core\Common\Modules\Finder\Base_Category; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Site Category * * Provides general site items. */ class Site extends Base_Category { /** * Get title. * * @since 2.3.0 * @access public * * @return string */ public function get_title() { return esc_html__( 'Site', 'elementor' ); } public function get_id() { return 'site'; } /** * Get category items. * * @since 2.3.0 * @access public * * @param array $options * * @return array */ public function get_category_items( array $options = [] ) { return [ 'homepage' => [ 'title' => esc_html__( 'Homepage', 'elementor' ), 'url' => home_url(), 'icon' => 'home-heart', 'keywords' => [ 'home', 'page' ], ], 'wordpress-dashboard' => [ 'title' => esc_html__( 'Dashboard', 'elementor' ), 'icon' => 'dashboard', 'url' => admin_url(), 'keywords' => [ 'dashboard', 'wordpress' ], ], 'wordpress-menus' => [ 'title' => esc_html__( 'Menus', 'elementor' ), 'icon' => 'wordpress', 'url' => admin_url( 'nav-menus.php' ), 'keywords' => [ 'menu', 'wordpress' ], ], 'wordpress-themes' => [ 'title' => esc_html__( 'Themes', 'elementor' ), 'icon' => 'wordpress', 'url' => admin_url( 'themes.php' ), 'keywords' => [ 'themes', 'wordpress' ], ], 'wordpress-customizer' => [ 'title' => esc_html__( 'Customizer', 'elementor' ), 'icon' => 'wordpress', 'url' => admin_url( 'customize.php' ), 'keywords' => [ 'customizer', 'wordpress' ], ], 'wordpress-plugins' => [ 'title' => esc_html__( 'Plugins', 'elementor' ), 'icon' => 'wordpress', 'url' => admin_url( 'plugins.php' ), 'keywords' => [ 'plugins', 'wordpress' ], ], 'wordpress-users' => [ 'title' => esc_html__( 'Users', 'elementor' ), 'icon' => 'wordpress', 'url' => admin_url( 'users.php' ), 'keywords' => [ 'users', 'profile', 'wordpress' ], ], ]; } } finder/categories/tools.php 0000755 00000004055 15111605150 0012013 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Finder\Categories; use Elementor\Core\Common\Modules\Finder\Base_Category; use Elementor\Tools as ElementorTools; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Tools Category * * Provides items related to Elementor's tools. */ class Tools extends Base_Category { /** * Get title. * * @since 2.3.0 * @access public * * @return string */ public function get_title() { return esc_html__( 'Tools', 'elementor' ); } public function get_id() { return 'tools'; } /** * Get category items. * * @since 2.3.0 * @access public * * @param array $options * * @return array */ public function get_category_items( array $options = [] ) { $tools_url = ElementorTools::get_url(); $items = [ 'tools' => [ 'title' => esc_html__( 'Tools', 'elementor' ), 'icon' => 'tools', 'url' => $tools_url, 'keywords' => [ 'tools', 'regenerate css', 'safe mode', 'debug bar', 'sync library', 'elementor' ], ], 'replace-url' => [ 'title' => esc_html__( 'Replace URL', 'elementor' ), 'icon' => 'tools', 'url' => $tools_url . '#tab-replace_url', 'keywords' => [ 'tools', 'replace url', 'domain', 'elementor' ], ], 'maintenance-mode' => [ 'title' => esc_html__( 'Maintenance Mode', 'elementor' ), 'icon' => 'tools', 'url' => $tools_url . '#tab-maintenance_mode', 'keywords' => [ 'tools', 'maintenance', 'coming soon', 'elementor' ], ], 'import-export' => [ 'title' => esc_html__( 'Import Export', 'elementor' ), 'icon' => 'import-export', 'url' => $tools_url . '#tab-import-export-kit', 'keywords' => [ 'tools', 'import export', 'import', 'export', 'kit' ], ], ]; if ( ElementorTools::can_user_rollback_versions() ) { $items['version-control'] = [ 'title' => esc_html__( 'Version Control', 'elementor' ), 'icon' => 'time-line', 'url' => $tools_url . '#tab-versions', 'keywords' => [ 'tools', 'version', 'control', 'rollback', 'beta', 'elementor' ], ]; } return $items; } } finder/base-category.php 0000755 00000003127 15111605150 0011252 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Finder; use Elementor\Core\Base\Base_Object; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Base Category * * Base class for Elementor Finder categories. */ abstract class Base_Category extends Base_Object { /** * Get title. * * @since 2.3.0 * @abstract * @access public * * @return string */ abstract public function get_title(); /** * Get a unique category ID. * * TODO: Make abstract. * * @since 3.5.0 * @deprecated 3.5.0 * @access public * * @return string */ public function get_id() { Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( get_class( $this ) . '::' . __FUNCTION__, '3.5.0', 'This method will be replaced with an abstract method.' ); return ''; } /** * Get category items. * * @since 2.3.0 * @abstract * @access public * * @param array $options * * @return array */ abstract public function get_category_items( array $options = [] ); /** * Is dynamic. * * Determine if the category is dynamic. * * @since 2.3.0 * @access public * * @return bool */ public function is_dynamic() { return false; } /** * Get init settings. * * @since 2.3.0 * @access protected * * @return array */ protected function get_init_settings() { $settings = [ 'title' => $this->get_title(), 'dynamic' => $this->is_dynamic(), ]; if ( ! $settings['dynamic'] ) { $settings['items'] = $this->get_category_items(); } return $settings; } } finder/categories-manager.php 0000755 00000007273 15111605150 0012270 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Finder; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Categories_Manager { /** * @access private * * @var Base_Category[] */ private $categories; /** * @var array */ private $categories_list = [ 'edit', 'general', 'create', 'site', 'settings', 'tools', ]; /** * Add category. * * @since 2.3.0 * @deprecated 3.5.0 Use `register()` method instead. * @access public * * @param string $category_name * @param Base_Category $category * * @deprecated 3.5.0 Use `register()` method instead. */ public function add_category( $category_name, Base_Category $category ) { Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0', 'register()' ); $this->register( $category, $category_name ); } /** * Register finder category. * * @since 3.5.0 * @access public * * @param Base_Category $finder_category_instance An Instance of a category. * @param string $finder_category_name A Category name. Deprecated parameter. * * @return void */ public function register( Base_Category $finder_category_instance, $finder_category_name = null ) { // TODO: For BC. Remove in the future. if ( $finder_category_name ) { Plugin::instance()->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_argument( '$finder_category_name', '3.5.0' ); } else { $finder_category_name = $finder_category_instance->get_id(); } $this->categories[ $finder_category_name ] = $finder_category_instance; } /** * Unregister a finder category. * * @param string $finder_category_name - Category to unregister. * * @return void * @since 3.6.0 * @access public */ public function unregister( $finder_category_name ) { unset( $this->categories[ $finder_category_name ] ); } /** * Get categories. * * Retrieve the registered categories, or a specific category if the category name * is provided as a parameter. * * @since 2.3.0 * @access public * * @param string $category Category name. * * @return Base_Category|Base_Category[]|null */ public function get_categories( $category = '' ) { if ( ! $this->categories ) { $this->init_categories(); } if ( $category ) { if ( isset( $this->categories[ $category ] ) ) { return $this->categories[ $category ]; } return null; } return $this->categories; } /** * Init categories. * * Used to initialize the native finder categories. * * @since 2.3.0 * @access private */ private function init_categories() { foreach ( $this->categories_list as $category_name ) { $class_name = __NAMESPACE__ . '\Categories\\' . $category_name; $this->register( new $class_name() ); } /** * Elementor Finder categories init. * * Fires after Elementor Finder initialize it's native categories. * * This hook should be used to add your own Finder categories. * * @since 2.3.0 * @deprecated 3.5.0 Use `elementor/finder/register` hook instead. * * @param Categories_Manager $this. */ Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->do_deprecated_action( 'elementor/finder/categories/init', [ $this ], '3.5.0', 'elementor/finder/register' ); /** * Elementor Finder categories registration. * * Fires after Elementor Finder initialize it's native categories. * * This hook should be used to register your own Finder categories. * * @since 3.5.0 * * @param Categories_Manager $this Finder Categories manager. */ do_action( 'elementor/finder/register', $this ); } } finder/module.php 0000755 00000005221 15111605150 0010007 0 ustar 00 <?php namespace Elementor\Core\Common\Modules\Finder; use Elementor\Core\Base\Module as BaseModule; use Elementor\Core\Common\Modules\Ajax\Module as Ajax; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Finder Module * * Responsible for initializing Elementor Finder functionality */ class Module extends BaseModule { /** * Categories manager. * * @access private * * @var Categories_Manager */ private $categories_manager; /** * Module constructor. * * @since 2.3.0 * @access public */ public function __construct() { $this->categories_manager = new Categories_Manager(); $this->add_template(); add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] ); } /** * Get name. * * @since 2.3.0 * @access public * * @return string */ public function get_name() { return 'finder'; } /** * Add template. * * @since 2.3.0 * @access public */ public function add_template() { Plugin::$instance->common->add_template( __DIR__ . '/template.php' ); } /** * Register ajax actions. * * @since 2.3.0 * @access public * * @param Ajax $ajax */ public function register_ajax_actions( Ajax $ajax ) { $ajax->register_ajax_action( 'finder_get_category_items', [ $this, 'ajax_get_category_items' ] ); } /** * Ajax get category items. * * @since 2.3.0 * @access public * * @param array $data * * @return array * * @throws \Exception If finder category registration fails or validation errors occur. */ public function ajax_get_category_items( array $data ) { if ( ! current_user_can( 'manage_options' ) ) { throw new \Exception( 'Access denied.' ); } $category = $this->categories_manager->get_categories( $data['category'] ); return $category->get_category_items( $data ); } /** * Get init settings. * * @since 2.3.0 * @access protected * * @return array */ protected function get_init_settings() { $categories = $this->categories_manager->get_categories(); $categories_data = []; foreach ( $categories as $category_name => $category ) { $categories_data[ $category_name ] = array_merge( $category->get_settings(), [ 'name' => $category_name ] ); } /** * Finder categories. * * Filters the list of finder categories. This hook is used to manage Finder * categories - to add new categories, remove and edit existing categories. * * @since 2.3.0 * * @param array $categories_data A list of finder categories. */ $categories_data = apply_filters( 'elementor/finder/categories', $categories_data ); return [ 'data' => $categories_data, ]; } } finder/template.php 0000755 00000003632 15111605150 0010341 0 ustar 00 <?php namespace Elementor\Modules\Finder; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } ?> <script type="text/template" id="tmpl-elementor-finder"> <div id="elementor-finder__search"> <i class="eicon-search" aria-hidden="true"></i> <input id="elementor-finder__search__input" placeholder="<?php echo esc_attr__( 'Type to find anything in Elementor', 'elementor' ); ?>" autocomplete="off"> </div> <div id="elementor-finder__content"></div> </script> <script type="text/template" id="tmpl-elementor-finder-results-container"> <div id="elementor-finder__no-results"><?php echo esc_html__( 'No Results Found', 'elementor' ); ?></div> <div id="elementor-finder__results"></div> </script> <script type="text/template" id="tmpl-elementor-finder__results__category"> <div class="elementor-finder__results__category__title">{{{ title }}}</div> <div class="elementor-finder__results__category__items"></div> </script> <script type="text/template" id="tmpl-elementor-finder__results__item"> <a href="{{ url }}" class="elementor-finder__results__item__link"> <div class="elementor-finder__results__item__icon"> <i class="eicon-{{{ icon }}}" aria-hidden="true"></i> </div> <div class="elementor-finder__results__item__title">{{{ title }}}</div> <# if ( description ) { #> <div class="elementor-finder__results__item__description">- {{{ description }}}</div> <# } #> <# if ( lock ) { #> <div class="elementor-finder__results__item__badge"><i class="{{{ lock.badge.icon }}}"></i>{{ lock.badge.text }}</div> <# } #> </a> <# if ( actions.length ) { #> <div class="elementor-finder__results__item__actions"> <# jQuery.each( actions, function() { #> <a class="elementor-finder__results__item__action elementor-finder__results__item__action--{{ this.name }}" href="{{ this.url }}" target="_blank"> <i class="eicon-{{{ this.icon }}}"></i> </a> <# } ); #> </div> <# } #> </script> breadcrumbs/widgets/breadcrumbs.php 0000644 00000134747 15112147616 0013531 0 ustar 00 <?php namespace ElementorExtras\Modules\Breadcrumbs\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Utils; // Elementor Classes use Elementor\Icons_Manager; use Elementor\Controls_Manager; use Elementor\Repeater; use Elementor\Group_Control_Border; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Box_Shadow; use Elementor\Modules\DynamicTags\Module as TagsModule; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Breadcrumbs * * @since 1.2.0 */ class Breadcrumbs extends Extras_Widget { /** * Crumbs * * @since 2.2.8 * @var string */ protected $crumbs = []; /** * Separator * * @since 1.2.0 * @var string */ private $_separator = null; /** * Get Name * * Get the name of the widget * * @since 1.2.0 * @return string */ public function get_name() { return 'ee-breadcrumbs'; } /** * Get Title * * Get the title of the widget * * @since 1.2.0 * @return string */ public function get_title() { return __( 'Breadcrumbs', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 1.2.0 * @return string */ public function get_icon() { return 'nicon nicon-breadcrumbs'; } /** * Register Widget Controls * * @since 1.2.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_content', [ 'label' => __( 'Display', 'elementor-extras' ), ] ); $this->add_control( 'source', [ 'label' => __( 'Query Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Current Query', 'elementor-extras' ), 'id' => __( 'Custom Selection', 'elementor-extras' ), ] ] ); $this->add_control( 'source_id', [ 'label' => __( 'Page or Post', 'elementor-extras' ), 'type' => 'ee-query', 'query_type' => 'posts', 'label_block' => false, 'multiple' => false, 'condition' => [ 'source' => 'id', ], ] ); $this->add_control( 'show_home', [ 'label' => __( 'Show Home', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', ] ); $this->add_control( 'show_current', [ 'label' => __( 'Show Current', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', ] ); $this->add_control( 'structured_data', [ 'label' => __( 'Add Structured Data', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', ] ); $this->add_control( 'home_text', [ 'label' => __( 'Home Text', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Homepage', 'elementor-extras' ), 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY ] ], 'condition' => [ 'show_home' => 'yes' ], ] ); $this->end_controls_section(); $post_types = Utils::get_public_post_types_options( true, false ); foreach ( $post_types as $post_type => $label ) { $this->start_controls_section( 'section_single_' . $post_type, [ 'label' => sprintf( __( 'Single %s', 'elementor-extras' ), $label ), ] ); $this->add_control( 'single_' . $post_type . '_show_home', [ 'label' => __( 'Show Home', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'show_home!' => '', ], ] ); $this->add_control( 'single_' . $post_type . '_show_cpt', [ 'label' => __( 'Show Post Type', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', ] ); $taxonomies_options = Utils::get_taxonomies_options( $post_type ); foreach ( $taxonomies_options as $taxonomy => $label ) { if ( $taxonomy && ! is_taxonomy_hierarchical( $taxonomy ) ) { unset( $taxonomies_options[ $taxonomy ] ); } } $tax_options_default = ( $taxonomies_options && ! empty( $taxonomies_options[0] ) ) ? array_keys( $taxonomies_options )[0] : ''; $this->add_control( 'single_' . $post_type . '_show_terms', [ 'label' => __( 'Taxonomy', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => $tax_options_default, 'options' => array_merge( [ '' => __( 'None', 'elementor-extras' ), ], $taxonomies_options ), ] ); if ( is_post_type_hierarchical( $post_type ) ) { $this->add_control( 'single_' . $post_type . '_show_parents', [ 'label' => __( 'Show Parents', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', ] ); } $this->add_control( 'single_' . $post_type . '_show_current', [ 'label' => __( 'Show Current', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'show_current!' => '', ], ] ); $this->end_controls_section(); } $taxonomies = Utils::get_taxonomies_options(); foreach ( $taxonomies as $taxonomy => $label ) { $this->start_controls_section( 'section_taxonomy_' . $taxonomy, [ 'label' => sprintf( __( '%s Archive', 'elementor-extras' ), $label ), ] ); $this->add_control( 'taxonomy_' . $taxonomy . '_show_home', [ 'label' => __( 'Show Home', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'show_home!' => '', ], ] ); $this->add_control( 'taxonomy_' . $taxonomy . '_show_cpt', [ 'label' => __( 'Show Post Type', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'category' === $taxonomy || 'post_tag' === $taxonomy ? '' : 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', ] ); $this->add_control( 'taxonomy_' . $taxonomy . '_show_taxonomy', [ 'label' => __( 'Show Taxonomy', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'category' === $taxonomy || 'post_tag' === $taxonomy ? 'yes' : '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', ] ); $this->add_control( 'taxonomy_' . $taxonomy . '_taxonomy_link', [ 'label' => __( 'Taxonomy Link', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'placeholder' => esc_url( home_url( '/' ) ), 'dynamic' => [ 'active' => true ], 'label_block' => false, 'condition' => [ 'taxonomy_' . $taxonomy . '_show_taxonomy!' => '', ], ] ); if ( is_taxonomy_hierarchical( $taxonomy ) ) { $this->add_control( 'taxonomy_' . $taxonomy . '_show_parents', [ 'label' => sprintf( __( 'Show Parent %s', 'elementor-extras' ), $label ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', ] ); } $this->add_control( 'taxonomy_' . $taxonomy . '_show_current', [ 'label' => __( 'Show Current', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'show_current!' => '', ], ] ); $this->end_controls_section(); } $custom_post_types = Utils::get_public_post_types_options( true, false, [ 'public' => true, '_builtin' => false, ] ); if ( $custom_post_types ) { foreach ( $custom_post_types as $post_type => $label ) { $this->start_controls_section( 'section_cpt_' . $post_type, [ 'label' => sprintf( __( '%s Archive', 'elementor-extras' ), $label ), ] ); $this->add_control( 'cpt_' . $post_type . '_show_home', [ 'label' => __( 'Show Home', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'show_home!' => '', ], ] ); $this->add_control( 'cpt_' . $post_type . '_show_current', [ 'label' => __( 'Show Current', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'show_current!' => '', ], ] ); $this->end_controls_section(); } } $this->start_controls_section( 'section_separator', [ 'label' => __( 'Separator', 'elementor-extras' ), ] ); $this->add_control( 'separator_type', [ 'label' => __( 'Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'icon', 'options' => [ 'text' => __( 'Text', 'elementor-extras' ), 'icon' => __( 'Icon', 'elementor-extras' ), ], ] ); $this->add_control( 'separator_text', [ 'label' => __( 'Text', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( '>', 'elementor-extras' ), 'condition' => [ 'separator_type' => 'text' ], ] ); $this->add_control( 'selected_separator_icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'separator_icon', 'condition' => [ 'separator_type' => 'icon' ], 'default' => [ 'value' => 'fas fa-angle-right', 'library' => 'fa-solid', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_item_style', [ 'label' => __( 'Crumbs', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'items_align', [ 'label' => __( 'Align Crumbs', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], 'stretch' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-h-align-stretch', ], ], 'prefix_class' => 'ee-breadcrumbs-align%s-', ] ); $this->add_responsive_control( 'items_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'item_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 12 ], 'range' => [ 'px' => [ 'max' => 36, ], ], 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs' => 'margin-left: -{{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-breadcrumbs__item' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-breadcrumbs__separator' => 'margin-left: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'item_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs__item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'allowed_dimensions' => [ 'right', 'left' ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'item_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-breadcrumbs__item', ] ); $this->add_control( 'item_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs__item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'item_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-breadcrumbs__text', ] ); $this->start_controls_tabs( 'crumb_style' ); $this->start_controls_tab( 'crumb_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'item_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs__item' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'item_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_ACCENT, ], 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs__item' => 'color: {{VALUE}};', '{{WRAPPER}} .ee-breadcrumbs__item a' => 'color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'crumb_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'item_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs__item:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'item_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs__item:hover' => 'color: {{VALUE}};', '{{WRAPPER}} .ee-breadcrumbs__item:hover a' => 'color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_separator_style', [ 'label' => __( 'Separators', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'separator_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs__separator' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'allowed_dimensions' => [ 'right', 'left' ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'separator_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-breadcrumbs__separator', ] ); $this->add_control( 'separator_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs__separator' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'separator_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs__separator' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'separator_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs__separator' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'separator_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-breadcrumbs__separator', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_current_style', [ 'label' => __( 'Current', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'current_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-breadcrumbs__item--current', ] ); $this->add_control( 'current_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs__item--current' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'current_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs__item--current' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'current_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_TEXT, ], 'selectors' => [ '{{WRAPPER}} .ee-breadcrumbs__item--current' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'current_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-breadcrumbs__item--current .ee-breadcrumbs__text', ] ); $this->end_controls_section(); } /** * Get Query * * @since 1.2.0 * @return \WP_Query|bool */ protected function get_query() { global $post; $settings = $this->get_settings_for_display(); $_id = null; $_post_type = 'post'; if ( 'id' === $settings['source'] && '' !== $settings['source_id'] ) { $_id = $settings['source_id']; $_post_type = 'any'; $_args = array( 'p' => $_id, 'post_type' => $_post_type, ); // Create custom query $_post_query = new \WP_Query( $_args ); return $_post_query; } return false; } /** * Set Separator * * Sets the markup for the breadcrumbs separator * * @since 1.2.0 * @return string */ protected function set_separator() { $settings = $this->get_settings_for_display(); $separator = ''; $has_icon = ! empty( $settings['separator_icon'] ) || ! empty( $settings['selected_separator_icon']['value'] ); if ( 'icon' === $settings['separator_type'] && $has_icon ) { $migrated = isset( $settings['__fa4_migrated']['selected_separator_icon'] ); $is_new = empty( $settings['icon'] ) && Icons_Manager::is_migration_allowed(); $this->add_render_attribute( 'icon-wrapper', 'class', [ 'ee-icon', 'ee-icon-support--svg', ] ); $separator .= '<span ' . $this->get_render_attribute_string( 'icon-wrapper' ) . '>'; if ( $is_new || $migrated ) { ob_start(); Icons_Manager::render_icon( $settings['selected_separator_icon'], [ 'aria-hidden' => 'true' ] ); $separator .= ob_get_clean(); } else { $this->add_render_attribute( 'icon', [ 'class' => $settings['separator_icon'], 'aria-hidden' => 'true', ] ); $separator .= '<i '. $this->get_render_attribute_string('icon') . '></i>'; } $separator .= '</span>'; } else { $this->add_inline_editing_attributes( 'separator_text' ); $this->add_render_attribute( 'separator_text', 'class', 'ee-breadcrumbs__separator__text' ); /** * Separator Text filter * * Filters the separator text if the separator is set as text * in the widget settings * * @since 2.2.0 * @param string $separator_text The separator text setting */ $separator_text = apply_filters( 'elementor_extras/widgets/breadcrumbs/separator/text', $settings['separator_text'] ); $separator = '<span ' . $this->get_render_attribute_string( 'separator_text' ) . '>' . $separator_text . '</span>'; } $this->_separator = $separator; } /** * Get Separator * * @since 1.2.0 * @return var\string */ protected function get_separator() { return $this->_separator; } /** * Render * * Render widget contents on frontend * * @since 1.2.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); $_query = $this->get_query(); $this->set_separator(); $this->add_render_attribute( 'breadcrumbs', 'class', 'ee-breadcrumbs' ); if ( $settings['structured_data'] ) { $this->add_render_attribute( 'breadcrumbs', [ 'itemscope' => "", 'itemtype' => "http://schema.org/BreadcrumbList", ] ); } if ( $_query ) { if ( $_query->have_posts() ) { // Setup post $_query->the_post(); /** * Post Query Filter * * Filters the post query when breadcrumbs are set for a specific page * * @since 2.2.0 * @param WP_Query $_query The current query */ $_query = apply_filters( 'elementor_extras/widgets/breadcrumbs/query', $_query ); // Render using the new query $this->render_breadcrumbs( $_query ); // Reset post data to original query wp_reset_postdata(); wp_reset_query(); } else { _e( 'Post or page not found', 'elementor-extras' ); } } else { // Render using the original query $this->render_breadcrumbs(); } } /** * Render Separator * * The markup for the separator item * * @since 1.2.0 * @param bool $output Wether to echo or not the markup * @return void */ protected function render_separator( $output = true ) { $this->add_render_attribute( 'separator', [ 'class' => [ 'ee-breadcrumbs__separator', ], ] ); $separator = $this->get_separator(); /** * Separator filter * * Filters the separator * * @since 2.2.0 * @param string $post_title The markup for the separator */ $separator = apply_filters( 'elementor_extras/widgets/breadcrumbs/separator', $separator ); $markup = sprintf( '<li %1$s>%2$s</li>', $this->get_render_attribute_string( 'separator' ), $separator ); if ( $output === true ) { echo $markup; } else { return $markup; } } /** * Render Breadcrumbs * * Identifies and outputs all the breadcrumbs * * @access protected * * @since 1.2.0 * @param WP_Query|bool $query Query used to render the breadcrumbs * @return void */ protected function render_breadcrumbs( $query = false ) { global $post, $wp_query; if ( $query === false ) { // Reset post data to parent query $wp_query->reset_postdata(); // Set active query to native query $query = $wp_query; } if ( $query->is_front_page() || $query->is_home() ) { return; } $this->set_crumbs( $query ); ?><ul <?php echo $this->get_render_attribute_string( 'breadcrumbs' ); ?>><?php $this->render_crumbs(); ?></ul><?php } /** * Set Crumbs * * Checks current query to determine which * crumbs need to be added * * @access private * * @since 2.2.8 * @param WP_Query $query The query to check * @return void */ private function set_crumbs( $query ) { $is_custom_archive = $query->is_archive() && ! $query->is_tax() && ! $query->is_category() && ! $query->is_tag() && ! $query->is_date() && ! $query->is_author() && ! $query->is_post_type_archive(); if ( $is_custom_archive ) { $this->add_custom_archive(); } else if ( $query->is_post_type_archive() ) { $this->add_post_type_archive(); } else if ( $query->is_archive() && ( $query->is_tax() || $query->is_category() || $query->is_tag() ) ) { $this->add_taxonomy_archive(); } else if ( $query->is_single() || $query->is_page() ) { $this->add_single( false, $query ); } else if ( $query->is_day() ) { $this->add_day(); } else if ( $query->is_month() ) { $this->add_month(); } else if ( $query->is_year() ) { $this->add_year(); } else if ( $query->is_author() ) { $this->add_author(); } else if ( $query->is_search() ) { $this->add_search(); } elseif ( $query->is_404() ) { $this->add_404(); } } /** * Add Crumbs * * Adds a new crumbs to the crumbs list * * @since 2.2.8 * @param string $name The name of the crumb * @param array $args The crumbs settings * @return void */ private function add_crumb( $name, $args = [] ) { if ( ! $name || empty( $args['key'] ) ) { return; } $args['name'] = $name; $this->crumbs[ $args['key'] ] = $args; } /** * Add Home Link Crumb * * The markup for the home link crumb * * @since 1.2.0 * @return void */ protected function add_home_link() { $settings = $this->get_settings_for_display(); if ( 'yes' !== $settings['show_home'] ) { return; } $this->add_crumb( 'home', [ 'key' => 'home', 'content' => $settings['home_text'], 'link' => get_home_url(), ] ); } /** * Add Custom Archive Crumbs * * @since 2.2.5 * @return void */ protected function add_custom_archive() { $this->add_crumb( 'archive', [ 'key' => 'archive', 'content' => post_type_archive_title( '', false ), ] ); } /** * Add Custom Taxonomy Archive Crumbs * * @since 2.2.5 * @return void */ protected function add_taxonomy_archive() { $term = get_queried_object(); $term_name = $term->name; $taxonomy = $term->taxonomy; $prefix = 'taxonomy_' . $taxonomy; $settings = $this->get_settings(); if ( '' !== $settings[ $prefix . '_show_home'] ) { $this->add_home_link(); } if ( 'post' === get_post_type() ) { $this->add_blog(); } if ( '' !== $settings[ $prefix . '_show_cpt'] ) { $this->add_post_type_archive_link(); } if ( '' !== $settings[ $prefix . '_show_taxonomy'] ) { $taxonomy_object = get_taxonomy( $taxonomy ); $taxonomy_link = $settings[ $prefix . '_taxonomy_link' ]; $this->add_crumb( 'taxonomy', [ 'key' => 'taxonomy', 'ids' => [ $taxonomy, $taxonomy_object->name ], 'content' => $taxonomy_object->labels->name, 'link' => $taxonomy_link['url'] ? $taxonomy_link['url'] : '', ] ); } if ( ! empty( $settings[ $prefix . '_show_parents'] ) && '' !== $settings[ $prefix . '_show_parents'] ) { $this->add_archive_term_parents( $term->term_id, $term->taxonomy ); } /** * Before Specific Last Taxonomy Term * * Fires right before the last specific custom taxonomy archive crumb * * The dynamic portion of the hook name, `$term_name`, refers to the slug of the term. * * @since 2.2.0 * @param WP_Term $term The last term * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/crumb/term/last/{$term_name}", $term, $this ); if ( '' !== $settings[ $prefix . '_show_current'] ) { $this->add_crumb( 'taxonomy-archive', [ 'key' => 'taxonomy-archive', 'ids' => [ $term->term_id, $term->slug ], 'content' => $term->name, 'link' => '', ] ); } } /** * Add Single Crumbs * * @since 2.2.5 * @return void */ protected function add_single( $post = false, $query ) { if ( ! $post ) { global $post; } $settings = $this->get_settings(); $post_type = get_post_type(); $post_types = get_post_types( [ 'show_in_nav_menus' => true, ], 'names' ); $prefix = 'single_' . $post_type; if ( ! in_array( $post_type, $post_types ) ) { return; } if ( array_key_exists( $prefix . '_show_home', $settings ) && $settings[ $prefix . '_show_home' ] ) { $this->add_home_link(); } /** * Before Single * * Fires right before any single crumb * * @since 2.2.0 * @param WP_Post $post The queried single post * @param Extras_Widget $this The current widget instance */ do_action( 'elementor_extras/widgets/breadcrumbs/before/crumb/single', $post, $this ); if ( 'post' === $post_type ) { $this->add_blog(); } if ( '' !== $settings[ $prefix . '_show_cpt'] ) { $this->add_post_type_archive_link( $post ); } if ( get_object_taxonomies( $post_type, 'objects' ) ) { if ( '' !== $settings[ $prefix . '_show_terms'] ) { $this->add_single_terms( $post ); } } if ( is_post_type_hierarchical( $post_type ) ) { if ( '' !== $settings[ $prefix . '_show_parents'] ) { $this->add_single_parents( $post ); } } /** * Before Single * * Fires right before any single crumb * * @since 2.2.0 * @param WP_Post $post The queried single post * @param Extras_Widget $this The current widget instance */ do_action( 'elementor_extras/widgets/breadcrumbs/before/crumb/single', $post, $this ); if ( array_key_exists( $prefix . '_show_current', $settings ) && '' !== $settings[ $prefix . '_show_current'] ) { $this->add_crumb( 'single', [ 'key' => 'single', 'ids' => [ $post->ID ], 'content' => get_the_title(), ] ); } } /** * Add Single Parents Crumbs * * @since 2.2.8 * @return void */ protected function add_single_parents( $post = false ) { if ( ! $post ) { global $post; } if ( ! $post->post_parent ) { return; } $parents = get_post_ancestors( $post->ID ); $parents = array_reverse( $parents ); if ( ! isset( $parents ) ) $parents = null; foreach ( $parents as $parent ) { /** * Before Page Crumb * * Fires right before any page crumb. * * @since 2.2.0 * @param WP_Post $parent The page object * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/crumb/page", $parent, $this ); $this->add_crumb( 'ancestor', [ 'key' => 'ancestor-' . $parent, 'ids' => [ $parent ], 'content' => get_the_title( $parent ), 'link' => get_permalink( $parent ), ] ); } } /** * Add Blog Crumb * * @since 2.2.6 * @return void */ protected function add_blog() { $posts_page_id = get_option( 'page_for_posts' ); if ( $posts_page_id ) { $blog = get_post( $posts_page_id ); /** * Before Blog Crumb * * Fires right before a blog main page crumb is rendered * * @since 2.2.0 * @param WP_Post $blog The blog page * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/crumb/single/blog", $blog, $this ); $this->add_crumb( 'blog', [ 'key' => 'blog', 'ids' => [ $blog->ID ], 'content' => $blog->post_title, 'link' => get_permalink( $blog->ID ), ] ); } } /** * Add Post Type Archive Crumbs * * @since 2.2.5 * @return void */ protected function add_post_type_archive( $post = false ) { $post_type = get_post_type( $post ); $settings = $this->get_settings(); if ( '' !== $settings['cpt_' . $post_type . '_show_home'] ) { $this->add_home_link(); } if ( '' !== $settings['cpt_' . $post_type . '_show_current'] ) { $this->add_post_type_archive_link( $post ); } } /** * Add Post Type Archive Link Crumb * * @since 2.2.8 * @return void */ protected function add_post_type_archive_link( $post = false ) { if ( ! $post ) { global $post; } $queried_object = get_queried_object(); if ( is_post_type_archive() ) { $post_type = $queried_object->name; } elseif ( is_archive() && ( is_tax() || is_category() || is_tag() ) ) { $post_type = get_taxonomy( $queried_object->taxonomy )->object_type[0]; } elseif ( is_single() || is_page() ) { $post_type = get_post_type( $post ); } else { return; } $post_type_object = get_post_type_object( $post_type ); /** * Before Post Type Archive * * Fires right before a custom post type archive crumb * * @since 2.2.0 * @param object $post_type_object The queried post type object * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/crumb/post_type/{$post_type}", $post_type_object, $this ); switch ( $post_type ) { case 'post': $page_for_posts = get_option( 'page_for_posts' ); $link = $page_for_posts ? get_permalink( get_option( 'page_for_posts' ) ) : esc_url( home_url( '/' ) ); break; case 'page': $link = esc_url( home_url( '/' ) ); break; default: $link = get_post_type_archive_link( $post_type ); break; } $this->add_crumb( 'post-type-archive', [ 'key' => 'post-type-archive', 'ids' => [ $post_type ], 'content' => $post_type_object->labels->name, 'link' => $link, ] ); } /** * Render Single Terms * * @since 2.2.6 * @return void */ protected function add_single_terms( $post = false ) { if ( ! $post ) { global $post; } $terms = []; $taxonomies = get_post_taxonomies( $post->ID ); $settings = $this->get_settings(); $show_tax = $settings['single_' . get_post_type() . '_show_terms']; foreach ( $taxonomies as $index => $taxonomy ) { if ( '' !== $show_tax && $show_tax !== $taxonomy ) { continue; } $taxonomy_terms = wp_get_post_terms( $post->ID, $taxonomy, [ 'hide_empty' => false, ] ); Utils::sort_terms_hierarchicaly( $taxonomy_terms, $terms ); } if ( $terms ) { $this->add_terms_recursive( $terms ); } } /** * Render Single Terms * * @since 2.2.6 * @return void */ protected function add_archive_term_parents( $term_id, $taxonomy ) { $parents = get_ancestors( $term_id, $taxonomy ); if ( $parents ) { $ordered_parents = []; $parent_terms = get_terms( [ 'taxonomy' => $taxonomy, 'include' => $parents, ] ); Utils::sort_terms_hierarchicaly( $parent_terms, $ordered_parents ); if ( $ordered_parents ) { $this->add_terms_recursive( $ordered_parents ); } } } /** * Add Terms Crumbs Recursively * * @since 2.2.5 * @return void */ protected function add_terms_recursive( $terms ) { foreach ( $terms as $term_id => $term ) { /** * Before Taxonomy Term * * Fires right before a custom taxonomy term that is not * the current or last one. * * The dynamic portion of the hook name, `$term_slug`, refers to the slug of the term. * * @since 2.2.0 * @param WP_Term $term The queried term * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/crumb/term/{$term->slug}", $term, $this ); $this->add_crumb( 'taxonomy-terms', [ 'key' => 'term-' . $term_id, 'ids' => [ $term->term_id, $term->slug ], 'content' => $term->name, 'link' => get_term_link( $term_id ), ] ); if ( $term->children ) { $this->add_terms_recursive( $term->children ); } } } /** * Add Tag Crumb * * @since 2.2.5 * @return void */ protected function add_tag() { $term_id = get_query_var('tag_id'); $taxonomy = 'post_tag'; $args = 'include=' . $term_id; $terms = get_terms([ 'taxonomy' => $taxonomy, 'include' => $term_id, ]); $tag = $terms[0]; /** * Before Tag Crumb * * Fires right before a tag crumb. * * @since 2.2.0 * @param WP_Post $post The page object * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/crumb/tag", $tag, $this ); $this->add_crumb( 'tag', [ 'key' => 'tag', 'ids' => [ $tag->term_id, $tag->slug ], 'content' => sprintf( __( 'Tag: %s', 'elementor-extras' ), $tag->name ), ] ); } /** * Add Day Crumb * * @since 2.2.5 * @return void */ protected function add_day() { $this->add_year( false ); $this->add_month( false ); /** * Before Day Crumb * * Fires right before a day crumb. * * @since 2.2.0 * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/crumb/day", $this ); $this->add_crumb( 'day', [ 'key' => 'day', 'ids' => [ get_the_time('j') ], 'content' => sprintf( __( '%1$s %2$s Archives', 'elementor-extras' ), get_the_time('F'), get_the_time('jS') ), ] ); } /** * Add Month Crumb * * @since 2.2.5 * @return void */ protected function add_month() { $this->add_year( false ); /** * Before Month Crumb * * Fires right before a month crumb. * * @since 2.2.0 * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/crumb/month", $this ); $this->add_crumb( 'month', [ 'key' => 'month', 'ids' => [ get_the_time('m') ], 'content' => sprintf( __( '%s Archives', 'elementor-extras' ), get_the_time('F') ), ] ); } /** * Add Year Crumb * * @since 2.2.5 * @return void */ protected function add_year() { /** * Before Year Crumb * * Fires right before a year crumb. * * @since 2.2.0 * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/crumb/year", $this ); $this->add_crumb( 'year', [ 'key' => 'year', 'ids' => [ get_the_time('Y') ], 'content' => sprintf( __( '%s Archives', 'elementor-extras' ), get_the_time('Y') ), ] ); } /** * Add Author Crumb * * @since 2.2.5 * @return void */ protected function add_author() { global $author; $userdata = get_userdata( $author ); /** * Before Author Crumb * * Fires right before an author crumb. * * @since 2.2.0 * @param WP_User $post The queried author * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/crumb/author", $author, $this ); $this->add_crumb( 'author', [ 'key' => 'author', 'ids' => [ $userdata->user_nicename ], 'content' => sprintf( __( 'Author: %s', 'elementor-extras' ), $userdata->display_name ), ] ); } /** * Add Search Crumb * * @since 2.2.5 * @return void */ protected function add_search() { /** * Before Search Query Crumb * * Fires right before an author crumb. * * @since 2.2.0 * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/crumb/search", $this ); $this->add_crumb( 'search', [ 'current' => true, 'separator' => false, 'key' => 'search', 'content' => sprintf( __( 'Search results for: %s', 'elementor-extras' ), get_search_query() ), ] ); } /** * Add 404 crumb * * @since 2.2.5 * @return void */ protected function add_404() { /** * Before 404 Crumb * * Fires right before a 404 crumb. * * @since 2.2.0 * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/crumb/404", $this ); $this->add_crumb( '404', [ 'current' => true, 'separator' => false, 'key' => '404', 'content' => __( 'Page not found', 'elementor-extras' ), ] ); } /** * Render Item * * Gets the markup for a breadcrumb item * * @since 1.2.0 * @param name|string * @param args|array * @return void */ protected function render_crumb( $key, $index, $args ) { global $wp; $defaults = [ 'key' => false, 'ids' => [], 'content' => '', 'link' => false, 'current' => $index === count( $this->crumbs ) - 1, ]; $args = wp_parse_args( $args, $defaults ); if ( $args['current'] && '' === $this->get_settings( 'show_current' ) ) { return; } $item_key = $args['key'] . '-item'; $text_key = $args['key'] . '-text'; $pos_key = $args['key'] . '-position'; $link_key = $args['key'] . '-link'; $link_tag = ( ! $args['current'] ) ? 'a' : 'link'; $classes = []; if ( '' !== $args['link'] ) { $this->add_render_attribute( $link_key, 'href', $args['link'] ); } else { $this->add_render_attribute( $link_key, 'href', home_url( $wp->request ) ); } if ( $args['current'] ) { $classes[] = 'ee-breadcrumbs__item--current'; } else { $classes[] = 'ee-breadcrumbs__item--parent'; } if ( ! empty( $args['name'] ) ) { $classes[] = 'ee-breadcrumbs__item--' . $args['name']; } if ( ! empty( $args['ids'] ) && is_array( $args['ids'] ) ) { foreach ( $args['ids'] as $id ) { if ( ! empty( $args['name'] ) ) { $classes[] = 'ee-breadcrumbs__item--' . $args['name'] . '-' . $id; } else { $classes[] = 'ee-breadcrumbs__item--' . $id; } } } $this->add_item_render_attribute( $item_key, $index ); $this->add_render_attribute( [ $item_key => [ 'class' => $classes, ], $text_key => [ 'class' => 'ee-breadcrumbs__text', ], $pos_key => [ 'content' => $index, ], ] ); $this->add_link_render_attribute( $link_key ); if ( $this->get_settings('structured_data') ) { $this->add_render_attribute( [ $text_key => [ 'itemprop' => 'name', ], $pos_key => [ 'itemprop' => 'position', ], ] ); } /** * Before Crumb * * Fires right before any breadcrumb * * @since 2.2.0 * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/crumb", $this ); ?><li <?php echo $this->get_render_attribute_string( $item_key ); ?>> <<?php echo $link_tag; ?> <?php echo $this->get_render_attribute_string( $link_key ); ?>> <span <?php echo $this->get_render_attribute_string( $text_key ); ?>> <?php echo $args['content']; ?> </span> </<?php echo $link_tag; ?>> <meta <?php echo $this->get_render_attribute_string( $pos_key ); ?>> </li><?php if ( ! $args['current'] ) /** * After Crumb * * Fires right after any breadcrumb * * @since 2.2.0 * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/after/crumb", $this ); /** * Before Separator * * Fires right before any separator * * @since 2.2.0 * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/before/separator", $this ); if ( false === $args['current'] ) { $this->render_separator(); } /** * After Separator * * Fires right after any separator * * @since 2.2.0 * @param Extras_Widget $this The current widget instance */ do_action( "elementor_extras/widgets/breadcrumbs/after/separator", $this ); } /** * Render Crumbs * * Adds the render attributes for a specified item * * @access private * * @since 2.2.8 * @return void */ private function render_crumbs() { $index = 0; /** * Crumbs filter * * Filters the final array of crumbs * * @since 2.2.43 * @param string $crumbs The array of crumbs */ $this->crumbs = apply_filters( "elementor_extras/widgets/breadcrumbs/crumbs", $this->crumbs ); foreach ( $this->crumbs as $name => $args ) { $this->render_crumb( $name, $index, $args ); $index++; } } /** * Add Item Render Attribute * * Adds the render attributes for a specified item * * @since 1.2.0 * @param key|string The render attribute key for the item * @param. index|int The index of the item. Defaults to 0 * @return void */ protected function add_item_render_attribute( $key, $index = 0 ) { $this->add_render_attribute( $key, 'class', 'ee-breadcrumbs__item' ); if ( $this->get_settings('structured_data') ) { $this->add_render_attribute( $key, [ 'itemprop' => 'itemListElement', 'itemscope' => '', 'itemtype' => 'http://schema.org/ListItem', ] ); } } /** * Add Link Render Attribute * * Adds the render attributes for the item link * * @since 1.2.0 * @param key|string The render attribute key for the item * @return void */ protected function add_link_render_attribute( $key ) { $this->add_render_attribute( $key, 'class', 'ee-breadcrumbs__crumb' ); if ( $this->get_settings('structured_data') ) { $this->add_render_attribute( $key, 'itemprop', 'item' ); } } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 1.2.0 * @return void */ protected function content_template() {} } breadcrumbs/module.php 0000644 00000001150 15112147616 0011034 0 ustar 00 <?php namespace ElementorExtras\Modules\Breadcrumbs; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Breadcrumbs\Module * * @since 1.6.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.6.0 * @return string */ public function get_name() { return 'breadcrumbs'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.6.0 * @return array */ public function get_widgets() { return [ 'Breadcrumbs', ]; } } buttons/widgets/button-group.php 0000644 00000142030 15112147616 0013072 0 ustar 00 <?php namespace ElementorExtras\Modules\Buttons\Widgets; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Group_Control_Button_Effect; use ElementorExtras\Base\Extras_Widget; // Elementor Classes use Elementor\Repeater; use Elementor\Icons_Manager; use Elementor\Controls_Manager; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Border; use Elementor\Group_Control_Typography; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Button_Group * * @since 0.1.0 */ class Button_Group extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 0.1.0 * @return string */ public function get_name() { return 'button-group'; } /** * Get Title * * Get the title of the widget * * @since 0.1.0 * @return string */ public function get_title() { return __( 'Buttons', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 0.1.0 * @return string */ public function get_icon() { return 'nicon nicon-button-group'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 0.1.0 * @return array */ public function get_script_depends() { return [ 'hotips', 'resize', ]; } /** * Register Widget Controls * * @since 0.1.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_buttons', [ 'label' => __( 'Buttons', 'elementor-extras' ), ] ); $repeater = new Repeater(); $repeater->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'typography', 'label' => __( 'Typography', 'elementor-extras' ), 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}} .ee-button-text', 'separator' => 'after', 'condition' => [ 'button_custom_style!' => '' ] ] ); $repeater->start_controls_tabs( 'buttons_repeater' ); $repeater->start_controls_tab( 'tab_content', [ 'label' => __( 'Content', 'elementor-extras' ) ] ); $repeater->add_control( 'text', [ 'label' => __( 'Text', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Click me', 'elementor-extras' ), 'placeholder' => __( 'Click me', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], ] ); $repeater->add_control( 'tooltip', [ 'label' => __( 'Enable Tooltip', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'tooltip', ] ); $repeater->add_control( 'tooltip_position', [ 'label' => __( 'Show tooltip at', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Global', 'elementor-extras' ), 'bottom' => __( 'Bottom', 'elementor-extras' ), 'left' => __( 'Left', 'elementor-extras' ), 'top' => __( 'Top', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'condition' => [ 'tooltip!' => '' ] ] ); $repeater->add_control( 'tooltip_arrow_position_h', [ 'label' => __( 'Tooltip Show at', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Default', 'elementor-extras' ), 'center' => __( 'Center', 'elementor-extras' ), 'left' => __( 'Left', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'condition' => [ 'tooltip_position' => [ 'top', 'bottom' ], ], ] ); $repeater->add_control( 'tooltip_arrow_position_v', [ 'label' => __( 'Tooltip Show at', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Default', 'elementor-extras' ), 'center' => __( 'Center', 'elementor-extras' ), 'bottom' => __( 'Bottom', 'elementor-extras' ), 'top' => __( 'Top', 'elementor-extras' ), ], 'condition' => [ 'tooltip_position' => [ 'left', 'right' ], ], ] ); $repeater->add_control( 'tooltip_content', [ 'label' => __( 'Tooltip Content', 'elementor-extras' ), 'type' => Controls_Manager::TEXTAREA, 'default' => __( 'I am a tooltip for a button', 'elementor-extras' ), 'placeholder' => __( 'I am a tooltip for a button', 'elementor-extras' ), 'title' => __( 'Tooltip Content', 'elementor-extras' ), 'rows' => 5, 'dynamic' => [ 'active' => true ], 'condition' => [ 'tooltip!' => '' ] ] ); $repeater->add_control( 'link', [ 'label' => __( 'Link', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'placeholder' => esc_url( home_url( '/' ) ), 'dynamic' => [ 'active' => true ], 'label_block' => false, ] ); $repeater->add_control( 'selected_icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'icon', ] ); $repeater->add_control( 'icon_align', [ 'label' => __( 'Icon Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'left', 'options' => [ 'left' => __( 'Before', 'elementor-extras' ), 'right' => __( 'After', 'elementor-extras' ), ], 'condition' => [ 'selected_icon[value]!' => '', ], ] ); $repeater->add_control( 'icon_indent', [ 'label' => __( 'Icon Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 50, ], ], 'condition' => [ 'selected_icon[value]!' => '', ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-icon--right' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}} {{CURRENT_ITEM}} .ee-icon--left' => 'margin-right: {{SIZE}}{{UNIT}};', ], ] ); $repeater->add_control( 'view', [ 'label' => __( 'View', 'elementor-extras' ), 'type' => Controls_Manager::HIDDEN, 'default' => 'traditional', ] ); $repeater->add_control( '_element_id', [ 'label' => __( 'CSS ID', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '', 'label_block' => false, 'title' => __( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor-extras' ), ] ); $repeater->add_control( 'css_classes', [ 'label' => __( 'CSS Classes', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '', 'label_block' => false, 'title' => __( 'Add your custom class WITHOUT the dot. e.g: my-class', 'elementor-extras' ), ] ); $repeater->end_controls_tab(); $repeater->start_controls_tab( 'tab_layout', [ 'label' => __( 'Layout', 'elementor-extras' ) ] ); $repeater->add_control( 'size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'sm', 'options' => Utils::get_button_sizes(), ] ); $repeater->add_responsive_control( 'label_min_width', [ 'label' => __( 'Label Min Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 10, 'max' => 1000, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-button-text' => 'min-width: {{SIZE}}px;', ] ] ); $repeater->add_responsive_control( 'min_width', [ 'label' => __( 'Button Min Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 10, 'max' => 1000, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-button' => 'min-width: {{SIZE}}px;', ] ] ); $repeater->add_control( 'text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-button-text' => 'text-align: {{VALUE}};' ] ] ); $repeater->end_controls_tab(); $repeater->start_controls_tab( 'tab_style', [ 'label' => __( 'Style', 'elementor-extras' ) ] ); $repeater->add_control( 'button_custom_style', [ 'label' => __( 'Custom', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'description' => __( 'Set custom styles that will only affect this specific button.', 'elementor-extras' ), ] ); $repeater->add_group_control( Group_Control_Button_Effect::get_type(), [ 'name' => 'button_effect', 'label' => __( 'Effect', 'elementor-extras' ), 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}} .ee-button-wrapper', 'condition' => [ 'button_custom_style!' => '' ], ] ); $repeater->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} {{CURRENT_ITEM}} .ee-button', 'condition' => [ 'button_custom_style!' => '' ] ] ); $repeater->add_control( 'border_radius', [ 'type' => Controls_Manager::DIMENSIONS, 'label' => __( 'Border Radius', 'elementor-extras' ), 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-button, {{WRAPPER}} {{CURRENT_ITEM}} .ee-effect--radius .ee-button:before, {{WRAPPER}} {{CURRENT_ITEM}} .ee-effect--radius .ee-button:after' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'button_custom_style!' => '', 'button_effect_type!' => '3d', ] ] ); $repeater->add_control( 'text_padding', [ 'label' => __( 'Text Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-button-content-wrapper, {{WRAPPER}} {{CURRENT_ITEM}} .ee-button:after' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'button_custom_style!' => '' ], 'separator' => 'before', ] ); $repeater->add_control( 'heading_style', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Default', 'elementor-extras' ), 'separator' => 'before', 'condition' => [ 'button_custom_style!' => '' ] ] ); $repeater->add_control( 'button_text_color', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-button' => 'color: {{VALUE}};', ], 'condition' => [ 'button_custom_style!' => '' ] ] ); $repeater->add_control( 'background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-button' => 'background-color: {{VALUE}};', ], 'condition' => [ 'button_custom_style!' => '' ] ] ); $repeater->add_control( 'heading_hover_style', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Hover', 'elementor-extras' ), 'separator' => 'before', 'condition' => [ 'button_custom_style!' => '' ] ] ); $repeater->add_control( 'hover_color', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-button-wrapper:hover .ee-button' => 'color: {{VALUE}};', ], 'condition' => [ 'button_custom_style!' => '' ] ] ); $repeater->add_control( 'button_background_hover_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-button-wrapper:hover .ee-button' => 'background-color: {{VALUE}};', ], 'condition' => [ 'button_custom_style!' => '' ] ] ); $repeater->add_control( 'button_hover_border_color', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'button_border_border!' => '', ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-button-wrapper:hover .ee-button' => 'border-color: {{VALUE}};', ], 'condition' => [ 'button_custom_style!' => '' ] ] ); $repeater->add_control( 'hover_animation', [ 'label' => __( 'Animation', 'elementor-extras' ), 'type' => Controls_Manager::HOVER_ANIMATION, 'condition' => [ 'button_custom_style!' => '' ] ] ); $repeater->end_controls_tab(); $repeater->end_controls_tabs(); $this->add_control( 'buttons', [ 'label' => __( 'Buttons', 'elementor-extras' ), 'type' => Controls_Manager::REPEATER, 'default' => [ [ 'text' => __( 'Button #1', 'elementor-extras' ) ], [ 'text' => __( 'Button #2', 'elementor-extras' ) ], ], 'fields' => $repeater->get_controls(), 'title_field' => '{{{ text }}}', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_tooltips', [ 'label' => __( 'Tooltips', 'elementor-extras' ), ] ); $this->add_responsive_control( 'trigger', [ 'label' => __( 'Trigger', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'mouseenter', 'tablet_default' => 'click_target', 'mobile_default' => 'click_target', 'options' => [ 'mouseenter' => __( 'Mouse Over', 'elementor-extras' ), 'click_target' => __( 'Click Target', 'elementor-extras' ), 'load' => __( 'Page Load', 'elementor-extras' ), ], 'frontend_available' => true ] ); $this->add_responsive_control( '_hide', [ 'label' => __( 'Hide on', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'mouseleave', 'tablet_default' => 'click_out', 'mobile_default' => 'click_out', 'options' => [ 'mouseleave' => __( 'Mouse Leave', 'elementor-extras' ), 'click_out' => __( 'Click Outside', 'elementor-extras' ), 'click_target' => __( 'Click Target', 'elementor-extras' ), 'click_any' => __( 'Click Anywhere', 'elementor-extras' ), ], 'frontend_available' => true ] ); $this->add_control( 'position', [ 'label' => __( 'Show to', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'bottom', 'options' => [ 'bottom' => __( 'Bottom', 'elementor-extras' ), 'left' => __( 'Left', 'elementor-extras' ), 'top' => __( 'Top', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'frontend_available' => true ] ); $this->add_control( 'arrow_position_h', [ 'label' => __( 'Show at', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Center', 'elementor-extras' ), 'left' => __( 'Left', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'condition' => [ 'position' => [ 'top', 'bottom' ], ], 'frontend_available' => true ] ); $this->add_control( 'arrow_position_v', [ 'label' => __( 'Show at', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Center', 'elementor-extras' ), 'top' => __( 'Top', 'elementor-extras' ), 'bottom' => __( 'Bottom', 'elementor-extras' ), ], 'condition' => [ 'position' => [ 'left', 'right' ], ], 'frontend_available' => true ] ); $this->add_control( 'css_position', [ 'label' => __( 'CSS Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => 'Absolute', 'fixed' => 'Fixed', ], 'frontend_available' => true, ] ); $this->add_control( 'disable', [ 'label' => __( 'Disable On', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'tablet' => __( 'Tablet & Mobile', 'elementor-extras' ), 'mobile' => __( 'Mobile', 'elementor-extras' ), ], 'frontend_available' => true ] ); $this->add_control( 'tooltips_arrow', [ 'label' => __( 'Arrow', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '""', 'options' => [ '""' => __( 'Show', 'elementor-extras' ), 'none' => __( 'Hide', 'elementor-extras' ), ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}:after' => 'content: {{VALUE}};', ], ] ); $this->add_control( 'delay_in', [ 'label' => __( 'Delay in (s)', 'elementor-extras' ), 'description' => __( 'Time until tooltips appear.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.1, ], ], 'frontend_available' => true ] ); $this->add_control( 'delay_out', [ 'label' => __( 'Delay out (s)', 'elementor-extras' ), 'description' => __( 'Time until tooltips dissapear.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.1, ], ], 'frontend_available' => true ] ); $this->add_control( 'duration', [ 'label' => __( 'Duration', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 2, 'step' => 0.1, ], ], 'frontend_available' => true ] ); $this->add_control( 'tooltips_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'description' => __( 'The distance between the tooltip and the hotspot. Defaults to 6px', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}.to--top' => 'transform: translateY(-{{SIZE}}{{UNIT}});', '.ee-tooltip.ee-tooltip-{{ID}}.to--bottom' => 'transform: translateY({{SIZE}}{{UNIT}});', '.ee-tooltip.ee-tooltip-{{ID}}.to--left' => 'transform: translateX(-{{SIZE}}{{UNIT}});', '.ee-tooltip.ee-tooltip-{{ID}}.to--right' => 'transform: translateX({{SIZE}}{{UNIT}});', ] ] ); $this->add_control( 'tooltips_offset', [ 'label' => __( 'Offset', 'elementor-extras' ), 'description' => __( 'Adjust offset to align arrow with target.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => -100, 'max' => 100, ], ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}.to--top, .ee-tooltip.ee-tooltip-{{ID}}.to--bottom' => 'margin-left: {{SIZE}}{{UNIT}};', '.ee-tooltip.ee-tooltip-{{ID}}.to--left, .ee-tooltip.ee-tooltip-{{ID}}.to--right' => 'margin-top: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'tooltips_width', [ 'label' => __( 'Maximum Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 350, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, ], ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'max-width: {{SIZE}}{{UNIT}};', ] ] ); $this->add_control( 'tooltips_zindex', [ 'label' => __( 'zIndex', 'elementor-extras' ), 'description' => __( 'Adjust the z-index of the tooltips. Defaults to 999', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => '999', 'min' => -9999999, 'step' => 1, 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'z-index: {{SIZE}};', ] ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style', [ 'label' => __( 'Buttons', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'vertical_align', [ 'label' => __( 'Vertical Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], 'stretch' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-v-align-stretch', ], ], 'prefix_class' => 'ee-button-group%s-valign-', ] ); $this->add_responsive_control( 'align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], 'justify' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-h-align-stretch', ], ], 'prefix_class' => 'ee-button-group%s-halign-' ] ); $this->add_control( 'content_align', [ 'label' => __( 'Align Content', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'justify', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], 'justify' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-h-align-stretch', ], ], 'condition' => [ 'align' => 'justify', ], 'prefix_class' => 'ee-button-group-content-halign-' ] ); $this->add_control( 'text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'condition' => [ 'align' => 'justify', 'content_align' => 'justify', ], 'selectors' => [ '{{WRAPPER}} .ee-button-text' => 'text-align: {{VALUE}};', ] ] ); $this->add_control( 'gap', [ 'label' => __( 'Buttons Gap', 'elementor-extras' ), 'description' => __( 'Select Custom to be able to specify a different gap for each breakpoint.', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), 'no' => __( 'No Gap', 'elementor-extras' ), 'narrow' => __( 'Narrow', 'elementor-extras' ), 'extended' => __( 'Extended', 'elementor-extras' ), 'wide' => __( 'Wide', 'elementor-extras' ), 'wider' => __( 'Wider', 'elementor-extras' ), 'custom' => __( 'Custom', 'elementor-extras' ), ], 'prefix_class' => 'ee-button-group-gap-', ] ); $this->add_responsive_control( 'custom_gap', [ 'label' => __( 'Custom Gap', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 100, ], ], 'condition' => [ 'gap' => 'custom', ], 'selectors' => [ // No stacking '{{WRAPPER}} .ee-button-group' => 'margin-left: -{{SIZE}}{{UNIT}}; margin-bottom: -{{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-button-gap' => 'margin-left: {{SIZE}}{{UNIT}}; margin-bottom: {{SIZE}}{{UNIT}};', // Stacked '(desktop){{WRAPPER}}.ee-button-group-stack-desktop .ee-button-gap:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};', '(tablet){{WRAPPER}}.ee-button-group-stack-tablet .ee-button-gap:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};', '(mobile){{WRAPPER}}.ee-button-group-stack-mobile .ee-button-gap:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], 'separator' => 'after', ] ); $this->add_control( 'text_padding', [ 'label' => __( 'Text Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-button-content-wrapper, {{WRAPPER}} .ee-button:after' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'buttons_border_radius', [ 'type' => Controls_Manager::DIMENSIONS, 'label' => __( 'Border Radius', 'elementor-extras' ), 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-button, {{WRAPPER}} .ee-effect--radius .ee-button:before' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'stack', [ 'label' => __( 'Stack', 'elementor-extras' ), 'description' => __( 'Choose on what breakpoint should the buttons begin to stack.', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'desktop' => __( 'Desktop', 'elementor-extras' ), 'tablet' => __( 'Tablet', 'elementor-extras' ), 'mobile' => __( 'Mobile', 'elementor-extras' ), ], 'prefix_class' => 'ee-button-group-stack-', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'typography', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_ACCENT, ], 'selector' => '{{WRAPPER}} .ee-button', ] ); $this->start_controls_tabs( 'buttons_style' ); $this->start_controls_tab( 'buttons_style_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'buttons_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-button', ] ); $this->add_control( 'buttons_text_color', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-button' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'buttons_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_ACCENT, ], 'selectors' => [ '{{WRAPPER}} .ee-button' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'buttons_box_shadow', 'selector' => '{{WRAPPER}} .ee-button', 'separator' => '', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'buttons_style_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'buttons_hover_color', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-button-wrapper:hover .ee-button' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'buttons_background_hover_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-button-wrapper:hover .ee-button' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'buttons_hover_border_color', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'button_border_border!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-button-wrapper:hover .ee-button' => 'border-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'buttons_hover_box_shadow', 'selector' => '{{WRAPPER}} .ee-button-wrapper:hover .ee-button', 'separator' => '', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_tooltips_style', [ 'label' => __( 'Tooltips', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'tooltips_align', [ 'label' => __( 'Text Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'tooltips_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'tooltips_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-tooltip.ee-tooltip-{{ID}}', ] ); $this->add_control( 'tooltips_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'tooltips_typography', 'selector' => '.ee-tooltip.ee-tooltip-{{ID}}', 'separator' => 'after', ] ); $this->add_control( 'tooltips_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => Utils::get_tooltip_background_selectors(), ] ); $this->add_control( 'tooltips_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'tooltips_box_shadow', 'selector' => '.ee-tooltip.ee-tooltip-{{ID}}', 'separator' => '', ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 0.1.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); if ( ! $settings['buttons'] ) { return; } $this->add_render_attribute( 'group', 'class', 'ee-button-group' ); ?><ul <?php echo $this->get_render_attribute_string( 'group' ); ?>><?php foreach ( $settings['buttons'] as $index => $item ) { $_has_tooltip = false; $has_icon = false; $button_text_clone = $item['text']; $gap_key = $this->get_repeater_setting_key( 'item', 'buttons', $index ); $wrapper_key = $this->get_repeater_setting_key( 'wrapper', 'buttons', $index ); $button_key = $this->get_repeater_setting_key( 'button', 'buttons', $index ); $icon_key = $this->get_repeater_setting_key( 'icon', 'buttons', $index ); $content_key = $this->get_repeater_setting_key( 'content', 'buttons', $index ); $tooltip_key = $this->get_repeater_setting_key( 'tooltip', 'buttons', $index ); $text_key = $this->get_repeater_setting_key( 'text', 'buttons', $index ); $content_id = $this->get_id() . '_' . $item['_id']; $this->add_render_attribute( [ $gap_key => [ 'class' => [ 'ee-button-gap', 'elementor-repeater-item-' . $item['_id'], ], ], $wrapper_key => [ 'class' => [ 'ee-button-wrapper', ], ], $button_key => [ 'class' => [ 'ee-button', ], ], $content_key => [ 'class' => [ 'ee-button-content-wrapper', ], ], $text_key => [ 'class' => [ 'ee-button-text', ], ], $tooltip_key => [ 'class' => 'hotip-content', 'id' => 'hotip-content-' . $content_id, ], ] ); $this->add_inline_editing_attributes( $text_key, 'none' ); $migrated = isset( $item['__fa4_migrated']['selected_icon'] ); $is_new = empty( $item['icon'] ) && Icons_Manager::is_migration_allowed(); if ( ! empty( $item['icon'] ) || ! empty( $item['selected_icon']['value'] ) ) { $this->add_render_attribute( $icon_key, 'class', [ 'ee-button-icon', 'ee-icon', 'ee-icon-support--svg', 'ee-icon--' . $item['icon_align'], ] ); if ( '' === $item['text'] ) { $this->add_render_attribute( $icon_key, 'class', [ 'ee-icon--flush', ] ); } $has_icon = true; } if ( 'tooltip' === $item['tooltip'] && ! empty( $item['tooltip_content'] ) ) { $this->add_render_attribute( $wrapper_key, [ 'class' => 'hotip', 'data-hotips-content' => '#hotip-content-' . $content_id, 'data-hotips-class' => [ 'ee-global', 'ee-tooltip', 'ee-tooltip-' . $this->get_id() ], 'data-hotips-position' => $item['tooltip_position'], 'data-hotips-arrow-position-h' => $item['tooltip_arrow_position_h'], 'data-hotips-arrow-position-v' => $item['tooltip_arrow_position_v'], ] ); $_has_tooltip = true; } if ( ! empty( $item['link']['url'] ) ) { $this->add_render_attribute( $button_key, 'class', 'ee-button-link' ); $this->add_render_attribute( $wrapper_key, 'href', $item['link']['url'] ); if ( ! empty( $item['link']['is_external'] ) ) { $this->add_render_attribute( $wrapper_key, 'target', '_blank' ); } if ( ! empty( $item['link']['nofollow'] ) ) { $this->add_render_attribute( $wrapper_key, 'rel', 'nofollow' ); } } if ( ! empty( $item['size'] ) ) { $this->add_render_attribute( $button_key, 'class', 'ee-size-' . $item['size'] ); } if ( $item['hover_animation'] ) { $this->add_render_attribute( $wrapper_key, 'class', 'elementor-animation-' . $item['hover_animation'] ); } if ( $item['css_classes'] ) { $this->add_render_attribute( $wrapper_key, 'class', $item['css_classes'] ); } if ( $item['_element_id'] ) { $this->add_render_attribute( $wrapper_key, 'id', $item['_element_id'] ); } if ( 'yes' === $item['button_custom_style'] ) { $this->add_render_attribute( $wrapper_key, 'class', [ 'ee-effect', 'ee-effect-type--' . $item['button_effect_type'] ] ); if ( in_array( $item['button_effect_type'], array( 'clone', 'back', '3d', 'flip', 'cube' )) && '' !== $item['button_effect_direction'] ) { $this->add_render_attribute( $wrapper_key, 'class', [ 'ee-effect-direction--' . $item['button_effect_direction'] ] ); } if ( in_array( $item['button_effect_type'], array( 'back' )) && '' !== $item['button_effect_orientation'] && '' === $item['button_effect_direction'] ) { $this->add_render_attribute( $wrapper_key, 'class', [ 'ee-effect-orientation--' . $item['button_effect_orientation'] ] ); } if ( in_array( $item['button_effect_type'], array( 'flip' )) ) { $this->add_render_attribute( $wrapper_key, 'class', [ 'ee-effect--radius' ] ); } if ( in_array( $item['button_effect_type'], array( 'clone', 'back', 'flip', '3d', 'cube' )) ) { $this->add_render_attribute( $wrapper_key, 'class', [ 'ee-effect--background' ] ); } if ( in_array( $item['button_effect_type'], array( 'clone', 'flip', 'cube' )) ) { $this->add_render_attribute( $wrapper_key, 'class', [ 'ee-effect--foreground' ] ); } if ( in_array( $item['button_effect_type'], array( 'back' )) ) { $this->add_render_attribute( $wrapper_key, 'class', [ 'ee-effect--double-background' ] ); } if ( in_array( $item['button_effect_type'], array( 'back' )) && '' !== $item['button_effect_double'] ) { $this->add_render_attribute( $wrapper_key, 'class', [ 'ee-effect--double' ] ); } if ( in_array( $item['button_effect_type'], array( 'clone' )) ) { $this->add_render_attribute( $wrapper_key, 'class', [ 'ee-effect-entrance--' . $item['button_effect_entrance'] ] ); } if ( in_array( $item['button_effect_type'], array( 'clone', '3d', 'flip', 'cube' )) ) { $this->add_render_attribute( $wrapper_key, 'class', [ 'ee-effect-zoom--' . $item['button_effect_zoom'] ] ); } if ( in_array( $item['button_effect_type'], array( 'clone', 'back' )) ) { $this->add_render_attribute( $wrapper_key, 'class', [ 'ee-effect-shape--' . $item['button_effect_shape'] ] ); } if ( in_array( $item['button_effect_type'], array( '3d', 'flip', 'cube' )) ) { $this->add_render_attribute( $wrapper_key, 'class', [ 'ee-effect--perspective' ] ); } if ( in_array( $item['button_effect_type'], array( 'clone', 'flip', 'cube' )) && '' !== $item['button_effect_text'] ) { $button_text_clone = $item['button_effect_text']; } } $this->add_render_attribute( $button_key, 'data-label', $button_text_clone ); if ( ( ! $this->_is_edit_mode && $item['text'] ) || $this->_is_edit_mode ) { ?><li <?php echo $this->get_render_attribute_string( $gap_key ); ?>> <a <?php echo $this->get_render_attribute_string( $wrapper_key ); ?>> <span <?php echo $this->get_render_attribute_string( $button_key ); ?>> <span <?php echo $this->get_render_attribute_string( $content_key ); ?>><?php if ( $has_icon ) { ?><span <?php echo $this->get_render_attribute_string( $icon_key ); ?>><?php if ( $is_new || $migrated ) { Icons_Manager::render_icon( $item['selected_icon'], [ 'aria-hidden' => 'true' ] ); } else { ?><i class="<?php echo esc_attr( $item['icon'] ); ?>" aria-hidden="true"></i><?php } ?></span><?php } ?><span <?php echo $this->get_render_attribute_string( $text_key ); ?>> <?php echo $item['text']; ?> </span> <?php if ( $_has_tooltip ) { ?> <span <?php echo $this->get_render_attribute_string( $tooltip_key ); ?>> <?php echo $this->parse_text_editor( $item['tooltip_content'] ); ?> </span> <?php } ?> </span> </span> </a> </li><?php } } ?></ul> <?php } /** * Content Template * * Javascript content template for quick rendering. * * @since 0.1.0 * @return void */ protected function content_template() { ?><# var widgetId = view.$el.data('id'); view.addRenderAttribute( 'group', 'class', 'ee-button-group' ) if ( settings.buttons ) { #><ul {{{ view.getRenderAttributeString( 'group' ) }}}><# _.each( settings.buttons, function( item, index ) { var button_text_clone = item.text; var wrapperKey = view.getRepeaterSettingKey( 'wrapper', 'buttons', index ), gapKey = view.getRepeaterSettingKey( 'item', 'buttons', index ), buttonKey = view.getRepeaterSettingKey( 'button', 'buttons', index ), iconKey = view.getRepeaterSettingKey( 'icon', 'buttons', index ), contentKey = view.getRepeaterSettingKey( 'content', 'buttons', index ), tooltipKey = view.getRepeaterSettingKey( 'tooltip', 'buttons', index ), textKey = view.getRepeaterSettingKey( 'text', 'buttons', index ), has_icon = false, _has_tooltip = false; if ( item.tooltip == 'tooltip' && item.tooltip_content ) { view.addRenderAttribute( wrapperKey, 'class', 'hotip' ); } view.addRenderAttribute( gapKey, 'class', [ 'ee-button-gap', 'elementor-repeater-item-' + item._id ] ); view.addRenderAttribute( wrapperKey, 'class', 'ee-button-wrapper' ); view.addRenderAttribute( buttonKey, 'class', 'ee-button' ); view.addRenderAttribute( contentKey, 'class', 'ee-button-content-wrapper' ); view.addRenderAttribute( textKey, 'class', 'ee-button-text' ); view.addInlineEditingAttributes( textKey, 'none' ); view.addRenderAttribute( tooltipKey, 'class', 'hotip-content' ); view.addRenderAttribute( tooltipKey, 'id', 'hotip-content-' + widgetId + '_' + item._id ); if ( item.icon || item.selected_icon.value ) { view.addRenderAttribute( iconKey, 'class', [ 'ee-button-icon', 'ee-icon', 'ee-icon-support--svg', 'ee-icon--' + item.icon_align, ] ); if ( '' === item.text ) { view.addRenderAttribute( iconKey, 'class', [ 'ee-icon--flush', ] ); } var iconHTML = elementor.helpers.renderIcon( view, item.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ), migrated = elementor.helpers.isIconMigrated( item, 'selected_icon' ); has_icon = true; } if ( 'tooltip' === item.tooltip && '' !== item.tooltip_content ) { view.addRenderAttribute( wrapperKey, 'class', 'hotip' ); view.addRenderAttribute( wrapperKey, 'data-hotips-content', '#hotip-content-' + widgetId + '_' + item._id ); view.addRenderAttribute( wrapperKey, 'data-hotips-class', [ 'ee-global', 'ee-tooltip' ] ); view.addRenderAttribute( wrapperKey, 'data-hotips-position', item.tooltip_position ); view.addRenderAttribute( wrapperKey, 'data-hotips-arrow-position-h', item.tooltip_arrow_position_h ); view.addRenderAttribute( wrapperKey, 'data-hotips-arrow-position-v', item.tooltip_arrow_position_v ); _has_tooltip = true; } if ( '' !== item.link.url ) { view.addRenderAttribute( buttonKey, 'class', 'ee-button-link' ); view.addRenderAttribute( wrapperKey, 'href', item.link.url ); } if ( '' !== item.size ) { view.addRenderAttribute( buttonKey, 'class', 'ee-size-' + item.size ); } if ( item.hover_animation ) { view.addRenderAttribute( wrapperKey, 'class', 'elementor-animation-' + item.hover_animation ); } if ( item.css_classes ) { view.addRenderAttribute( wrapperKey, 'class', item.css_classes ); } if ( item._element_id ) { view.addRenderAttribute( wrapperKey, 'id', item._element_id ); } if ( 'yes' === item.button_custom_style ) { view.addRenderAttribute( wrapperKey, 'class', [ 'ee-effect', 'ee-effect-type--' + item.button_effect_type, ] ); if ( [ 'clone', 'back', '3d', 'flip', 'cube' ].indexOf( item.button_effect_type ) > -1 && '' !== item.button_effect_direction ) { view.addRenderAttribute( wrapperKey, 'class', 'ee-effect-direction--' + item.button_effect_direction ); } if ( [ 'back' ].indexOf( item.button_effect_type ) > -1 && '' !== item.button_effect_orientation && '' === item.button_effect_direction ) { view.addRenderAttribute( wrapperKey, 'class', 'ee-effect-orientation--' + item.button_effect_orientation ); } if ( [ 'flip' ].indexOf( item.button_effect_type ) > -1 ) { view.addRenderAttribute( wrapperKey, 'class', 'ee-effect--radius' ); } if ( [ 'clone', 'back', 'flip', '3d', 'cube' ].indexOf( item.button_effect_type ) > -1 ) { view.addRenderAttribute( wrapperKey, 'class', 'ee-effect--background' ); } if ( [ 'clone', 'flip', 'cube' ].indexOf( item.button_effect_type ) > -1 ) { view.addRenderAttribute( wrapperKey, 'class', 'ee-effect--foreground' ); } if ( [ 'back' ].indexOf( item.button_effect_type ) > -1 ) { view.addRenderAttribute( wrapperKey, 'class', 'ee-effect--double-background' ); } if ( [ 'back' ].indexOf( item.button_effect_type ) > -1 && '' !== item.button_effect_double ) { view.addRenderAttribute( wrapperKey, 'class', 'ee-effect--double' ); } if ( [ 'clone' ].indexOf( item.button_effect_type ) > -1 ) { view.addRenderAttribute( wrapperKey, 'class', 'ee-effect-entrance--' + item.button_effect_entrance ); } if ( [ 'clone', '3d', 'flip', 'cube' ].indexOf( item.button_effect_type ) > -1 ) { view.addRenderAttribute( wrapperKey, 'class', 'ee-effect-zoom--' + item.button_effect_zoom ); } if ( [ 'clone', 'back' ].indexOf( item.button_effect_type ) > -1 ) { view.addRenderAttribute( wrapperKey, 'class', 'ee-effect-shape--' + item.button_effect_shape ); } if ( [ '3d', 'flip', 'cube' ].indexOf( item.button_effect_type ) > -1 ) { view.addRenderAttribute( wrapperKey, 'class', 'ee-effect--perspective' ); } if ( [ 'clone', 'flip', 'cube' ].indexOf( item.button_effect_type ) > -1 && '' !== item.button_effect_text ) { button_text_clone = item.button_effect_text; } view.addRenderAttribute( buttonKey, 'data-label', button_text_clone ); } #> <li {{{ view.getRenderAttributeString( gapKey ) }}}> <a {{{ view.getRenderAttributeString( wrapperKey ) }}}> <span {{{ view.getRenderAttributeString( buttonKey ) }}}> <span {{{ view.getRenderAttributeString( contentKey ) }}}> <# if ( has_icon ) { #> <span {{{ view.getRenderAttributeString( iconKey ) }}}> <# if ( ( migrated || ! item.icon ) && iconHTML.rendered ) { #> {{{ iconHTML.value }}} <# } else { #> <i class="{{ item.icon }}" aria-hidden="true"></i> <# } #> </span> <# } #> <span {{{ view.getRenderAttributeString( textKey ) }}}> {{{ item.text }}} </span> <# if ( _has_tooltip ) { #> <span {{{ view.getRenderAttributeString( tooltipKey ) }}}> {{{ item.tooltip_content }}} </span> <# } #> </span> </span> </a> </li> <# }); #> </ul><# } #><?php } } buttons/module.php 0000644 00000001135 15112147616 0010244 0 ustar 00 <?php namespace ElementorExtras\Modules\Buttons; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Buttons\Module * * @since 1.6.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.6.0 * @return string */ public function get_name() { return 'buttons'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.6.0 * @return array */ public function get_widgets() { return [ 'Button_Group', ]; } } calendar/widgets/calendar.php 0000644 00000223015 15112147616 0012254 0 ustar 00 <?php namespace ElementorExtras\Modules\Calendar\Widgets; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Group_Control_Transition; use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\Calendar\Module as Module; use ElementorExtras\Modules\CustomFields\Module as CustomFieldsModule; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Repeater; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Border; use Elementor\Group_Control_Background; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Calendar * * @since 2.0.0 */ class Calendar extends Extras_Widget { /** * _events * * @since 2.0.0 * @var array */ protected $_events; /** * Get Name * * Get the name of the widget * * @since 2.0.0 * @return string */ public function get_name() { return 'ee-calendar'; } /** * Get Title * * Get the title of the widget * * @since 2.0.0 * @return string */ public function get_title() { return __( 'Calendar', 'elementor-extras' ); } /** * Get Icon * * Get the name of the widget * * @since 2.0.0 * @return string */ public function get_icon() { return 'nicon nicon-post-calendar'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 2.0.0 * @return array */ public function get_script_depends() { return [ 'moment', 'clndr', 'wp-util', ]; } /** * Register Widget Controls * * @since 2.0.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_sources', [ 'label' => __( 'Events', 'elementor-extras' ), ] ); $this->add_control( 'source', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'manual', 'options' => [ 'manual' => __( 'Manual', 'elementor-extras' ), 'posts' => __( 'Posts', 'elementor-extras' ), ], ] ); $repeater = new Repeater(); $repeater->add_control( 'title', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Conference', 'elementor-extras' ), ] ); $repeater->add_control( 'link', [ 'label' => __( 'Link', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'placeholder' => __( 'https://your-link.com', 'elementor-extras' ), 'default' => [ 'url' => '', ], ] ); $repeater->add_control( 'start', [ 'label' => __( 'Start Date', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::DATE_TIME, 'picker_options' => [ 'enableTime' => false, ], 'default' => date( 'Y-m-d H:i', strtotime( '+1 day' ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ), ] ); $repeater->add_control( 'end', [ 'label' => __( 'End Date', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::DATE_TIME, 'picker_options' => [ 'enableTime' => false, ], 'default' => date( 'Y-m-d H:i', strtotime( '+3 day' ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ), ] ); $this->add_control( 'events', [ 'type' => Controls_Manager::REPEATER, 'default' => [ [], ], 'fields' => $repeater->get_controls(), 'title_field' => '{{{ title }}}', 'condition' => [ 'source' => 'manual', ], ] ); $this->add_control( 'post_type', [ 'label' => __( 'Post Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'post', 'condition' => [ 'source' => 'posts', ], 'options' => Utils::get_public_post_types_options( true ), ] ); $customfields = new CustomFieldsModule(); $this->add_control( 'post_dates_field_type', [ 'label' => __( 'Fetch Dates From', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'post_date', 'condition' => [ 'source' => 'posts', ], 'options' => array_merge( [ 'post_date' => __( 'Post Date', 'elementor-extras' ), ], $customfields->get_field_types() ), ] ); foreach ( Utils::get_public_post_types_options() as $post_type => $label ) { $post_type_label = $label; foreach ( $customfields->get_field_types() as $field_type => $label ) { $fields_options = [ 'placeholder' => sprintf( __( 'Search %s Date Fields', 'elementor-extras' ), $post_type_label ), 'description' => sprintf( __( 'Search %s fields by label or name', 'elementor-extras' ), strtolower( $field_type ) ), 'type' => 'ee-query', 'options' => [], 'label_block' => false, 'multiple' => false, 'post_type' => $post_type, 'query_type' => $field_type, 'query_options' => [ 'field_type' => [ 'date', ], 'show_group' => true, ], 'condition' => [ 'source' => 'posts', 'post_dates_field_type' => $field_type, 'post_type' => $post_type, ], ]; $this->add_control( 'post_start_date_' . $field_type . '_' . $post_type, array_merge( $fields_options, [ 'label' => __( 'Start Date', 'elementor-extras' ), ] ) ); $this->add_control( 'post_end_date_' . $field_type . '_' . $post_type, array_merge( $fields_options, [ 'label' => __( 'End Date', 'elementor-extras' ), ] ) ); } } $this->add_control( 'no_events', [ 'label' => __( 'Handle No Events', 'elementor-extras' ), 'separator' => 'before', 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Show Calendar', 'elementor-extras' ), 'hide' => __( 'Hide Calendar', 'elementor-extras' ), 'message' => __( 'Show Message', 'elementor-extras' ), ], ] ); $this->add_control( 'no_events_message', [ 'label' => __( 'Message', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'There are currently no available events.', 'elementor-extras' ), 'condition' => [ 'no_events' => 'message', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_calendar', [ 'label' => __( 'Calendar', 'elementor-extras' ), ] ); $this->add_control( 'display_heading', [ 'label' => __( 'Display', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, ] ); $this->add_control( 'skin', [ 'label' => __( 'Skin', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), 'compact' => __( 'Compact', 'elementor-extras' ), ], 'prefix_class' => 'ee-calendar-skin--', ] ); $this->add_control( 'first_day', [ 'label' => __( 'First Day', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '1', 'options' => [ '0' => __( 'Sunday', 'elementor-extras' ), '1' => __( 'Monday', 'elementor-extras' ), '2' => __( 'Tuesday', 'elementor-extras' ), '3' => __( 'Wednesday', 'elementor-extras' ), '4' => __( 'Thursday', 'elementor-extras' ), '5' => __( 'Friday', 'elementor-extras' ), '6' => __( 'Saturday', 'elementor-extras' ), ], 'frontend_available' => true ] ); $this->add_control( 'constrain_start', [ 'label' => __( 'Earliest Month', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::DATE_TIME, 'picker_options' => [ 'enableTime' => false, 'dateFormat' => 'Y-m', ], 'label_block' => false, 'default' => '', 'frontend_available' => true, ] ); $this->add_control( 'constrain_end', [ 'label' => __( 'Latest Month', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::DATE_TIME, 'picker_options' => [ 'enableTime' => false, 'dateFormat' => 'Y-m', ], 'label_block' => false, 'default' => '', 'frontend_available' => true, ] ); $this->add_control( 'default_current_month', [ 'label' => __( 'Default to Current Month', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'default_month', [ 'label' => __( 'Default Month', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::DATE_TIME, 'picker_options' => [ 'enableTime' => false, 'dateFormat' => 'Y-m', ], 'condition' => [ 'default_current_month' => '' ], 'label_block' => false, 'default' => '', 'frontend_available' => true, ] ); $this->add_control( 'show_adjacent_months', [ 'label' => __( 'Show Adjacent Days', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'navigation_heading', [ 'label' => __( 'Navigation', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'click_adjacent', [ 'label' => __( 'Adjacent Click', 'elementor-extras' ), 'description' => __( 'Clicking on days adjacent to current month navigates to corresponding month', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'condition' => [ 'show_adjacent_months!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'links_heading', [ 'label' => __( 'Links', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'source' => 'posts', ], ] ); $this->add_control( 'link', [ 'label' => __( 'Enable Links', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'source' => 'posts', ], ] ); $this->add_control( 'link_is_external', [ 'label' => __( 'Open in new window', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'source' => 'posts', ], ] ); $this->add_control( 'link_no_follow', [ 'label' => __( 'Add nofollow', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'source' => 'posts', ], ] ); $this->add_control( 'days_heading', [ 'label' => __( 'Days', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'day_monday', [ 'label' => __( 'Monday', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Mon', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'day_tuesday', [ 'label' => __( 'Tuesday', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Tue', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'day_wednesday', [ 'label' => __( 'Wednesday', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Wed', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'day_thursday', [ 'label' => __( 'Thursday', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Thu', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'day_friday', [ 'label' => __( 'Friday', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Fri', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'day_saturday', [ 'label' => __( 'Saturday', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Sat', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'day_sunday', [ 'label' => __( 'Sunday', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Sun', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'link_archive', [ 'label' => __( 'Link to Archive', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'condition' => [ 'source' => 'posts', 'post_dates_field_type' => 'post_date', ], 'frontend_available' => true, ] ); $this->add_control( 'months_heading', [ 'label' => __( 'Months', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'month_january', [ 'label' => __( 'January', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'January', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'month_february', [ 'label' => __( 'February', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'February', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'month_march', [ 'label' => __( 'March', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'March', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'month_april', [ 'label' => __( 'April', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'April', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'month_may', [ 'label' => __( 'May', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'May', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'month_june', [ 'label' => __( 'June', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'June', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'month_july', [ 'label' => __( 'July', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'July', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'month_august', [ 'label' => __( 'August', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'August', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'month_september', [ 'label' => __( 'September', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'September', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'month_october', [ 'label' => __( 'October', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'October', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'month_november', [ 'label' => __( 'November', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'November', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'month_december', [ 'label' => __( 'December', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'December', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'events_heading', [ 'label' => __( 'Events List', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'event_order', [ 'label' => __( 'Order', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'ASC', 'options' => [ 'ASC' => __( 'Ascending', 'elementor-extras' ), 'DESC' => __( 'Descending', 'elementor-extras' ), ], 'condition' => [ 'skin' => 'compact', ], ] ); $this->add_control( 'event_list_heading', [ 'label' => __( 'Heading', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Posts this month', 'elementor-extras' ), 'condition' => [ 'skin' => 'compact', ], 'frontend_available' => true, ] ); $this->add_control( 'event_title_wrap', [ 'label' => __( 'Title Wrapping', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'no-wrap', 'options' => [ 'no-wrap' => __( 'Single Line', 'elementor-extras' ), 'wrap' => __( 'Wrap', 'elementor-extras' ), ], 'prefix_class' => 'ee-calendar-event-title--', ] ); $this->add_control( 'event_date_format', [ 'label' => __( 'Date Format', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'description' => sprintf( '<a href="https://momentjs.com/docs/#/displaying/format/" target="_blank">%s</a>', __( 'Documentation on ISO date and time formatting', 'elementor-extras' ) ), 'default' => 'MMMM Do', 'condition' => [ 'skin' => 'compact', ], 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_calendar', [ 'label' => __( 'Calendar', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'calendar_width', [ 'label' => __( 'Max. Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 300, 'max' => 1000, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-calendar' => 'max-width: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'calendar_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-calendar' => 'padding: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'calendar_spacing_horizontal', [ 'label' => __( 'Horizontal Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__cell__content' => 'padding-left: {{SIZE}}px; padding-right: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'calendar_spacing_vertical', [ 'label' => __( 'Vertical Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__cell__content' => 'padding-top: {{SIZE}}px; padding-bottom: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'calendar_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'calendar_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .clndr' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'calendar_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 20, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .clndr, {{WRAPPER}} .ee-calendar' => 'border-radius: {{SIZE}}px;', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'calendar_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-calendar', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'calendar_box_shadow', 'selector' => '{{WRAPPER}} .ee-calendar', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'calendar_typography', 'selector' => '{{WRAPPER}} .ee-calendar__cell__content', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->add_control( 'separators_heading', [ 'label' => __( 'Separators', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->start_controls_tabs( 'separators' ); $this->start_controls_tab( 'separators_horizontal', [ 'label' => __( 'Horizontal', 'elementor-extras' ) ] ); $this->add_control( 'separators_horizontal_style', [ 'label' => __( 'Style', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'solid' => _x( 'Solid', 'Border Control', 'elementor-extras' ), 'double' => _x( 'Double', 'Border Control', 'elementor-extras' ), 'dotted' => _x( 'Dotted', 'Border Control', 'elementor-extras' ), 'dashed' => _x( 'Dashed', 'Border Control', 'elementor-extras' ), 'groove' => _x( 'Groove', 'Border Control', 'elementor-extras' ), ], 'selectors' => [ '{{WRAPPER}} tr:not(:last-child) td.ee-calendar__cell' => 'border-bottom-style: {{VALUE}};', ], ] ); $this->add_control( 'separators_horizontal_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 5, 'step' => 1, ], ], 'condition' => [ 'separators_horizontal_style!' => '', ], 'selectors' => [ '{{WRAPPER}} tr:not(:last-child) td.ee-calendar__cell' => 'border-bottom-width: {{SIZE}}px;', ], ] ); $this->add_control( 'separators_horizontal_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'separators_horizontal_style!' => '', ], 'selectors' => [ '{{WRAPPER}} tr:not(:last-child) td.ee-calendar__cell' => 'border-bottom-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'separators_vertical', [ 'label' => __( 'Vertical', 'elementor-extras' ) ] ); $this->add_control( 'separators_vertical_style', [ 'label' => __( 'Style', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'solid' => _x( 'Solid', 'Border Control', 'elementor-extras' ), 'double' => _x( 'Double', 'Border Control', 'elementor-extras' ), 'dotted' => _x( 'Dotted', 'Border Control', 'elementor-extras' ), 'dashed' => _x( 'Dashed', 'Border Control', 'elementor-extras' ), 'groove' => _x( 'Groove', 'Border Control', 'elementor-extras' ), ], 'selectors' => [ '{{WRAPPER}} td:not(:first-child).ee-calendar__cell' => 'border-left-style: {{VALUE}};', ], ] ); $this->add_control( 'separators_vertical_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 5, 'step' => 1, ], ], 'condition' => [ 'separators_vertical_style!' => '', ], 'selectors' => [ '{{WRAPPER}} td:not(:first-child).ee-calendar__cell' => 'border-left-width: {{SIZE}}px;', ], ] ); $this->add_control( 'separators_vertical_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'separators_vertical_style!' => '', ], 'selectors' => [ '{{WRAPPER}} td:not(:first-child).ee-calendar__cell' => 'border-left-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_style_navigation', [ 'label' => __( 'Navigation', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'navigation_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'navigation_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'navigation_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'navigation_month_spacing', [ 'label' => __( 'Month Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 12, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}}.ee-calendar-arrows-position--left .ee-calendar__controls__month' => 'margin-left: {{SIZE}}px;', '{{WRAPPER}}.ee-calendar-arrows-position--sides .ee-calendar__controls__month' => 'margin-left: {{SIZE}}px; margin-right: {{SIZE}}px;', '{{WRAPPER}}.ee-calendar-arrows-position--right .ee-calendar__controls__month' => 'margin-right: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'navigation_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls__month' => 'text-align: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'navigation_typography', 'selector' => '{{WRAPPER}} .ee-calendar__controls__month', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->add_control( 'navigation_buttons_heading', [ 'label' => __( 'Buttons', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'arrows_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'sides', 'options' => [ 'sides' => __( 'Sides', 'elementor-extras' ), 'left' => __( 'Left', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'prefix_class' => 'ee-calendar-arrows-position--', ] ); $this->add_responsive_control( 'navigation_buttons_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 12, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], ], 'condition' => [ 'arrows_position!' => 'sides', ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__button--previous' => 'margin-right: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'buttons_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 6, 'max' => 48, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls__button' => 'font-size: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'buttons_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 3, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls__button' => 'padding: {{SIZE}}em;', ], ] ); $this->add_control( 'buttons_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls__button' => 'border-radius: {{SIZE}}%;', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'buttons', 'selector' => '{{WRAPPER}} .ee-calendar__controls__button', 'separator' => '', ] ); $this->start_controls_tabs( 'buttons' ); $this->start_controls_tab( 'buttons_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'button_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls__button' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls__button' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'buttons_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'button_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls__button:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls__button:hover' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'navigation_separator_heading', [ 'label' => __( 'Separator', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'navigation_separator_style', [ 'label' => __( 'Style', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'solid' => _x( 'Solid', 'Border Control', 'elementor-extras' ), 'double' => _x( 'Double', 'Border Control', 'elementor-extras' ), 'dotted' => _x( 'Dotted', 'Border Control', 'elementor-extras' ), 'dashed' => _x( 'Dashed', 'Border Control', 'elementor-extras' ), 'groove' => _x( 'Groove', 'Border Control', 'elementor-extras' ), ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls' => 'border-bottom-style: {{VALUE}};', ], ] ); $this->add_control( 'navigation_separator_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 5, 'step' => 1, ], ], 'condition' => [ 'navigation_separator_style!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls' => 'border-bottom-width: {{SIZE}}px;', ], ] ); $this->add_control( 'navigation_separator_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'navigation_separator_style!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__controls' => 'border-bottom-color: {{VALUE}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_header', [ 'label' => __( 'Header', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'header_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__table__head' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'header_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__table__head' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'header_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__table__head .ee-calendar__cell__content' => 'text-align: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'header_days', 'selector' => '{{WRAPPER}} .ee-calendar__table__head .ee-calendar__cell__content', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->add_control( 'header_separator_heading', [ 'label' => __( 'Separator', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'header_separator_style', [ 'label' => __( 'Style', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'solid' => _x( 'Solid', 'Border Control', 'elementor-extras' ), 'double' => _x( 'Double', 'Border Control', 'elementor-extras' ), 'dotted' => _x( 'Dotted', 'Border Control', 'elementor-extras' ), 'dashed' => _x( 'Dashed', 'Border Control', 'elementor-extras' ), 'groove' => _x( 'Groove', 'Border Control', 'elementor-extras' ), ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__table__head' => 'border-bottom-style: {{VALUE}};', ], ] ); $this->add_control( 'header_separator_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 5, 'step' => 1, ], ], 'condition' => [ 'header_separator_style!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__table__head' => 'border-bottom-width: {{SIZE}}px;', ], ] ); $this->add_control( 'header_separator_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'header_separator_style!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__table__head' => 'border-bottom-color: {{VALUE}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_days', [ 'label' => __( 'Days', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'days_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 12, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__month' => 'padding: {{SIZE}}px;', ], ] ); $this->add_control( 'days_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__day__wrapper' => 'border-radius: {{SIZE}}px;', '{{WRAPPER}} .ee-calendar__day__header' => 'border-radius: {{SIZE}}px {{SIZE}}px 0 0;', ], ] ); $this->add_responsive_control( 'days_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'condition' => [ 'skin' => 'default', ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__day__content' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'days_all_heading', [ 'label' => __( 'All Days', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_responsive_control( 'days_all_padding_horizontal', [ 'label' => __( 'Horizontal Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, 'step' => 1, ], ], 'condition' => [ 'skin' => 'default', ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__day__header, {{WRAPPER}} .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day__event__name:before' => 'padding-left: {{SIZE}}px; padding-right: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'days_all_padding_vertical', [ 'label' => __( 'Vertical Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, 'step' => 1, ], ], 'condition' => [ 'skin' => 'default', ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__day__header, {{WRAPPER}} .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day__event__name:before' => 'padding-top: {{SIZE}}px; padding-bottom: {{SIZE}}px;', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'days', 'selector' => '{{WRAPPER}} .ee-calendar__day__wrapper', 'separator' => '', ] ); $this->start_controls_tabs( 'days' ); $this->start_controls_tab( 'days_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'day_all_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day__wrapper' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'day_all_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day__wrapper' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'days_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'day_all_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day__wrapper:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'day_all_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day__wrapper:hover' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'days_event_heading', [ 'label' => __( 'Event', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->start_controls_tabs( 'days_event' ); $this->start_controls_tab( 'days_event_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'day_event_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper, {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__event__name:before' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'day_event_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper, {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'day_event_box_shadow', 'selector' => '{{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'days_event_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'day_event_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover, {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'day_event_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover, {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'day_event_box_shadow_hover', 'selector' => '{{WRAPPER}} .ee-calendar__day--event .ee-calendar__day__wrapper:hover', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'days_today_heading', [ 'label' => __( 'Today', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->start_controls_tabs( 'days_today' ); $this->start_controls_tab( 'days_today_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'day_today_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper, {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__event__name:before' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'day_today_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_SECONDARY, ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper, {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'days_today_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'day_today_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper:hover, {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'day_today_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper:hover, {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--today .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'days_passed_heading', [ 'label' => __( 'Passed', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->start_controls_tabs( 'days_passed' ); $this->start_controls_tab( 'days_passed_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'day_passed_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper, {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__event__name:before' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'day_passed_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper, {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'days_passed_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'day_passed_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper:hover, {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'day_passed_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper:hover, {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--passed .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'days_passed_events_heading', [ 'label' => __( 'Passed Events', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->start_controls_tabs( 'days_passed_events' ); $this->start_controls_tab( 'days_passed_events_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'day_passed_events_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper, {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__event__name:before' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'day_passed_events_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper, {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'days_passed_events_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'day_passed_events_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper:hover, {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'day_passed_events_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper:hover, {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name, {{WRAPPER}} .ee-calendar__day--passed.ee-calendar__day--event .ee-calendar__day__wrapper:hover .ee-calendar__day__event__name:before' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'days_adjacent_heading', [ 'label' => __( 'Adjacent', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'day_adjacent_opacity', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__day--adjacent .ee-calendar__day__wrapper' => 'opacity: {{SIZE}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_events', [ 'label' => __( 'Events', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'skin' => 'compact', ], ] ); $this->add_control( 'events_header_heading', [ 'label' => __( 'Header', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'condition' => [ 'skin' => 'compact', ], ] ); $this->add_responsive_control( 'events_header_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__events__header' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'events_header_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__events__header' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'events_header_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__events__header' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'events_header_title_spacing', [ 'label' => __( 'Title Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 12, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], ], 'condition' => [ 'skin' => 'compact', ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__events__header__title' => 'margin-right: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'events_header_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'left', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'condition' => [ 'skin' => 'compact', ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__table__head .ee-calendar__events__header__title' => 'text-align: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'events_header', 'selector' => '{{WRAPPER}} .ee-calendar__events__header__title', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->add_control( 'events_separator_heading', [ 'label' => __( 'Separator', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'skin' => 'compact', ], ] ); $this->add_control( 'events_separator_style', [ 'label' => __( 'Style', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'solid' => _x( 'Solid', 'Border Control', 'elementor-extras' ), 'double' => _x( 'Double', 'Border Control', 'elementor-extras' ), 'dotted' => _x( 'Dotted', 'Border Control', 'elementor-extras' ), 'dashed' => _x( 'Dashed', 'Border Control', 'elementor-extras' ), 'groove' => _x( 'Groove', 'Border Control', 'elementor-extras' ), ], 'condition' => [ 'skin' => 'compact', ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__events__event:not(:last-child)' => 'border-bottom-style: {{VALUE}};', ], ] ); $this->add_control( 'events_separator_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 5, 'step' => 1, ], ], 'condition' => [ 'skin' => 'compact', 'events_separator_style!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__events__event:not(:last-child)' => 'border-bottom-width: {{SIZE}}px;', ], ] ); $this->add_control( 'events_separator_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'skin' => 'compact', 'events_separator_style!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__events__event:not(:last-child)' => 'border-bottom-color: {{VALUE}};', ], ] ); $this->add_control( 'events_list_heading', [ 'label' => __( 'List', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'skin' => 'compact', ], ] ); $this->add_responsive_control( 'event_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__events__event' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->start_controls_tabs( 'event_tabs' ); $this->start_controls_tab( 'event_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'event_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-calendar__events__event' => 'color: {{VALUE}};', ], 'condition' => [ 'skin' => 'compact', ], ] ); $this->add_control( 'event_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-calendar__events__event' => 'background-color: {{VALUE}};', ], 'condition' => [ 'skin' => 'compact', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'event_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'event_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__events__event:hover' => 'color: {{VALUE}};', ], 'condition' => [ 'skin' => 'compact', ], ] ); $this->add_control( 'event_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-calendar__events__event:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ 'skin' => 'compact', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_style_no_events', [ 'tab' => Controls_Manager::TAB_STYLE, 'label' => __( 'No Events', 'elementor-extras' ), 'condition' => [ 'no_events' => 'message', ], ] ); $this->add_control( 'no_events_message_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_TEXT, ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__no-events' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'no_events_message_typography', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-calendar__no-events', ] ); $this->add_responsive_control( 'no_events_message_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-calendar__no-events' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 2.0.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); switch ( $settings['source'] ) { case 'manual' : $this->setup_manual(); break; case 'posts' : $this->get_posts_data(); break; default : $this->setup_manual(); } $this->render_data(); } /** * Get Post Data * * @since 2.0.0 * @return void */ protected function get_posts_data() { $settings = $this->get_settings_for_display(); $events = []; $args = [ 'post_type' => $settings['post_type'], 'post_status' => 'publish', 'posts_per_page' => -1, 'numberposts' => -1, 'suppress_filters' => false, 'order' => $settings['event_order'], ]; if ( 'post_date' !== $settings['post_dates_field_type'] ) { $data_type = 'field'; } else { $data_type = 'post'; } $args = call_user_func_array( [ $this, 'parse_' . $data_type . '_query_args' ], [ $args, $settings['post_dates_field_type'] ] ); /** * Posts Args Filter * * Filters the query args when fetching posts * * @since 2.2.0 * @param array $args The query args * @param array $settings The widget settings */ $args = apply_filters( 'elementor_extras/widgets/calendar/events/query/args', $args, $settings ); $posts = get_posts( $args ); foreach ( $posts as $post ) { $field_data = call_user_func_array( [ $this, 'get_' . $data_type . '_dates_args' ], [ $post ] ); if ( ! $field_data || ! $field_data['start_date'] ) { continue; } $event_post_id = $post->ID; $event_title = $post->post_title; $event_link = '' !== $settings['link'] ? get_permalink( $post->ID ) : ''; $event_target = '' !== $settings['link_is_external'] ? '_blank' : ''; $event_rel = '' !== $settings['link_no_follow'] ? 'nofollow' : ''; $event_start_date = $field_data['start_date']; $event_end_date = $field_data['end_date']; $event_archive = $field_data['archive']; $event = [ 'post_id' => $event_post_id, 'title' => $event_title, 'start' => $event_start_date, 'end' => $event_end_date, 'link' => $event_link, 'target' => $event_target, 'rel' => $event_rel, 'archive' => $event_archive, ]; /** * Posts Events Filter * * Provides access to events setup from posts * * @since 2.2.0 * @param array $event The event settings * @param WP_Post $post The event post object */ $events[] = apply_filters( 'elementor_extras/widgets/calendar/events/event', $event, $post ); } /** * Posts Events Filter * * Provides access to events setup from posts * * @since 2.2.0 * @param array $events The array of events * @param array $settings The widget settings */ $this->_events = apply_filters( 'elementor_extras/widgets/calendar/events', $events, $settings ); } /** * Parse query args for posts * * @since 2.2.42 * @return array */ protected function parse_post_query_args( $args, $type ) { return $args; } /** * Parse query args for custom fields * * @since 2.2.42 * @return array */ protected function parse_field_query_args( $args, $type ) { if ( 'acf' !== $type ) { return $args; } $settings = $this->get_settings(); $start_date_key = $settings['post_start_date_' . $settings['post_dates_field_type'] . '_' . $settings['post_type'] ]; if ( $start_date_key ) { $field_object = get_field_object( $start_date_key ); $args['orderby'] = 'meta_value'; $args['meta_key'] = $field_object['name']; } return $args; } /** * Get Post Dates Args * * @since 2.2.42 * @return array */ protected function get_post_dates_args( $post ) { $data = [ 'start_date' => false, 'end_date' => false, 'archive' => false, ]; if ( $post ) { $data['start_date'] = $end_date = $post->post_date; $data['archive'] = get_day_link( get_the_date( 'Y', $post ), get_the_date( 'm', $post ), get_the_date( 'd', $post ) ); } return $data; } /** * Get Fields Dates Args * * @since 2.2.42 * @return array|bool */ protected function get_field_dates_args( $post ) { $settings = $this->get_settings(); $customfields = new CustomFieldsModule(); $data = [ 'start_date' => false, 'end_date' => false, 'archive' => false, ]; if ( $post ) { $field = $customfields->get_component( $settings['post_dates_field_type'] ); if ( ! $field ) { return false; } $start_date_key = $settings['post_start_date_' . $settings['post_dates_field_type'] . '_' . $settings['post_type'] ]; $end_date_key = $settings['post_end_date_' . $settings['post_dates_field_type'] . '_' . $settings['post_type'] ]; $data['start_date'] = $field->get_field_value( $post->ID, $start_date_key ); $data['end_date'] = $field->get_field_value( $post->ID, $end_date_key ); $data['archive'] = ''; } return $data; } /** * Setup Manual * * Sets up events data * * @since 2.0.0 * @return void */ protected function setup_manual() { $settings = $this->get_settings_for_display(); $events = []; if ( empty( $settings['events'] ) ) return; foreach ( $settings['events'] as $index => $event ) { $events[] = [ 'title' => $event['title'], 'start' => $event['start'], 'end' => $event['end'], 'link' => ( '' !== $event['link']['url'] ) ? $event['link']['url'] : '', 'target' => $event['link']['is_external'] ? '_blank' : '_self', 'rel' => ! empty( $event['link']['nofollow'] ) ? 'nofollow' : '', 'archive' => false, ]; } /** * Manual Events Filter * * Provides access to manually set events date * * @since 2.2.0 * @param string $events The array of events * @param string $settings The widget settings */ $this->_events = apply_filters( 'elementor_extras/widgets/calendar/events/manual', $events, $settings ); } /** * Render data * * @since 2.0.0 * @return void */ protected function render_data() { $settings = $this->get_settings_for_display(); if ( empty( $this->_events ) ) { if ( 'message' !== $settings['no_events'] ) { echo $this->render_placeholder( [ 'body' => __( 'You have no events in your calendar. Check the settings and make sure the source fields for the dates of the events are setup correctly.', 'elementor-extras' ), ] ); } if ( 'hide' === $settings['no_events'] ) { return; } if ( 'message' === $settings['no_events'] ) { $this->add_render_attribute('no-events', 'class', 'ee-calendar__no-events'); ?><div <?php echo $this->get_render_attribute_string( 'no-events' ); ?>><?php echo $settings['no_events_message']; ?></div><?php return; } } $this->add_render_attribute( [ 'calendar' => [ 'class' => [ 'ee-calendar', ], ], ] ); ?> <div <?php echo $this->get_render_attribute_string( 'calendar' ); ?>> <?php foreach ( $this->_events as $index => $event ) { if ( ! $event['start'] ) continue; $title = $event['title']; $start = $event['start']; $end = ( ! empty( $event['end'] ) ) ? $event['end'] : $event['start']; $link = $event['link']; $target = $event['target']; $rel = $event['rel']; $archive = $event['archive']; $event_key = $this->get_repeater_setting_key( 'event', 'events', $index ); $this->add_render_attribute( $event_key, [ 'class' => 'ee-calendar-event', 'data-archive' => $archive, 'data-target' => $target, 'data-rel' => $rel, 'data-link' => $link, 'data-start' => $start, 'data-end' => $end, 'data-before' => $this->get_before_title( $event ), 'data-after' => $this->get_after_title( $event ), ] ); ?><div <?php echo $this->get_render_attribute_string( $event_key ); ?>><?php echo $title; ?></div><?php } ?></div><?php } /** * Output before title * * @since 2.2.0 * @return void */ public function get_before_title( $event ) { ob_start(); /** * Before title. * * Fires before printing the title of the event. * * @since 2.2.0 * * @param array $event The event data. */ do_action( 'elementor_extras/widgets/calendar/event/before_title', $event ); return ob_get_clean(); } /** * Output after title * * @since 2.2.0 * @return void */ public function get_after_title( $event ) { ob_start(); /** * Before title. * * Fires after printing the title of the event. * * @since 2.2.0 * * @param array $event The event data. */ do_action( 'elementor_extras/widgets/calendar/event/after_title', $event ); return ob_get_clean(); } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 2.0.0 * @return void */ protected function content_template() {} } calendar/module.php 0000644 00000003277 15112147616 0010330 0 ustar 00 <?php namespace ElementorExtras\Modules\Calendar; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; use ElementorExtras\Modules\CustomFields\Module as CustomFieldsModule; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Calendar\Module * * @since 2.0.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 2.0.0 * @return string */ public function get_name() { return 'calendar'; } /** * Get Widgets * * Get the modules' widgets * * @since 2.0.0 * @return array */ public function get_widgets() { return [ 'Calendar', ]; } /** * Get Post Type Fields * * Loops through all posts of post type * and calls the appropriate fields type to fetch * all available custom fields * * @since 2.0.0 * @param post_type|string The post type * @param fields_type|string The fields type. Can be 'acf', 'toolset' or 'pods' * @return array The meta fields */ public static function get_post_type_fields( $post_type = 'post', $fields_type = 'acf' ) { // Return the fields for this cpt $meta_fields = []; $customfields = new CustomFieldsModule(); // Fetch all posts of this type $the_query = new \WP_Query( [ 'post_type' => $post_type, ] ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); $component = $customfields->get_component( $fields_type ); $fields = $component->get_fields( get_the_ID() ); if ( $fields ) { foreach( $fields as $name => $value ) { $meta_fields[ $name ] = $value; } } } wp_reset_postdata(); } return $meta_fields; } } circle-progress/widgets/circle-progress.php 0000644 00000065646 15112147616 0015156 0 ustar 00 <?php namespace ElementorExtras\Modules\CircleProgress\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; // Elementor Classes use Elementor\Icons_Manager; use Elementor\Controls_Manager; use Elementor\Utils; use Elementor\Repeater; use Elementor\Group_Control_Border; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Box_Shadow; use Elementor\Modules\DynamicTags\Module as TagsModule; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Circle_Progress * * @since 0.1.0 */ class Circle_Progress extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 0.1.0 * @return string */ public function get_name() { return 'circle-progress'; } /** * Get Title * * Get the title of the widget * * @since 0.1.0 * @return string */ public function get_title() { return __( 'Circle Progress', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 0.1.0 * @return string */ public function get_icon() { return 'nicon nicon-circle-progress'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 0.1.0 * @return array */ public function get_script_depends() { return [ 'circle-progress', 'jquery-appear', 'jquery-easing', ]; } /** * Register Widget Controls * * @since 0.1.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_circle', [ 'label' => __( 'Circle', 'elementor-extras' ), ] ); $this->add_control( 'value_heading', [ 'label' => __( 'Value', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'value_progress', [ 'label' => __( 'Progress Value', 'elementor-extras' ), 'description' => __( 'Choose absolute if you want to manually define the maximum value and display the entered value instead of the percentage.', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'percentage', 'frontend_available' => true, 'options' => [ 'percentage' => __( 'Percentage', 'elementor-extras' ), 'absolute' => __( 'Absolute', 'elementor-extras' ), ], ] ); $this->add_control( 'value', [ 'label' => __( 'Value', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'title' => __( 'Accepted value formats are: 50, 0.50, 0,50, 50/100', 'elementor-extras' ), 'default' => '75', 'frontend_available' => true, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY ], ], ] ); $this->add_control( 'value_decimal_move', [ 'label' => __( 'Move Decimal', 'elementor-extras' ), 'description' => __( 'Move the decimal point of the number shown, keeping the progress to the default value.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => -4, 'max' => 4, 'step' => 1, ], ], 'frontend_available' => true, ] ); $this->add_control( 'value_max', [ 'label' => __( 'Max. Value', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 100, 'min' => 0, 'step' => 1, 'frontend_available' => true, 'condition' => [ 'value_progress' => 'absolute', ], ] ); $this->add_control( 'value_position', [ 'label' => __( 'Value Position', 'elementor-extras' ), 'description' => __( 'Position of the value relative to circle.', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'inside', 'options' => [ 'inside' => __( 'Inside', 'elementor-extras' ), 'below' => __( 'Below', 'elementor-extras' ), 'hide' => __( 'Hide', 'elementor-extras' ), ], ] ); $this->add_control( 'selected_icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'icon', 'separator' => 'before', 'condition' => [ 'value_position!' => 'inside', ], ] ); $this->add_control( 'suffix_heading', [ 'label' => __( 'Suffix', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'suffix', [ 'type' => Controls_Manager::TEXT, 'label' => __( 'Text', 'elementor-extras' ), 'default' => '%', 'separator' => 'none' ] ); $this->add_control( 'suffix_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'after', 'options' => [ 'after' => __( 'After', 'elementor-extras' ), 'before' => __( 'Before', 'elementor-extras' ), ], 'prefix_class' => 'ee-circle-progress-suffix--' ] ); $this->add_responsive_control( 'suffix_vertical_align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'top', 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], 'stretch' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-v-align-stretch', ], ], 'prefix_class' => 'ee-circle-progress-suffix--' ] ); $this->add_control( 'suffix_top_adjustment', [ 'label' => __( 'Top Offset', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '0.5', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 3, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-circle-progress__value .suffix' => 'margin-top: {{SIZE}}em;', ], 'condition' => [ 'suffix_vertical_align' => 'top', ] ] ); $this->add_control( 'animation_heading', [ 'label' => __( 'Settings', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'animate', [ 'label' => __( 'Animate', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true ] ); $this->add_control( 'easing', [ 'label' => __( 'Easing', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'easeInOutCubic', 'options' => [ 'easeInQuad' => __( 'easeInQuad', 'elementor-extras' ), 'easeOutQuad' => __( 'easeOutQuad', 'elementor-extras' ), 'easeInOutQuad' => __( 'easeInOutQuad', 'elementor-extras' ), 'easeInCubic' => __( 'easeInCubic', 'elementor-extras' ), 'easeOutCubic' => __( 'easeOutCubic', 'elementor-extras' ), 'easeInOutCubic' => __( 'easeInOutCubic', 'elementor-extras' ), 'easeInQuart' => __( 'easeInQuart', 'elementor-extras' ), 'easeOutQuart' => __( 'easeOutQuart', 'elementor-extras' ), 'easeInOutQuart' => __( 'easeInOutQuart', 'elementor-extras' ), 'easeInQuint' => __( 'easeInQuint', 'elementor-extras' ), 'easeOutQuint' => __( 'easeOutQuint', 'elementor-extras' ), 'easeInOutQuint' => __( 'easeInOutQuint', 'elementor-extras' ), 'easeInSine' => __( 'easeInSine', 'elementor-extras' ), 'easeOutSine' => __( 'easeOutSine', 'elementor-extras' ), 'easeInOutSine' => __( 'easeInOutSine', 'elementor-extras' ), 'easeInExpo' => __( 'easeInExpo', 'elementor-extras' ), 'easeOutExpo' => __( 'easeOutExpo', 'elementor-extras' ), 'easeInOutExpo' => __( 'easeInOutExpo', 'elementor-extras' ), 'easeInCirc' => __( 'easeInCirc', 'elementor-extras' ), 'easeOutCirc' => __( 'easeOutCirc', 'elementor-extras' ), 'easeInOutCirc' => __( 'easeInOutCirc', 'elementor-extras' ), 'easeInElastic' => __( 'easeInElastic', 'elementor-extras' ), 'easeOutElastic' => __( 'easeOutElastic', 'elementor-extras' ), 'easeInOutElastic' => __( 'easeInOutElastic', 'elementor-extras' ), 'easeInBack' => __( 'easeInBack', 'elementor-extras' ), 'easeOutBack' => __( 'easeOutBack', 'elementor-extras' ), 'easeInOutBack' => __( 'easeInOutBack', 'elementor-extras' ), 'easeInBounce' => __( 'easeInBounce', 'elementor-extras' ), 'easeOutBounce' => __( 'easeOutBounce', 'elementor-extras' ), 'easeInOutBounce' => __( 'easeInOutBounce', 'elementor-extras' ), ], 'condition' => [ 'animate!' => '', ], 'frontend_available' => true ] ); $this->add_control( 'reverse', [ 'label' => __( 'Reverse', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'duration', [ 'label' => __( 'Duration (ms)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 3000, 'step' => 100, ], ], 'condition' => [ 'animate!' => '', ], 'frontend_available' => true ] ); $this->add_control( 'appear_offset', [ 'label' => __( 'Appear Offset', 'elementor-extras' ), 'description' => __( 'Specifies the offset, relative to when the widget enteres the viewport, after which the animation starts', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 1000, ], ], 'condition' => [ 'animate!' => '', ], ] ); $this->add_control( 'angle', [ 'label' => __( 'Start Angle', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 2 * M_PI, 'step' => 0.001, ], ], 'frontend_available' => true ] ); $this->end_controls_section(); $this->start_controls_section( 'section_text', [ 'label' => __( 'Text', 'elementor-extras' ), ] ); $this->add_control( 'text', [ 'label' => '', 'type' => Controls_Manager::WYSIWYG, 'default' => __( 'I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'elementor-extras' ), ] ); $this->end_controls_section(); $this->start_controls_section( 'section_circle_style', [ 'label' => __( 'Circle', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 100, ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 1000, ], ], 'frontend_available' => true ] ); $this->add_control( 'thickness', [ 'label' => __( 'Thickness (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 10, ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 100, ], ], 'frontend_available' => true ] ); $this->add_control( 'lineCap', [ 'label' => __( 'Line Cap', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'butt', 'options' => [ 'butt' => __( 'Butt', 'elementor-extras' ), 'round' => __( 'Round', 'elementor-extras' ), 'square' => __( 'Square', 'elementor-extras' ), ], 'frontend_available' => true ] ); $gradient = new Repeater(); $gradient->add_control( 'color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, ] ); $this->add_control( 'fill', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::REPEATER, 'fields' => $gradient->get_controls(), 'title_field' => '{{{ color }}}' ] ); $this->add_control( 'gradient_angle', [ 'label' => __( 'Gradient Angle (°)', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '2', 'options' => [ '2' => __( '0', 'elementor-extras' ), '4' => __( '45', 'elementor-extras' ), '0.5' => __( '90', 'elementor-extras' ), ], 'frontend_available' => true ] ); $this->add_control( 'emptyFill', [ 'label' => __( 'Empty Fill', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'frontend_available' => true ] ); $this->end_controls_section(); $this->start_controls_section( 'section_value_style', [ 'label' => __( 'Value', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'value_color', [ 'label' => __( 'Value Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-circle-progress__value' => 'color: {{VALUE}};', ], 'global' => [ 'default' => Global_Colors::COLOR_TEXT, ], ] ); $this->add_control( 'suffix_color', [ 'label' => __( 'Suffix Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-circle-progress__value .suffix' => 'color: {{VALUE}};', ], 'global' => [ 'default' => Global_Colors::COLOR_TEXT, ], ] ); $this->add_control( 'value_spacing', [ 'label' => __( 'Value Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'condition' => [ 'value_position!' => 'inside' ], 'selectors' => [ '{{WRAPPER}}.ee-circle-progress-position--below .ee-circle-progress__value' => 'margin-top: {{SIZE}}{{UNIT}}', ] ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'value_shadow', 'selector' => '{{WRAPPER}} .ee-circle-progress__value', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'value_typography', 'selector' => '{{WRAPPER}} .ee-circle-progress__value', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_icon_style', [ 'label' => __( 'Icon', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'value_position!' => 'inside', 'icon!' => '', ], ] ); $this->add_control( 'icon_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-circle-progress__icon' => 'color: {{VALUE}};', ], 'global' => [ 'default' => Global_Colors::COLOR_TEXT, ], 'condition' => [ 'value_position!' => 'inside', 'icon!' => '', ], ] ); $this->add_control( 'icon_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 9, 'max' => 100, ], ], 'range' => [ 'em' => [ 'min' => 1, 'max' => 10, 'step' => 0.1, ], ], 'range' => [ 'rem' => [ 'min' => 1, 'max' => 10, 'step' => 0.1, ], ], 'size_units' => [ 'px', 'em', 'rem' ], 'condition' => [ 'value_position!' => 'inside', 'icon!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-circle-progress__icon' => 'font-size: {{SIZE}}{{UNIT}}', ] ] ); $this->end_controls_section(); $this->start_controls_section( 'section_text_style', [ 'label' => __( 'Text', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'text_color', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-circle-progress__text' => 'color: {{VALUE}};', ], 'global' => [ 'default' => Global_Colors::COLOR_TEXT, ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'text_shadow', 'selector' => '{{WRAPPER}} .ee-circle-progress__text', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'text_typography', 'selector' => '{{WRAPPER}} .ee-circle-progress__text', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 0.1.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); $circle_progress_fill = array(); $this->add_render_attribute( [ 'wrapper' => [ 'class' => [ 'ee-circle-progress', 'ee-circle-progress-position--' . $settings['value_position'], ], ], ] ); if( ! empty( $settings['suffix'] ) ) { $this->add_render_attribute( 'wrapper', 'data-suffix', $settings['suffix'] ); } if ( $settings['appear_offset']['size'] ) { $this->add_render_attribute( 'wrapper', 'data-appear-top-offset', $settings['appear_offset']['size'] ); } if ( count( $settings['fill'] ) > 0 ) { if ( count( $settings['fill'] ) === 1 ) { if ( ! empty( $settings['fill'][0]['color'] ) ) { $circle_progress_fill['color'] = $settings['fill'][0]['color']; } } else { // Gradient $circle_progress_fill['gradient'] = array(); foreach ( $settings['fill'] as $fill ) { if ( ! empty( $fill['color'] ) ) { $circle_progress_fill['gradient'][] = $fill['color']; } } $gradient_angle = ( (int)$settings['gradient_angle'] > 0 ) ? (int)$settings['gradient_angle'] : 4; $circle_progress_fill['gradientAngle'] = M_PI / $gradient_angle; } if ( count( $circle_progress_fill ) > 0 ) { $circle_progress_settings['fill'] = json_encode( $circle_progress_fill ); $this->add_render_attribute( 'wrapper', 'data-fill', $circle_progress_settings['fill'] ); } } ?><div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>><?php if ( ( ! empty( $settings['icon'] ) || ! empty( $settings['selected_icon']['value'] ) ) && 'inside' !== $settings['value_position'] ) { $this->render_icon(); } if ( 'inside' === $settings['value_position'] ) { $this->render_value( $settings ); } ?></div><?php if ( 'inside' !== $settings['value_position'] ) { $this->render_value( $settings ); } if ( $settings['text'] ) { $this->render_text( $settings ); } } /** * Render Icon * * Markup for the icon * * @since 0.1.0 * @return void */ protected function render_icon() { $settings = $this->get_settings_for_display(); $migrated = isset( $settings['__fa4_migrated']['selected_icon'] ); $is_new = empty( $settings['icon'] ) && Icons_Manager::is_migration_allowed(); $this->add_render_attribute( [ 'icon-wrapper' => [ 'class' => [ 'ee-circle-progress__icon', 'ee-icon-support--svg', 'ee-icon', ], ], 'icon' => [ 'class' => esc_attr( $settings['icon'] ), 'aria-hidden' => 'true', ], ] ); ?><span <?php echo $this->get_render_attribute_string( 'icon-wrapper' ); ?>><?php if ( $is_new || $migrated ) { Icons_Manager::render_icon( $settings['selected_icon'], [ 'aria-hidden' => 'true' ] ); } else { ?><i <?php echo $this->get_render_attribute_string( 'icon' ); ?>></i><?php } ?></span><?php } /** * Render Value * * Renders the template for the value * * @since 0.1.0 * @return void */ protected function render_value( $settings ) { $this->add_render_attribute( [ 'value-wrapper' => [ 'class' => [ 'ee-circle-progress__value', ], ], 'value' => [ 'class' => 'value', ], 'suffix' => [ 'class' => 'suffix', ], ] ); $this->add_inline_editing_attributes( 'suffix', 'basic' ); if ( 'hide' === $settings['value_position'] ) { $this->add_render_attribute( 'value-wrapper', 'class', 'is--hidden' ); } if ( '' !== $settings['value'] ) { $this->add_render_attribute( 'value-wrapper', 'data-cp-value', $settings['value'] ); } ?><div <?php echo $this->get_render_attribute_string( 'value-wrapper' ); ?>> <span <?php echo $this->get_render_attribute_string( 'value' ); ?>></span><?php if ( $settings['suffix'] ) { ?><span <?php echo $this->get_render_attribute_string( 'suffix' ); ?>> <?php echo $settings['suffix']; ?> </span><?php } ?></div><?php } /** * Render Text * * Renders the template for the text * * @since 0.1.0 * @return void */ protected function render_text( $settings ) { $this->add_inline_editing_attributes( 'text', 'advanced' ); $this->add_render_attribute( 'text', 'class', 'ee-circle-progress__text' ); ?><div <?php echo $this->get_render_attribute_string( 'text' ); ?>> <?php echo $this->parse_text_editor( $settings['text'] ); ?> </div><?php } /** * Content Template * * Javascript content template for quick rendering. * * @since 0.1.0 * @return void */ protected function content_template() { ?><# var circle_progress_fill = {}, entityMap = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '/': '/', '`': '`', '=': '=' }; view.addRenderAttribute( { 'wrapper' : { 'class' : [ 'ee-circle-progress', 'ee-circle-progress-position--' + settings.value_position, ], }, } ); if ( settings.suffix ) { view.addRenderAttribute( 'wrapper', 'data-suffix', settings.suffix ); } if ( settings.appear_offset ) { view.addRenderAttribute( 'wrapper', 'data-appear-top-offset', settings.appear_offset.size ); } if ( settings.fill.length > 0 ) { if ( settings.fill.length === 1 ) { if ( settings.fill[0].color != '' ) { circle_progress_fill.color = settings.fill[0].color; } } else { circle_progress_fill.gradient = []; var gradient_angle = ( settings.gradient_angle > 0 ) ? parseInt(settings.gradient_angle) : 4; _.each( settings.fill, function( fill ) { if ( fill.color != '' ) circle_progress_fill.gradient.push( fill.color ); }); circle_progress_fill.gradientAngle = Math.PI / gradient_angle; } } if ( ! jQuery.isEmptyObject( circle_progress_fill ) ) { circle_progress_fill = JSON.stringify( circle_progress_fill ); circle_progress_fill = circle_progress_fill.replace( /[&<>"'`=\/]/g, function (s) { return entityMap[s]; }); circle_progress_fill = jQuery('<textarea />').html( circle_progress_fill ).text(); view.addRenderAttribute( 'wrapper', 'data-fill', circle_progress_fill ); } #><div {{{ view.getRenderAttributeString( 'wrapper' ) }}}> <# if ( ( settings.icon || settings.selected_icon ) && 'inside' !== settings.value_position ) { #> <?php $this->_icon_template(); ?> <# } #> <# if ( 'inside' === settings.value_position ) { #> <?php $this->_value_template(); ?> <# } #> </div> <# if ( 'inside' !== settings.value_position ) { #> <?php $this->_value_template(); ?> <# } #> <# if ( settings.text ) { #> <?php $this->_text_template(); ?> <# } #> <?php } /** * Icon Template * * JS template for the icon * * @since 0.1.0 * @return void */ protected function _icon_template() { ?><# var iconHTML = elementor.helpers.renderIcon( view, settings.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ), migrated = elementor.helpers.isIconMigrated( settings, 'selected_icon' ); view.addRenderAttribute( { 'icon-wrapper' : { 'class' : [ 'ee-circle-progress__icon', 'ee-icon-support--svg', 'ee-icon', ], }, 'icon' : { 'class' : settings.icon, 'aria-hidden' : 'true', }, } ); #><div {{{ view.getRenderAttributeString( 'icon-wrapper' ) }}}><# if ( ( migrated || ! settings.icon ) && iconHTML.rendered ) { #>{{{ iconHTML.value }}}<# } else { #><i {{{ view.getRenderAttributeString( 'icon' ) }}}></i><# } #></div><?php } /** * Value Template * * JS template for the value * * @since 0.1.0 * @return void */ protected function _value_template() { ?><# view.addRenderAttribute( { 'value-wrapper' : { 'class' : [ 'ee-circle-progress__value', ], }, 'value' : { 'class' : 'value', }, 'suffix' : { 'class' : 'suffix', }, } ); if ( 'hide' === settings.value_position ) { view.addRenderAttribute( 'value-wrapper', 'classs', 'is--hidden' ); } if ( '' !== settings.value ) { view.addRenderAttribute( 'value-wrapper', 'data-cp-value', settings.value ); } view.addInlineEditingAttributes( 'suffix', 'basic' ); #><div {{{ view.getRenderAttributeString( 'value-wrapper' ) }}}> <span {{{ view.getRenderAttributeString( 'value' ) }}}></span> <# if ( settings.suffix ) { #> <span {{{ view.getRenderAttributeString( 'suffix' ) }}}>{{{ settings.suffix }}}</span> <# } #> </div><?php } /** * Text Template * * JS template for the text * * @since 0.1.0 * @return void */ protected function _text_template() { ?><# view.addRenderAttribute( 'text', 'class', 'ee-circle-progress__text' ); view.addInlineEditingAttributes( 'text', 'advanced' ); #><div {{{ view.getRenderAttributeString( 'text' ) }}}>{{{ settings.text }}}</div><?php } } circle-progress/module.php 0000644 00000001166 15112147616 0011655 0 ustar 00 <?php namespace ElementorExtras\Modules\CircleProgress; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\CircleProgress\Module * * @since 1.6.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.6.0 * @return string */ public function get_name() { return 'circle-progress'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.6.0 * @return array */ public function get_widgets() { return [ 'Circle_Progress', ]; } } custom-fields/fields/acf.php 0000644 00000004462 15112147616 0012044 0 ustar 00 <?php namespace ElementorExtras\Modules\CustomFields\Fields; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\CustomFields\Fields\Acf * * @since 2.1.0 */ class Acf extends Field_Base { /** * Get Name * * Get the name of the field type * * @since 2.1.0 * @return string */ public function get_name() { return 'acf'; } /** * Get Title * * Get the title of the field type * * @since 2.1.0 * @return string */ public function get_title() { return __( 'ACF', 'elementor-extras' ); } /** * Get Available Fields * * @since 2.1.0 * @param post_id|int The post id * @return array|bool The available ACF fields */ public function get_fields( $post_id ) { if ( ! $post_id || ! function_exists( 'get_field_objects' ) ) return; $_fields = []; $fields = get_field_objects( $post_id ); if ( ! $fields ) return; foreach ( $fields as $name => $object ) { if ( 'date_picker' === $object['type'] || 'date_time_picker' === $object['type'] ) { $_fields[ $object['key'] ] = $object['label']; } } if ( $_fields ) return $_fields; return false; } /** * Get Field Value * * Returns field value given a key and a post * * @since 2.1.0 * @param post_id|int The Post ID * @param key|string The key of the field * @return string|bool The formatted date or false */ public function get_field_value( $post_id, $key ) { // Fallback to current post if ( ! $post_id ) $post_id = get_the_ID(); // Double check for key and acf function if ( ! $key || ! function_exists( 'get_field_object' ) ) return; // Get field object $field_object = get_field_object( $key, $post_id ); $field_db_value = acf_get_metadata( $post_id, $field_object['name'] ); // Check for valid value if ( ! $field_db_value ) return; // ACF Saves date_picker types in this format $format = 'Ymd'; if ( 'date_time_picker' == $field_object['type'] ) { // ACF Saves date_time_picker types in this format $format = 'Y-m-d H:i:s'; } // Return the date in the appropriate format $date = \DateTime::createFromFormat( $format, $field_db_value ); if ( false !== $date ) return $date->format( 'Y-m-d' ); return false; } } custom-fields/fields/field-base.php 0000644 00000001220 15112147616 0013273 0 ustar 00 <?php namespace ElementorExtras\Modules\CustomFields\Fields; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\CustomFields\Fields\Field_Base * * @since 2.1.0 */ class Field_Base { /** * Get Available Fields * * @since 2.1.0 * @param post_id|int The post id */ public function get_fields( $post_id ) {} /** * Get Field Value * * Returns field value given a key and a post * * @since 2.1.0 * @param post_id|int The Post ID * @param key|string The key of the field * @return string|bool The formatted date or false */ public function get_field_value( $post_id, $key ) {} } custom-fields/fields/pods.php 0000644 00000005524 15112147616 0012260 0 ustar 00 <?php namespace ElementorExtras\Modules\CustomFields\Fields; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; use ElementorExtras\Modules\CustomFields\Fields\Field_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\CustomFields\Fields\Pods * * @since 2.1.0 */ class Pods extends Field_Base { /** * Get Name * * Get the name of the field type * * @since 2.1.0 * @return string */ public function get_name() { return 'pods'; } /** * Get Title * * Get the title of the field type * * @since 2.1.0 * @return string */ public function get_title() { return __( 'Pods', 'elementor-extras' ); } /** * Get Available Fields * * @since 2.1.0 * @param post_id|int The post id * @return array|bool The available ACF fields */ public function get_fields( $post_id ) { // Fallback to current post if ( ! $post_id ) $post_id = get_the_ID(); // Double check for key and pods function if ( ! $post_id || ! function_exists( 'pods_api' ) ) return; $all_pods = pods_api()->load_pods( [ 'table_info' => true, 'fields' => true, ] ); $_fields = []; foreach ( $all_pods as $group ) { $options = []; foreach ( $group['fields'] as $field ) { if ( ! in_array( $field['type'], [ 'date', 'datetime' ] ) ) { continue; } // Use pods ID for unique keys $key = $group['name'] . ':' . $field['pod_id'] . ':' . $field['name']; $options[ $key ] = $field['label']; } if ( empty( $options ) ) { continue; } $groups[] = [ 'label' => $group['name'], 'options' => $options, ]; foreach ( $options as $key => $value ) { $_fields[ $key ] = $value; } } if ( $_fields ) return $_fields; return false; } /** * Get Field Value * * Returns field value given a key and a post * * @since 2.1.0 * @param post_id|int The Post ID * @param key|string The key of the field * @return string|bool The formatted date or false */ public function get_field_value( $post_id, $key ) { // Fallback to current post if ( ! $post_id ) $post_id = get_the_ID(); // Double check for key and pods function if ( ! $key || ! function_exists( 'pods' ) ) return; list( $pod_name, $pod_id, $meta_key ) = explode( ':', $key ); $pod = pods( $pod_name, $post_id ); $field_data = [ 'field' => $pod->fields[ $meta_key ], 'value' => $pod->field( $meta_key ), 'display' => $pod->display( $meta_key ), 'pod' => $pod, 'key' => $meta_key, ]; $field = $field_data['field']; $value = empty( $field_data['value'] ) ? '' : $field_data['value']; if ( $field && ! empty( $field['type'] ) && in_array( $field['type'], [ 'date', 'datetime' ] ) ) { $timestamp = strtotime( $value ); $value = date( 'Y-m-d', $timestamp ); } return wp_kses_post( $value ); } } custom-fields/fields/toolset.php 0000644 00000005506 15112147616 0013004 0 ustar 00 <?php namespace ElementorExtras\Modules\CustomFields\Fields; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; use ElementorExtras\Modules\CustomFields\Fields\Field_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\CustomFields\Fields\Toolset * * @since 2.1.0 */ class Toolset extends Field_Base { /** * Get Name * * Get the name of the field type * * @since 2.1.0 * @return string */ public function get_name() { return 'toolset'; } /** * Get Title * * Get the title of the field type * * @since 2.1.0 * @return string */ public function get_title() { return __( 'Toolset', 'elementor-extras' ); } /** * Get Available Fields * * @since 2.1.0 * @param post_id|int The post id * @return array|bool The available ACF fields */ public function get_fields( $post_id ) { // Fallback to current post if ( ! $post_id ) $post_id = get_the_ID(); // Double check for key and toolset functions if ( ! function_exists( 'wpcf_admin_fields_get_groups' ) || ! function_exists( 'wpcf_admin_fields_get_fields_by_group' ) ) return; $toolset_groups = wpcf_admin_fields_get_groups(); $_fields = []; foreach ( $toolset_groups as $group ) { $options = []; $fields = wpcf_admin_fields_get_fields_by_group( $group['id'] ); if ( ! is_array( $fields ) ) { continue; } foreach ( $fields as $field_key => $field ) { if ( ! is_array( $field ) || empty( $field['type'] ) || 'date' !== $field['type'] ) { continue; } // Use group ID for unique keys $key = $group['slug'] . ':' . $field_key; $options[ $key ] = $field['name']; } if ( empty( $options ) ) { continue; } foreach ( $options as $key => $value ) { $_fields[ $key ] = $value; } } if ( $_fields ) return $_fields; return false; } /** * Get Field Value * * Returns field value given a key and a post * * @since 2.1.0 * @param post_id|int The Post ID * @param key|string The key of the field * @return string|bool The formatted date or false */ public function get_field_value( $post_id, $key ) { // Fallback to current post if ( ! $post_id ) $post_id = get_the_ID(); // Double check for key and toolset function if ( ! $key || ! function_exists( 'types_render_field' ) ) return; list( $field_group, $field_key ) = explode( ':', $key ); $field = wpcf_admin_fields_get_field( $field_key ); $value = ''; if ( $field && ! empty( $field['type'] ) && 'date' === $field['type'] ) { $timestamp = types_render_field( $field_key, [ 'post_id' => $post_id, 'output' => 'raw', 'style' => 'text', ] ); if ( ! $timestamp ) return; $timestamp = (int)$timestamp; $value = date( 'Y-m-d', $timestamp ); } return wp_kses_post( $value ); } } custom-fields/module.php 0000644 00000002625 15112147616 0011331 0 ustar 00 <?php namespace ElementorExtras\Modules\CustomFields; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\CustomFields\Module * * @since 2.1.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 2.1.0 * @return string */ public function get_name() { return 'custom-fields'; } /** * Constructor * * @access public * @since 2.1.0 * * @return void */ public function __construct() { parent::__construct(); // ACF 5 and up if ( class_exists( '\acf' ) && function_exists( 'acf_get_field_groups' ) ) { // $this->add_component( 'acf', new Fields\Acf() ); $this->add_component( 'acf', new Fields\Acf() ); } if ( function_exists( 'pods' ) ) { $this->add_component( 'pods', new Fields\Pods() ); } if ( function_exists( 'wpcf_admin_fields_get_groups' ) ) { $this->add_component( 'toolset', new Fields\Toolset() ); } // Basic post meta // $this->add_component( 'meta', new Fields\Meta() ); } /** * Get Field Types * * Fetches available custom fields types * * @since 2.0.0 */ public function get_field_types() { $field_types = []; foreach( $this->get_components() as $name => $component ) { $field_types[ $component->get_name() ] = $component->get_title(); } return $field_types; } } devices/widgets/devices.php 0000644 00000234067 15112147616 0012007 0 ustar 00 <?php namespace ElementorExtras\Modules\Devices\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Control_Media; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Border; use Elementor\Group_Control_Box_Shadow; use Elementor\Utils; use Elementor\Modules\DynamicTags\Module as TagsModule; use DomDocument; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Devices * * @since 0.1.0 */ class Devices extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 1.2.0 * @return string */ public function get_name() { return 'devices-extended'; } /** * Get Title * * Get the title of the widget * * @since 1.2.0 * @return string */ public function get_title() { return __( 'Devices', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 1.2.0 * @return string */ public function get_icon() { return 'nicon nicon-mobile'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 0.1.0 * @return array */ public function get_script_depends() { return [ 'video-player', 'iphone-inline-video', 'jquery-appear' ]; } /** * Register Widget Controls * * @since 0.1.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_content', [ 'label' => __( 'Device', 'elementor-extras' ), ] ); $this->add_control( 'device_type', [ 'label' => __( 'Type', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'phone', 'options' => [ 'phone' => [ 'title' => __( 'Phone', 'elementor-extras' ), 'icon' => 'fa fa-mobile-phone', ], 'tablet' => [ 'title' => __( 'Tablet', 'elementor-extras' ), 'icon' => 'fa fa-tablet', ], 'laptop' => [ 'title' => __( 'Laptop', 'elementor-extras' ), 'icon' => 'fa fa-laptop', ], 'desktop' => [ 'title' => __( 'Desktop', 'elementor-extras' ), 'icon' => 'fa fa-desktop', ], 'window' => [ 'title' => __( 'Window', 'elementor-extras' ), 'icon' => 'nicon nicon-window', ], ], 'frontend_available' => true, ] ); $this->add_control( 'device_media_type', [ 'label' => __( 'Media Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'image', 'options' => [ 'image' => __( 'Image', 'elementor-extras' ), 'video' => __( 'Video', 'elementor-extras' ), ], ] ); $this->add_control( 'device_orientation', [ 'label' => __( 'Orientation', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'portrait', 'options' => [ 'portrait' => [ 'title' => __( 'Portrait', 'elementor-extras' ), 'icon' => 'nicon nicon-mobile-portrait', ], 'landscape' => [ 'title' => __( 'Landscape', 'elementor-extras' ), 'icon' => 'nicon nicon-mobile-landscape', ], ], 'prefix_class' => 'ee-device-orientation-', 'condition' => [ 'device_type' => [ 'phone', 'tablet' ], 'device_media_type' => [ 'image' ], ] ] ); $this->add_control( 'device_orientation_control', [ 'label' => __( 'Orientation Control', 'elementor-extras' ), 'description' => __( 'Show orientation control on frontend. ', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'no', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'device_type' => [ 'phone', 'tablet' ], 'device_media_type' => [ 'image' ], ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'device_align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_responsive_control( 'device_width', [ 'label' => __( 'Maximum Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1920, 'step' => 10, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-device-wrapper' => 'max-width: {{SIZE}}{{UNIT}}; width: 100%;', '{{WRAPPER}} .ee-device' => 'width: 100%;', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_screenshot', [ 'label' => __( 'Screen', 'elementor-extras' ), 'condition' => [ 'device_media_type' => [ 'image' ], ] ] ); $this->start_controls_tabs( 'tabs_media' ); $this->start_controls_tab( 'tab_media_portrait', [ 'label' => __( 'Default', 'elementor-extras' ), ] ); $this->add_control( 'media_portrait_screenshot', [ 'label' => __( 'Choose Screenshot', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true ], 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], 'condition' => [ 'device_media_type' => [ 'image' ], ] ] ); $this->add_control( 'screen_phone_notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Use an image or video with the ratio of 16:9', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', 'condition' => [ 'device_type' => [ 'phone', 'desktop' ], ], ] ); $this->add_control( 'screen_tablet_notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Use an image or video with the ratio of 4:3', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', 'condition' => [ 'device_type' => 'tablet' ], ] ); $this->add_control( 'screen_laptop_notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Use an image or video with the ratio of 16:10', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', 'condition' => [ 'device_type' => 'laptop' ], ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'media_portrait_screenshot', 'label' => __( 'Screenshot Size', 'elementor-extras' ), 'default' => 'large', 'condition' => [ 'media_portrait_screenshot[url]!' => '', 'device_media_type' => [ 'image' ], ] ] ); $this->add_control( 'media_portrait_screenshot_scrollable', [ 'label' => __( 'Scrollable', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'no', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'scrollable', 'prefix_class' => 'ee-device-portrait-', 'condition' => [ 'media_portrait_screenshot[url]!' => '', 'device_media_type' => [ 'image' ], 'device_type!' => [ 'window' ], ] ] ); $this->add_responsive_control( 'media_portrait_screenshot_align', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'flex-start', 'options' => [ 'flex-start' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'nicon nicon-mobile-screen-top', ], 'center' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'nicon nicon-mobile-screen-center', ], 'flex-end' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'nicon nicon-mobile-screen-bottom', ], 'initial' => [ 'title' => __( 'Custom', 'elementor-extras' ), 'icon' => 'nicon nicon-mobile-screen-custom', ], ], 'selectors' => [ '{{WRAPPER}} .ee-device__media__screen--image' => 'align-items: {{VALUE}};', '{{WRAPPER}} .ee-device__media__screen--image .ee-device__media__screen__inner' => 'top: auto;', ], 'condition' => [ 'media_portrait_screenshot_scrollable!' => 'scrollable', 'media_portrait_screenshot[url]!' => '', 'device_media_type' => [ 'image' ], 'device_type!' => [ 'window' ], ] ] ); $this->add_control( 'media_portrait_screenshot_position', [ 'label' => __( 'Offset Top (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-device__media__screen--image .ee-device__media__screen__inner figure' => 'transform: translateY(-{{SIZE}}%);', ], 'condition' => [ 'media_portrait_screenshot_scrollable!' => 'scrollable', 'media_portrait_screenshot_align' => 'initial', 'media_portrait_screenshot[url]!' => '', 'device_media_type' => [ 'image' ], 'device_type!' => [ 'window' ], ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_media_landscape', [ 'label' => __( 'Landscape', 'elementor-extras' ), 'condition' => [ 'device_orientation_control' => 'yes', 'device_type' => [ 'phone', 'tablet' ], 'device_media_type' => [ 'image' ], ] ] ); $this->add_control( 'media_landscape_screenshot', [ 'label' => __( 'Choose Screenshot', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true ], 'condition' => [ 'device_orientation_control' => 'yes', 'device_type' => [ 'phone', 'tablet' ], 'device_media_type' => [ 'image' ], ], ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'media_landscape_screenshot', // Actually its `image_size` 'label' => __( 'Screenshot Size', 'elementor-extras' ), 'default' => 'large', 'condition' => [ 'device_orientation_control' => 'yes', 'device_type' => [ 'phone', 'tablet' ], 'device_media_type' => [ 'image' ], 'media_landscape_screenshot[url]!' => '', ] ] ); $this->add_control( 'media_landscape_screenshot_scrollable', [ 'label' => __( 'Scrollable', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'no', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'scrollable', 'prefix_class' => 'ee-device-landscape-', 'condition' => [ 'device_orientation_control' => 'yes', 'device_type' => [ 'phone', 'tablet' ], 'device_media_type' => [ 'image' ], 'media_landscape_screenshot[url]!' => '' ] ] ); $this->add_responsive_control( 'media_landscape_screenshot_align', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'flex-start', 'options' => [ 'flex-start' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'nicon nicon-mobile-screen-top', ], 'center' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'nicon nicon-mobile-screen-center', ], 'flex-end' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'nicon nicon-mobile-screen-bottom', ], 'initial' => [ 'title' => __( 'Custom', 'elementor-extras' ), 'icon' => 'nicon nicon-mobile-screen-custom', ], ], 'selectors' => [ '{{WRAPPER}} .ee-device__media__screen.ee-device__media__screen__landscape' => 'align-items: {{VALUE}};', '{{WRAPPER}} .ee-device__media__screen__landscape .ee-device__media__screen__inner' => 'top: auto;', ], 'condition' => [ 'media_landscape_screenshot_scrollable!' => 'scrollable', 'device_orientation_control' => 'yes', 'device_type' => [ 'phone', 'tablet' ], 'device_media_type' => [ 'image' ], 'media_landscape_screenshot[url]!' => '', ] ] ); $this->add_control( 'media_landscape_screenshot_position', [ 'label' => __( 'Offset Top (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-device__media__screen__landscape .ee-device__media__screen__inner' => 'transform: translateY(-{{SIZE}}%);', ], 'condition' => [ 'media_landscape_screenshot_scrollable!' => 'scrollable', 'media_landscape_screenshot_align' => 'initial', 'device_orientation_control' => 'yes', 'device_type' => [ 'phone', 'tablet' ], 'device_media_type' => [ 'image' ], 'media_landscape_screenshot[url]!' => '' ] ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_video', [ 'label' => __( 'Video', 'elementor-extras' ), 'condition' => [ 'device_media_type' => 'video', ] ] ); $this->start_controls_tabs( 'tabs_sources' ); $this->start_controls_tab( 'tab_source_mp4', [ 'label' => __( 'MP4', 'elementor-extras' ), 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_source', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'url', 'options' => [ 'url' => __( 'URL', 'elementor-extras' ), 'file' => __( 'File', 'elementor-extras' ), ], ] ); $this->add_control( 'video_url', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], 'condition' => [ 'video_source' => 'url', 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_file', [ 'label' => __( 'File', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::MEDIA_CATEGORY, ], ], 'media_type' => 'video', 'condition' => [ 'video_source' => 'file', 'device_media_type' => [ 'video' ], ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_source_m4v', [ 'label' => __( 'M4V', 'elementor-extras' ), 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_source_m4v', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'url', 'options' => [ 'url' => __( 'URL', 'elementor-extras' ), 'file' => __( 'File', 'elementor-extras' ), ], ] ); $this->add_control( 'video_url_m4v', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], 'condition' => [ 'video_source_m4v' => 'url', 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_file_m4v', [ 'label' => __( 'File', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::MEDIA_CATEGORY, ], ], 'media_type' => 'video', 'condition' => [ 'video_source_m4v' => 'file', 'device_media_type' => [ 'video' ], ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_source_ogg', [ 'label' => __( 'OGG', 'elementor-extras' ), 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_source_ogg', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'url', 'options' => [ 'url' => __( 'URL', 'elementor-extras' ), 'file' => __( 'File', 'elementor-extras' ), ], ] ); $this->add_control( 'video_url_ogg', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], 'condition' => [ 'video_source_ogg' => 'url', 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_file_ogg', [ 'label' => __( 'File', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::MEDIA_CATEGORY, ], ], 'media_type' => 'video', 'condition' => [ 'video_source_ogg' => 'file', 'device_media_type' => [ 'video' ], ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_source_webm', [ 'label' => __( 'WEBM', 'elementor-extras' ), 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_source_webm', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'url', 'options' => [ 'url' => __( 'URL', 'elementor-extras' ), 'file' => __( 'File', 'elementor-extras' ), ], ] ); $this->add_control( 'video_url_webm', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], 'condition' => [ 'video_source_webm' => 'url', 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_file_webm', [ 'label' => __( 'File', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::MEDIA_CATEGORY, ], ], 'media_type' => 'video', 'condition' => [ 'video_source_webm' => 'file', 'device_media_type' => [ 'video' ], ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'video_cover', [ 'label' => __( 'Choose Cover', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true ], 'separator' => 'before', 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'video_cover', 'label' => __( 'Cover Size', 'elementor-extras' ), 'default' => 'large', 'condition' => [ 'video_cover[url]!' => '', 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_behaviour_heading', [ 'label' => __( 'Behaviour', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_autoplay', [ 'label' => __( 'Auto Play', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'autoplay', 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_autoplay_notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Many browsers don\'t allow videos with sound to autoplay without user interaction. To avoid this, enable the "Start Muted" control to disable sound so that the video autoplays correctly.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'condition' => [ 'video_autoplay!' => '', 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_stop_others', [ 'label' => __( 'Stop Others', 'elementor-extras' ), 'description' => __( 'Stop all other videos on page when this video is played.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_play_viewport', [ 'label' => __( 'Play in Viewport', 'elementor-extras' ), 'description' => __( 'Autoplay video when the player is in viewport', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'device_media_type' => [ 'video' ], 'video_autoplay' => 'autoplay', ], 'frontend_available' => true, ] ); $this->add_control( 'video_stop_viewport', [ 'label' => __( 'Stop on leave', 'elementor-extras' ), 'description' => __( 'Stop video when the player has left the viewport', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'device_media_type' => [ 'video' ], 'video_autoplay' => 'autoplay', 'video_play_viewport' => 'yes', ], 'frontend_available' => true, ] ); $this->add_control( 'video_restart_on_pause', [ 'label' => __( 'Restart on pause', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_loop', [ 'label' => __( 'Loop', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'loop', 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_end_at_last_frame', [ 'label' => __( 'End at last frame', 'elementor-extras' ), 'description' => __( 'End the video at the last frame instead of showing the first one.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'device_media_type' => [ 'video' ], 'video_loop' => '', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'video_speed', [ 'label' => __( 'Playback Speed', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 5, 'min' => 0.1, 'step' => 0.01, ], ], 'condition' => [ 'device_media_type' => [ 'video' ], ], 'frontend_available' => true, ] ); $this->add_control( 'video_display_heading', [ 'label' => __( 'Display', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_show_buttons', [ 'label' => __( 'Show Buttons', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_show_bar', [ 'label' => __( 'Show Bar', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_bar_hide', [ 'label' => __( 'Hide Bar When Playing', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'hide', 'prefix_class' => 'ee-video-player-bar--', 'return_value' => 'hide', 'condition' => [ 'video_show_bar' => 'show', ], ] ); $this->add_control( 'video_show_rewind', [ 'label' => __( 'Show Rewind', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'device_media_type' => [ 'video' ], 'video_restart_on_pause!' => 'yes', ], ] ); $this->add_control( 'video_show_time', [ 'label' => __( 'Show Time', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'device_media_type' => [ 'video' ], 'video_show_bar!' => '', ] ] ); $this->add_control( 'video_show_progress', [ 'label' => __( 'Show Progress', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'device_media_type' => [ 'video' ], 'video_show_bar!' => '', ] ] ); $this->add_control( 'video_show_duration', [ 'label' => __( 'Show Duration', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'device_media_type' => [ 'video' ], 'video_show_bar!' => '', ] ] ); $this->add_control( 'video_show_fs', [ 'label' => __( 'Show Fullscreen', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'device_media_type' => [ 'video' ], 'video_show_bar!' => '', ], ] ); $this->add_control( 'video_volume_heading', [ 'label' => __( 'Volume', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_show_volume', [ 'label' => __( 'Show Volume', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'device_media_type' => [ 'video' ], 'video_show_bar!' => '', ], ] ); $this->add_control( 'video_show_volume_icon', [ 'label' => __( 'Show Volume Icon', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'video_show_bar!' => '', 'video_show_volume!' => '', 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_show_volume_bar', [ 'label' => __( 'Show Volume Bar', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'video_show_bar!' => '', 'video_show_volume!' => '', 'device_media_type' => [ 'video' ], ], ] ); $this->add_control( 'video_start_muted', [ 'label' => __( 'Start Muted', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'condition' => [ 'video_autoplay!' => '', 'device_media_type' => [ 'video' ], ], ] ); $this->add_responsive_control( 'video_volume', [ 'label' => __( 'Initial Volume', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.8, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'condition' => [ 'device_media_type' => [ 'video' ], 'video_start_muted!' => 'yes', ], 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_device_style', [ 'label' => __( 'Device', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'device_override_style', [ 'label' => __( 'Override Style', 'elementor-extras' ), 'description' => __( 'Override default device style', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'no', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', ] ); $this->add_control( 'device_skin', [ 'label' => __( 'Skin', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'jetblack', 'options' => [ 'jetblack' => __( 'Jet black', 'elementor-extras' ), 'black' => __( 'Black', 'elementor-extras' ), 'silver' => __( 'Silver', 'elementor-extras' ), 'gold' => __( 'Gold', 'elementor-extras' ), 'rosegold' => __( 'Rose Gold', 'elementor-extras' ), ], 'prefix_class' => 'ee-device-skin-', 'condition' => [ 'device_override_style!' => 'yes', 'device_type!' => [ 'laptop', 'desktop' ] ], ] ); $this->add_control( 'device_frame_background', [ 'label' => __( 'Device Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-device-wrapper svg .back-shape' => 'fill: {{VALUE}}', '{{WRAPPER}} .ee-device-wrapper svg .side-shape' => 'fill: {{VALUE}}', ], 'condition' => [ 'device_override_style' => 'yes' ], ] ); $this->add_control( 'device_overlay_tone', [ 'label' => __( 'Tone', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'light', 'options' => [ 'light' => __( 'Light', 'elementor-extras' ), 'dark' => __( 'Dark', 'elementor-extras' ), ], 'prefix_class' => 'ee-device-controls-tone-', 'condition' => [ 'device_override_style' => 'yes', ], ] ); $this->add_control( 'device_overlay_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.2, ], 'range' => [ 'px' => [ 'max' => 0.4, 'min' => 0.1, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-device-wrapper svg .overlay-shape' => 'fill-opacity: {{SIZE}};', ], 'condition' => [ 'device_override_style' => 'yes' ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_orientation_style', [ 'label' => __( 'Orientation Control', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'device_orientation_control!' => '', ], ] ); $this->start_controls_tabs( 'tabs_orientation_style' ); $this->start_controls_tab( 'orientation_default', [ 'label' => __( 'Default', 'elementor-extras' ), ] ); $this->add_control( 'orientation_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-device__orientation' => 'color: {{VALUE}}', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'orientation_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), ] ); $this->add_control( 'orientation_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-device__orientation:hover' => 'color: {{VALUE}}', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_video_style', [ 'label' => __( 'Video', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'device_media_type' => 'video', 'device_type!' => 'window', ], ] ); $this->add_control( 'video_cover_screen', [ 'label' => __( 'Cover Screen', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'cover', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'condition' => [ 'device_media_type' => 'video', 'device_type!' => 'window' , ], 'prefix_class' => 'ee-device-video-', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_screen_style', [ 'label' => __( 'Screen', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'device_media_type' => [ 'image' ], 'device_type' => [ 'window' ], ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'device_screen_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-device-wrapper .ee-device__media__screen figure', 'condition' => [ 'device_type' => [ 'window' ], 'device_media_type' => [ 'image' ], ], ] ); $this->add_control( 'device_screen_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'allowed_dimensions' => [ 'bottom', 'left' ], 'selectors' => [ '{{WRAPPER}} .ee-device-wrapper .ee-device__media__screen figure' => 'border-radius: 0 0 {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'device_type' => [ 'window' ], 'device_media_type' => [ 'image' ], ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_video_overlay', [ 'label' => __( 'Video Overlay', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'device_media_type' => 'video', ], ] ); $this->add_control( 'video_overlay_background', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '#000000', 'selectors' => [ '{{WRAPPER}} .ee-video-player__cover::after' => 'background-color: {{VALUE}}', ], 'condition' => [ 'device_media_type' => 'video', ], ] ); $this->add_responsive_control( 'video_overlay_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.8, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__cover::after' => 'opacity: {{SIZE}}', ], 'condition' => [ 'device_media_type' => 'video', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style', [ 'label' => __( 'Video Interface', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'name' => 'device_media_type', 'operator' => '==', 'value' => 'video', ], [ 'relation' => 'or', 'terms' => [ [ 'name' => 'video_show_buttons', 'operator' => '==', 'value' => 'show', ], [ 'name' => 'video_show_bar', 'operator' => '==', 'value' => 'show', ], ], ], ], ], ] ); $this->add_control( 'video_controls_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'default' => [ 'top' => 100, 'right' => 100, 'bottom' => 100, 'left' => 100, 'unit' => 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar .ee-player__control--progress' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar .ee-player__control--progress__inner' => 'border-radius: 0 {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} 0;' ], ] ); $this->start_controls_tabs( 'tabs_controls_style' ); $this->start_controls_tab( 'video_controls', [ 'label' => __( 'Default', 'elementor-extras' ), ] ); $this->add_control( 'video_controls_foreground', [ 'label' => __( 'Controls Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '#000000', 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar' => 'color: {{VALUE}}', '{{WRAPPER}} .ee-video-player__controls .ee-player__control--progress__inner' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'video_controls_background', [ 'label' => __( 'Controls Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '#FFFFFF', 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'video_controls_opacity', [ 'label' => __( 'Controls Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.9, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar' => 'opacity: {{SIZE}}', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'video_controls_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'video_controls_shadow', 'selector' => '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'video_controls_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), ] ); $this->add_control( 'video_controls_foreground_hover', [ 'label' => __( 'Controls Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '(desktop+){{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control:hover, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar:hover' => 'color: {{VALUE}}', '(desktop+){{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar:hover .ee-player__control--progress__inner' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'video_controls_background_hover', [ 'label' => __( 'Controls Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '(desktop+){{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control:hover, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar:hover' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'video_controls_opacity_hover', [ 'label' => __( 'Controls Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '(desktop+){{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control:hover, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar:hover' => 'opacity: {{SIZE}}', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'video_controls_border_hover', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '(desktop+){{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control:hover, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar:hover', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'video_controls_shadow_hover', 'selector' => '(desktop+){{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control:hover, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar:hover', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_buttons_style', [ 'label' => __( 'Video Buttons', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'device_media_type' => 'video', 'video_show_buttons!' => '', ], ] ); $this->add_responsive_control( 'video_buttons_size', [ 'label' => __( 'Size (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 60, ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control' => 'font-size: {{SIZE}}px; width: {{SIZE}}px; height: {{SIZE}}px;', ], 'condition' => [ 'video_show_buttons!' => '', ], ] ); $this->add_responsive_control( 'video_buttons_spacing', [ 'label' => __( 'Controls Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__controls__rewind' => 'margin-right: {{SIZE}}px;', ], 'condition' => [ 'video_show_buttons!' => '', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_bar_style', [ 'label' => __( 'Video Bar', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'device_media_type' => 'video', 'video_show_bar!' => '', ], ] ); $this->add_responsive_control( 'video_bar_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'max' => 72, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar' => 'padding: {{SIZE}}px', ], 'condition' => [ 'video_show_bar!' => '', ], ] ); $this->add_responsive_control( 'video_bar_margin', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'max' => 72, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar-wrapper' => 'padding: 0 {{SIZE}}px {{SIZE}}px {{SIZE}}px', ], 'condition' => [ 'video_show_bar!' => '', ], ] ); $this->add_control( 'video_bar_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'video_show_bar!' => '', ], ] ); $this->add_responsive_control( 'video_bar_zoom', [ 'label' => __( 'Controls Zoom', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'max' => 36, 'min' => 6, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar' => 'font-size: {{SIZE}}px', '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar .ee-player__control--progress' => 'height: {{SIZE}}px', ], 'condition' => [ 'video_show_bar!' => '', ], ] ); $this->add_responsive_control( 'video_bar_spacing', [ 'label' => __( 'Controls Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'max' => 24, 'min' => 3, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__control--indicator, {{WRAPPER}} .ee-video-player__controls .ee-player__control--icon' => 'padding: 0 {{SIZE}}px', '{{WRAPPER}} .ee-video-player__controls .ee-player__control--progress' => 'margin: 0 {{SIZE}}px', ], 'condition' => [ 'video_show_bar!' => '', ], ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 0.1.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); // Default to phone $device_type = 'phone'; // Only assign device type if selected if ( ! empty( $settings['device_type'] ) ) { $device_type = $settings['device_type']; } $this->add_render_attribute( [ 'device-wrapper' => [ 'class' => [ 'ee-device-wrapper', 'ee-device-type-' . $device_type, ], ], 'device' => [ 'class' => [ 'ee-device', ], ], 'device-orientation' => [ 'class' => [ 'ee-device__orientation', 'nicon', 'nicon-mobile-landscape', ], ], 'device-shape' => [ 'class' => [ 'ee-device__shape', ], ], 'device-media' => [ 'class' => [ 'ee-device__media', ], ], 'device-media-inner' => [ 'class' => [ 'ee-device__media__inner', ], ], 'device-media-screen' => [ 'class' => [ 'ee-device__media__screen', 'ee-device__media__screen--' . $settings['device_media_type'], ], ], 'device-media-screen-landscape' => [ 'class' => [ 'ee-device__media__screen', 'ee-device__media__screen__landscape', ], ], 'device-media-screen-controls' => [ 'class' => [ 'ee-device__media__screen', 'ee-device__media__screen__controls', ], ], 'device-media-screen-inner' => [ 'class' => [ 'ee-device__media__screen__inner', ], ], ] ); if ( 'yes' === $settings['device_orientation_control'] && 'image' === $settings['device_media_type'] ) { $this->add_render_attribute('device', 'class', 'has--orientation-control'); } ?><div <?php echo $this->get_render_attribute_string('device-wrapper'); ?>> <div <?php echo $this->get_render_attribute_string('device'); ?>> <?php if ( 'yes' === $settings['device_orientation_control'] && 'image' === $settings['device_media_type'] ) { ?> <div <?php echo $this->get_render_attribute_string('device-orientation'); ?>></div> <?php } ?> <div <?php echo $this->get_render_attribute_string('device-shape'); ?>> <?php include ELEMENTOR_EXTRAS_PATH . 'assets/shapes/' . $device_type . '.svg'; ?> </div><!-- .ee-device__shape --> <div <?php echo $this->get_render_attribute_string('device-media'); ?>> <div <?php echo $this->get_render_attribute_string('device-media-inner'); ?>> <div <?php echo $this->get_render_attribute_string('device-media-screen'); ?>> <div <?php echo $this->get_render_attribute_string('device-media-screen-inner'); ?>> <?php if ( 'image' === $settings['device_media_type'] ) { ?> <?php $this->render_type_image( 'media_portrait_screenshot' ); ?> <?php } elseif ( 'video' === $settings['device_media_type'] ) { ?> <?php $this->render_type_video(); ?> <?php } ?> </div><!-- .ee-device__media__screen__inner --> </div><!-- .ee-device__media__screen --> <?php if ( 'image' === $settings['device_media_type'] && '' !== $settings['media_landscape_screenshot']['url'] ) { ?> <div <?php echo $this->get_render_attribute_string('device-media-screen-landscape'); ?>> <div <?php echo $this->get_render_attribute_string('device-media-screen-inner'); ?>> <figure> <?php $this->render_type_image( 'media_landscape_screenshot' ); ?> </figure> </div><!-- .ee-device__media__screen__inner --> </div><!-- .ee-device__media__screen__landscape --> <?php } ?> </div><!-- .ee-device__media__inner --> </div><!-- .ee-device__media --> </div><!-- .ee-device --> </div><!-- .ee-device-wrapper --><?php } /** * Render Type Image * * Render markup for the image * * @since 0.1.0 * @param control|string The control id * @return void */ protected function render_type_image( $control ) { $settings = $this->get_settings_for_display(); if ( '' !== $settings['media_portrait_screenshot']['url'] ) { ?> <figure><?php echo Group_Control_Image_Size::get_attachment_image_html( $settings, $control ); ?></figure> <?php } } protected function render_type_video() { $settings = $this->get_settings_for_display(); if ( empty( $settings['video_file']['url'] ) && empty( $settings['video_file_ogg']['url'] ) && empty( $settings['video_file_webm']['url'] ) && empty( $settings['video_file_m4v']['url'] ) && empty( $settings['video_url'] ) && empty( $settings['video_url_ogg'] ) && empty( $settings['video_url_webm'] ) && empty( $settings['video_url_m4v'] ) ) return; $this->add_render_attribute( [ 'video-wrapper' => [ 'class' => [ 'ee-video-player', 'ee-player' ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'video-wrapper' ); ?>> <?php $this->render_video(); ?> <?php $this->render_cover(); ?> <?php $this->render_controls(); ?> </div><!-- .ee-video-player --> <?php } /** * Render Video * * Render markup for the video * * @since 0.1.0 * @return void */ protected function render_video() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( 'video', [ 'class' => [ 'ee-video-player__source', 'ee-player__source' ], 'playsinline' => 'true', 'webkit-playsinline' => 'true', 'width' => '100%', 'height' => '100%', ] ); if ( 'autoplay' === $settings['video_autoplay'] && 'yes' !== $settings['video_play_viewport'] ) { $this->add_render_attribute( 'video', 'autoplay', 'true' ); } if ( 'yes' === $settings['video_start_muted'] ) { $this->add_render_attribute( 'video', 'muted', 'true' ); } if ( 'loop' === $settings['video_loop'] ) { $this->add_render_attribute( 'video', 'loop', 'true' ); } if ( ! empty( $settings['video_cover']['url'] ) ) { $url = Group_Control_Image_Size::get_attachment_image_src( $settings['video_cover']['id'], 'video_cover', $settings ); $this->add_render_attribute( 'video', 'poster', $url ); } ?><video <?php echo $this->get_render_attribute_string( 'video' ); ?>><?php $video_url = ( 'file' === $settings['video_source'] ) ? $settings['video_file']['url'] : $settings['video_url']; $video_url_m4v = ( 'file' === $settings['video_source_m4v'] ) ? $settings['video_file_m4v']['url'] : $settings['video_url_m4v']; $video_url_ogg = ( 'file' === $settings['video_source_ogg'] ) ? $settings['video_file_ogg']['url'] : $settings['video_url_ogg']; $video_url_webm = ( 'file' === $settings['video_source_webm'] ) ? $settings['video_file_webm']['url'] : $settings['video_url_webm']; if ( $video_url ) { $this->add_render_attribute( 'source-mp4', [ 'src' => $video_url, 'type' => 'video/mp4', ] ); ?><source <?php echo $this->get_render_attribute_string( 'source-mp4' ); ?>><?php } ?> <?php if ( $video_url_m4v ) { $this->add_render_attribute( 'source-m4v', [ 'src' => $video_url_m4v, 'type' => 'video/m4v', ] ); ?><source <?php echo $this->get_render_attribute_string( 'source-m4v' ); ?>><?php } ?> <?php if ( $video_url_ogg ) { $this->add_render_attribute( 'source-ogg', [ 'src' => $video_url_ogg, 'type' => 'video/ogg', ] ); ?><source <?php echo $this->get_render_attribute_string( 'source-wav' ); ?>><?php } ?> <?php if ( $video_url_webm ) { $this->add_render_attribute( 'source-webm', [ 'src' => $video_url_webm, 'type' => 'video/webm', ] ); ?><source <?php echo $this->get_render_attribute_string( 'source-webm' ); ?>><?php } ?> </video><?php } /** * Render Cover * * Render markup for the cover * * @since 0.1.0 * @return void */ protected function render_cover() { $this->add_render_attribute( 'video-cover', [ 'class' => [ 'ee-video-player__cover', 'ee-player__cover', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'video-cover' ); ?>></div><?php } /** * Render Controls * * Render markup for the player controls * * @since 0.1.0 * @return void */ protected function render_controls() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'controls' => [ 'class' => [ 'ee-video-player__controls', 'ee-player__controls', ], ], 'bar-wrapper' => [ 'class' => [ 'ee-player__controls__bar-wrapper', 'ee-video-player__controls__bar-wrapper', ], ], 'bar' => [ 'class' => [ 'ee-player__controls__bar', ], ], 'control-play' => [ 'class' => [ 'ee-player__control', 'ee-player__controls__play', 'ee-player__control--icon', 'nicon', 'nicon-play', ], ], ] ); ?> <div <?php echo $this->get_render_attribute_string( 'controls' ); ?>><?php /** * Before overlay. * * Fires before printing the overlay controls. * * @since 2.2.0 */ do_action( 'elementor_extras/widgets/devices/video/before_overlay' ); $this->render_overlay(); /** * After overlay. * * Fires after printing the overlay controls. * * @since 2.2.0 */ do_action( 'elementor_extras/widgets/devices/video/before_overlay' ); if ( 'show' === $settings['video_show_bar'] ) { /** * Before bar. * * Fires before printing the controls bar. * * @since 2.2.0 */ do_action( 'elementor_extras/widgets/devices/video/before_bar' ); ?><div <?php echo $this->get_render_attribute_string( 'bar-wrapper' ); ?>> <div <?php echo $this->get_render_attribute_string( 'bar' ); ?>> <?php if ( 'yes' !== $settings['video_restart_on_pause'] && 'show' === $settings['video_show_rewind'] ) { $this->add_render_attribute( 'control-rewind', [ 'class' => [ 'ee-player__control', 'ee-player__controls__rewind', 'ee-player__control--icon', 'nicon', 'nicon-rewind', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-rewind' ); ?>></div><?php } ?> <div <?php echo $this->get_render_attribute_string( 'control-play' ); ?>></div> <?php if ( $settings['video_show_time'] ) { $this->add_render_attribute( 'control-time', [ 'class' => [ 'ee-player__control', 'ee-player__control--indicator', 'ee-player__controls__time', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-time' ); ?>>00:00</div><?php } ?> <?php if ( $settings['video_show_progress'] ) { $this->add_render_attribute( [ 'control-progress' => [ 'class' => [ 'ee-player__control', 'ee-player__controls__progress', 'ee-player__control--progress', ], ], 'control-progress-time' => [ 'class' => [ 'ee-player__controls__progress-time', 'ee-player__control--progress__inner', ], ], 'control-progress-track' => [ 'class' => [ 'ee-player__control--progress__inner', 'ee-player__control--progress__track', ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-progress' ); ?>> <div <?php echo $this->get_render_attribute_string( 'control-progress-time' ); ?>></div> <div <?php echo $this->get_render_attribute_string( 'control-progress-track' ); ?>></div> </div><?php } ?> <?php if ( $settings['video_show_duration'] ) { $this->add_render_attribute( 'control-duration', [ 'class' => [ 'ee-player__control', 'ee-player__controls__duration', 'ee-player__control--indicator', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-duration' ); ?>>00:00</div><?php } ?> <?php if ( $settings['video_show_volume'] ) { $this->add_render_attribute( 'control-volume', [ 'class' => [ 'ee-player__control', 'ee-player__controls__volume', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-volume' ); ?>> <?php if ( $settings['video_show_volume_icon'] ) { $this->add_render_attribute( 'control-volume-icon', [ 'class' => [ 'ee-player__controls__volume-icon', 'ee-player__control--icon', 'nicon', 'nicon-volume', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-volume-icon' ); ?>></div><?php } ?> <?php if ( $settings['video_show_volume_bar'] ) { $this->add_render_attribute( [ 'control-volume-bar' => [ 'class' => [ 'ee-player__control', 'ee-player__controls__volume-bar', 'ee-player__control--progress', ], ], 'control-volume-bar-amount' => [ 'class' => [ 'ee-player__controls__volume-bar__amount', 'ee-player__control--progress__inner', ], ], 'control-volume-bar-track' => [ 'class' => [ 'ee-player__controls__volume-bar__track', 'ee-player__control--progress__inner', 'ee-player__control--progress__track', ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-volume-bar' ); ?>> <div <?php echo $this->get_render_attribute_string( 'control-volume-bar-amount' ); ?>></div> <div <?php echo $this->get_render_attribute_string( 'control-volume-bar-track' ); ?>></div> </div><?php } ?> </div><?php } ?> <?php if ( $settings['video_show_fs'] ) { $this->add_render_attribute( 'control-fullscreen', [ 'class' => [ 'ee-player__control', 'ee-player__controls__fs', 'ee-player__control--icon', 'nicon', 'nicon-expand' ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-fullscreen' ); ?>></div><?php } ?> </div><!-- .ee-player__controls__bar --> </div><!-- .ee-player__controls__bar-wrapper --><?php /** * After bar. * * Fires after printing the controls bar. * * @since 2.2.0 */ do_action( 'elementor_extras/widgets/devices/video/after_bar' ); } ?></div><!-- .ee-video-player__controls --> <?php } /** * Render Overlay * * Render markup for the overlay * * @since 0.1.0 * @return void */ protected function render_overlay() { $settings = $this->get_settings_for_display(); if ( 'show' === $settings['video_show_buttons'] ) { $this->add_render_attribute( [ 'overlay' => [ 'class' => [ 'ee-player__controls__overlay', 'ee-video-player__overlay', ], ], 'overlay-play' => [ 'class' => [ 'ee-player__control', 'ee-player__controls__play', 'nicon', 'nicon-play', ], ], ] ); ?><ul <?php echo $this->get_render_attribute_string( 'overlay' ); ?>><?php if ( 'yes' !== $settings['video_restart_on_pause'] && 'show' === $settings['video_show_rewind'] ) { $this->add_render_attribute( 'overlay-rewind', [ 'class' => [ 'ee-player__control', 'ee-player__controls__rewind', 'nicon', 'nicon-rewind', ], ] ) ?><li <?php echo $this->get_render_attribute_string( 'overlay-rewind' ); ?>></li><?php } ?><li <?php echo $this->get_render_attribute_string( 'overlay-play' ); ?>></li> </ul> <?php } } /** * Content Template * * Javascript content template for quick rendering * * @since 0.1.0 * @return void */ protected function content_template() { ?><# var device_type = 'phone'; if ( settings.device_type ) { device_type = settings.device_type; } view.addRenderAttribute( { 'device-wrapper' : { 'class' : [ 'ee-device-wrapper', 'ee-device-type-' + device_type, ], }, 'device' : { 'class' : [ 'ee-device', ], }, 'device-orientation' : { 'class' : [ 'ee-device__orientation', 'nicon', 'nicon-mobile-landscape', ], }, 'device-shape' : { 'class' : [ 'ee-device__shape', ], }, 'device-media' : { 'class' : [ 'ee-device__media', ], }, 'device-media-inner' : { 'class' : [ 'ee-device__media__inner', ], }, 'device-media-screen' : { 'class' : [ 'ee-device__media__screen', 'ee-device__media__screen--' + settings.device_media_type, ], }, 'device-media-screen-landscape' : { 'class' : [ 'ee-device__media__screen', 'ee-device__media__screen__landscape', ], }, 'device-media-screen-controls' : { 'class' : [ 'ee-device__media__screen', 'ee-device__media__screen__controls', ], }, 'device-media-screen-inner' : { 'class' : [ 'ee-device__media__screen__inner', ], }, } ); if ( 'yes' === settings.device_orientation_control && 'image' === settings.device_media_type ) { view.addRenderAttribute('device', 'class', 'has--orientation-control'); } function getScreenshotURL( orientation ) { var screen = { id : settings['media_' + orientation + '_screenshot'].id, url : settings['media_' + orientation + '_screenshot'].url, size : settings['media_' + orientation + '_screenshot_size'], dimension : settings['media_' + orientation + '_screenshot_custom_dimension'], model : view.getEditModel(), }; var screen_url = elementor.imagesManager.getImageUrl( screen ); if ( screen_url ) return screen_url; return false; } #><div {{{ view.getRenderAttributeString( 'device-wrapper') }}}> <div {{{ view.getRenderAttributeString( 'device' ) }}}> <# if ( 'yes' === settings.device_orientation_control && 'image' === settings.device_media_type ) { #> <div {{{ view.getRenderAttributeString( 'device-orientation') }}}></div> <# } #> <div {{{ view.getRenderAttributeString( 'device-shape') }}}></div><!-- .ee-device__shape --> <div {{{ view.getRenderAttributeString( 'device-media') }}}> <div {{{ view.getRenderAttributeString( 'device-media-inner') }}}> <div {{{ view.getRenderAttributeString( 'device-media-screen') }}}> <div {{{ view.getRenderAttributeString( 'device-media-screen-inner') }}}> <# if ( 'image' === settings.device_media_type ) { #> <figure><img src="{{{ getScreenshotURL( 'portrait' ) }}}" /></figure> <# } else if ( 'video' === settings.device_media_type ) { #> <?php $this->_video_type_template(); ?> <# } #> </div><!-- .ee-device__media__screen__inner --> </div><!-- .ee-device__media__screen --> <# if ( 'image' === settings.device_media_type && '' !== settings.media_landscape_screenshot.url ) { #> <div {{{ view.getRenderAttributeString( 'device-media-screen-landscape') }}}> <div {{{ view.getRenderAttributeString( 'device-media-screen-inner') }}}> <figure> <figure><img src="{{{ getScreenshotURL( 'landscape' ) }}}" /></figure> </figure> </div><!-- .ee-device__media__screen__inner --> </div><!-- .ee-device__media__screen__landscape --> <# } #> </div><!-- .ee-device__media__inner --> </div><!-- .ee-device__media --> </div><!-- .ee-device --> </div><!-- .ee-device-wrapper --><?php } /** * Video Type Template * * Javascript video type template * * @since 0.1.0 * @return void */ protected function _video_type_template() { ?><# if ( '' !== settings.video_file.url || '' !== settings.video_file_ogg.url || '' !== settings.video_file_webm.url || '' !== settings.video_file_m4v.url || '' !== settings.video_url || '' !== settings.video_url_ogg || '' !== settings.video_url_webm || '' !== settings.video_url_m4v ) { view.addRenderAttribute( { 'video-wrapper' : { 'class' : [ 'ee-video-player', 'ee-player', ], }, } ); #><div {{{ view.getRenderAttributeString( 'video-wrapper' ) }}}> <?php echo $this->_video_template(); ?> <?php echo $this->_cover_template(); ?> <?php echo $this->_controls_template(); ?> </div><!-- .ee-player --> <# } #><?php } /** * Video Template * * Javascript video template * * @since 0.1.0 * @return void */ protected function _video_template() { ?><# view.addRenderAttribute( 'video', { 'class' : [ 'ee-video-player__source', 'ee-player__source' ], 'playsinline' : 'true', 'width' : '100%', 'height' : '100%', } ); if( 'autoplay' === settings.video_autoplay && 'yes' !== settings.video_play_viewport ) { view.addRenderAttribute( 'video', 'autoplay', 'true' ); } if( 'yes' === settings.video_start_muted ) { view.addRenderAttribute( 'video', 'muted', 'true' ); } if ( 'loop' === settings.video_loop ) { view.addRenderAttribute( 'video', 'loop', 'true' ); } if ( settings.video_cover.id ) { var image = { id : settings.video_cover.id, url : settings.video_cover.url, size : settings.image_size, dimension : settings.image_custom_dimension, model : view.getEditModel(), }; view.addRenderAttribute( 'video', 'poster', elementor.imagesManager.getImageUrl( image ) ); } #><video {{{ view.getRenderAttributeString( 'video' ) }}}><# var video_url = ( 'file' === settings.video_source ) ? settings.video_file.url : settings.video_url, video_url_m4v = ( 'file' === settings.video_source_m4v ) ? settings.video_file_m4v.url : settings.video_url_m4v, video_url_ogg = ( 'file' === settings.video_source_ogg ) ? settings.video_file_ogg.url : settings.video_url_ogg, video_url_webm = ( 'file' === settings.video_source_webm ) ? settings.video_file_webm.url : settings.video_url_webm; if ( video_url ) { view.addRenderAttribute( 'source-mp4', { 'src' : video_url, 'type' : 'video/mp4', } ); #><source {{{ view.getRenderAttributeString( 'source-mp4' ) }}}><# } #> <# if ( video_url_m4v ) { view.addRenderAttribute( 'source-m4v', { 'src' : video_url_m4v, 'type' : 'video/m4v', } ); #><source {{{ view.getRenderAttributeString( 'source-m4v' ) }}}><# } #> <# if ( video_url_ogg ) { view.addRenderAttribute( 'source-ogg', { 'src' : video_url_ogg, 'type' : 'video/ogg', } ); #><source {{{ view.getRenderAttributeString( 'source-ogg' ) }}}><# } #> <# if ( video_url_webm ) { view.addRenderAttribute( 'source-webm', { 'src' : video_url_webm, 'type' : 'video/webm', } ); #><source {{{ view.getRenderAttributeString( 'source-webm' ) }}}><# } #> </video> <?php } /** * Controls Template * * Javascript controls template * * @since 0.1.0 * @return void */ protected function _controls_template() { ?><# view.addRenderAttribute({ 'controls' : { 'class' : [ 'ee-video-player__controls', 'ee-player__controls', ], }, 'bar-wrapper' : { 'class' : [ 'ee-player__controls__bar-wrapper', 'ee-video-player__controls__bar-wrapper', ], }, 'bar' : { 'class' : [ 'ee-player__controls__bar', ], }, 'control-play' : { 'class' : [ 'ee-player__control', 'ee-player__controls__play', 'ee-player__control--icon', 'nicon', 'nicon-play', ], }, }); #><div {{{ view.getRenderAttributeString( 'controls' ) }}}> <?php $this->_overlay_template(); ?> <# if ( 'show' === settings.video_show_bar ) { #> <div {{{ view.getRenderAttributeString( 'bar-wrapper' ) }}}> <div {{{ view.getRenderAttributeString( 'bar' ) }}}> <# if ( 'yes' !== settings.video_restart_on_pause && 'show' === settings.video_show_rewind ) { view.addRenderAttribute( 'control-rewind', { 'class' : [ 'ee-player__control', 'ee-player__controls__rewind', 'ee-player__control--icon', 'nicon', 'nicon-rewind', ], } ); #><div {{{ view.getRenderAttributeString( 'control-rewind' ) }}}></div><# } #> <div {{{ view.getRenderAttributeString( 'control-play' ) }}}></div> <# if ( settings.video_show_time ) { view.addRenderAttribute( 'control-time', { 'class' : [ 'ee-player__control', 'ee-player__control--indicator', 'ee-player__controls__time', ], } ); #><div {{{ view.getRenderAttributeString( 'control-time' ) }}}>00:00</div><# } #> <# if ( settings.video_show_progress ) { view.addRenderAttribute( { 'control-progress' : { 'class' : [ 'ee-player__control', 'ee-player__controls__progress', 'ee-player__control--progress', ], }, 'control-progress-time' : { 'class' : [ 'ee-player__controls__progress-time', 'ee-player__control--progress__inner', ], }, 'control-progress-track' : { 'class' : [ 'ee-player__control--progress__inner', 'ee-player__control--progress__track', ], }, } ); #><div {{{ view.getRenderAttributeString( 'control-progress' ) }}}> <div {{{ view.getRenderAttributeString( 'control-progress-time' ) }}}></div> <div {{{ view.getRenderAttributeString( 'control-progress-track' ) }}}></div> </div><# } #> <# if ( settings.video_show_duration ) { view.addRenderAttribute( 'control-duration', { 'class' : [ 'ee-player__control', 'ee-player__controls__duration', 'ee-player__control--indicator', ], } ); #><div {{{ view.getRenderAttributeString( 'control-duration' ) }}}>00:00</div><# } #> <# if ( settings.video_show_volume ) { view.addRenderAttribute( 'control-volume', { 'class' : [ 'ee-player__control', 'ee-player__controls__volume', ], } ); #><div {{{ view.getRenderAttributeString( 'control-volume' ) }}}> <# if ( settings.video_show_volume_icon ) { view.addRenderAttribute( 'control-volume-icon', { 'class' : [ 'ee-player__controls__volume-icon', 'ee-player__control--icon', 'nicon', 'nicon-volume', ], } ); #><div {{{ view.getRenderAttributeString( 'control-volume-icon' ) }}}></div><# } #> <# if ( settings.video_show_volume_bar ) { view.addRenderAttribute( { 'control-volume-bar' : { 'class' : [ 'ee-player__control', 'ee-player__controls__volume-bar', 'ee-player__control--progress', ], }, 'control-volume-bar-amount' : { 'class' : [ 'ee-player__controls__volume-bar__amount', 'ee-player__control--progress__inner', ], }, 'control-volume-bar-track' : { 'class' : [ 'ee-player__controls__volume-bar__track', 'ee-player__control--progress__inner', 'ee-player__control--progress__track', ], }, } ); #><div {{{ view.getRenderAttributeString( 'control-volume-bar' ) }}}> <div {{{ view.getRenderAttributeString( 'control-volume-bar-amount' ) }}}></div> <div {{{ view.getRenderAttributeString( 'control-volume-bar-track' ) }}}></div> </div><# } #> </div><# } #> </div><!-- .ee-player__controls__bar --> </div><!-- .ee-player__controls__bar-wrapper --> <# } #> </div><!-- .ee-player__controls --> <?php } /** * Cover Template * * Javascript cover template * * @since 0.1.0 * @return void */ protected function _cover_template() { ?><# view.addRenderAttribute( 'video-cover', { 'class' : [ 'ee-video-player__cover', 'ee-player__cover', ], } ); #><div {{{ view.getRenderAttributeString( 'video-cover' ) }}}></div><?php } /** * Overlay Template * * Javascript overlay template * * @since 0.1.0 * @return void */ protected function _overlay_template() { ?><# if ( 'show' === settings.video_show_buttons ) { view.addRenderAttribute( { 'overlay' : { 'class' : [ 'ee-player__controls__overlay', 'ee-video-player__overlay', ], }, 'overlay-play' : { 'class' : [ 'ee-player__control', 'ee-player__controls__play', 'nicon', 'nicon-play', ], }, } ); #><ul {{{ view.getRenderAttributeString( 'overlay' ) }}}><# if ( 'yes' !== settings.video_restart_on_pause && 'show' === settings.video_show_rewind ) { view.addRenderAttribute( 'overlay-rewind', { 'class' : [ 'ee-player__control', 'ee-player__controls__rewind', 'nicon', 'nicon-rewind', ], } ) #><li {{{ view.getRenderAttributeString( 'overlay-rewind' ) }}}></li><# } #><li {{{ view.getRenderAttributeString( 'overlay-play' ) }}}></li> </ul> <# } #><?php } } devices/module.php 0000644 00000001130 15112147616 0010163 0 ustar 00 <?php namespace ElementorExtras\Modules\Devices; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Buttons\Module * * @since 1.6.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.6.0 * @return string */ public function get_name() { return 'devices'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.6.0 * @return array */ public function get_widgets() { return [ 'Devices', ]; } } display-conditions/conditions/acf-base.php 0000644 00000007656 15112147616 0014725 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; use ElementorExtras\Utils; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Acf_Base * * @since 2.2.0 */ class Acf_Base extends Condition { protected $query_options_defaults = [ 'show_type' => false, 'show_field_type' => true, 'include_option' => true, 'show_group' => true, ]; public function get_name_control_options() { return [ 'type' => 'ee-query', 'post_type' => '', 'options' => [], 'query_type' => 'acf', 'label_block' => true, 'multiple' => false, 'query_options' => $this->get_query_options(), ]; } public function get_query_options() { return wp_parse_args( $this->get_additional_query_options(), $this->query_options_defaults ); } /** * Additional query control options * * @since 2.2.33 * @return bool */ protected function get_additional_query_options() { return []; } /** * Checks if current condition is supported * * @since 2.2.0 * @return bool */ public static function is_supported() { return class_exists( '\acf' ); } /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'acf'; } /** * Get Field Post * * Retrieve the ACF field post object by id * * @since 2.2.0 * @return string */ public function get_field_post( $post_id ) { global $post; $field_post = get_posts( [ 'post__in' => [ $post_id ], 'post_type' => 'acf-field', 'post_status' => 'publish', 'numberposts' => 1, ] ); if ( $field_post[0] ) { return $field_post; } return false; } /** * Get Condition Data for Field * * Returns either a name + key pair or either of the two * * @since 2.2.0 * @param $key string The saved condition value. Either 'field_xxxxx' or 'option:field_xxxxx' or 'field_name:field_xxxx' * @param $part bool Used to return only name or key. False for both. * * @return string */ protected function get_condition_data( $key, $part = false ) { if ( ! $key ) { return false; } if ( false === strpos( $key, ':' ) ) { // Fallback for 2.2.32 $field_name = false; $field_key = $key; } else { list( $field_name, $field_key ) = explode( ':', $key ); } switch ( $part ) { case 'name': return $field_name; break; case 'key': return $field_key; break; default: return [ $field_name, $field_key ]; break; } } /** * Wrapper for ACF's get_field * * Parses the saved condition value and returns the ACF field value * * @since 2.2.0 * @param $key string The saved condition value * * @return string */ protected function get_field( $key, $post_id = false, $format_value = true ) { if ( ! $key ) { return false; } $condition_data = $this->get_condition_data( $key ); if ( ! $condition_data ) { return; } $field_name = $condition_data[0]; $field_key = $condition_data[1]; $options_ids = Utils::get_acf_options_pages_ids(); $field_object = get_field_object( $field_key ); if ( 'option' == $field_name && in_array( $field_object['parent'], $options_ids ) ) { $post_id = 'option'; } return get_field( $field_key, $post_id, $format_value ); } /** * Wrapper for ACF's get_field_object * * @since 2.2.0 * @param $key string The saved condition value * * @return string */ protected function get_field_object( $key ) { list( $field_name, $field_key ) = $this->get_condition_data( $key ); return get_field_object( $field_key, $field_name ); } /** * Get Name Control Defaults * * Get the settings for the name control * * @since 2.2.0 * @return array */ public function get_name_control_defaults() { return ; } } display-conditions/conditions/acf-choice.php 0000644 00000010771 15112147616 0015235 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Acf_Choice * * @since 2.2.0 */ class Acf_Choice extends Acf_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'acf_choice'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'ACF Choice', 'elementor-extras' ); } /** * Get Name Control * * Get the settings for the name control * * @since 2.2.0 * @return array */ public function get_name_control() { return wp_parse_args( [ 'description' => __( 'Search ACF "Select", "Checkbox" and "Radio" fields by label.', 'elementor-extras' ), 'placeholder' => __( 'Search Fields', 'elementor-extras' ), ], $this->get_name_control_options() ); } /** * Additional query control options * * @since 2.2.33 * @return bool */ public function get_additional_query_options() { return [ 'field_type' => [ 'option', ], ]; } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return array */ public function get_value_control() { return [ 'type' => Controls_Manager::TEXTAREA, 'default' => '', 'placeholder' => __( 'Choices', 'elementor-extras' ), 'description' => __( 'Enter each accepted choice on a separate line. You can specify the value ( red ) or both value and label ( red : Red ). Leave blank to check if the field is set.', 'elementor-extras' ), 'label_block' => true, ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $key, $operator, $values ) { $show = false; $field_value = $this->get_field( $key ); if ( $field_value ) { if ( ! $values || '' === trim( $values ) || empty( $values ) ) { return $this->compare( true, true, $operator ); } $field_settings = $this->get_field_object( $key ); $field_choices = $field_settings['choices']; $is_array_format = 'array' === $field_settings['return_format']; $is_radio = 'radio' === $field_settings['type']; $field_values = $this->acf_choice_parse_format( $field_value, $is_array_format, $is_radio ); $check_values = acf_decode_choices( $values ); $check_by_key = array_intersect_key( $field_values, $check_values ); $check_by_value = array_intersect( $field_values, $check_values ); $show = $check_by_key || $check_by_value || $this->acf_label_exists_as_value( $field_values, $field_choices, $check_values ); } return $this->compare( $show, true, $operator ); } /** * Label Exists As Value * * Performs a cross check to see if a label is set as a condition * and matched a field label even though the return format is set * as Value. * * @since 2.2.0 * * @access public * @param array $field_values The values saved for the field * @param array $field_choices All the available choices for the field * @param array $check_values The condition values enters in Elementor * @return bool */ protected function acf_label_exists_as_value( $field_values, $field_choices, $check_values ) { foreach( $check_values as $index => $selected_value ) { if ( in_array( $index, $field_choices ) ) { $field_choice_key = array_search( $index, $field_choices ); if ( in_array( $field_choice_key, $field_values ) ) { return true; } } } return false; } /** * Parse array format * * @since 2.2.0 * * @access public * @param array $values The array to parse * @param bool $array If the return format is array * @return array */ protected function acf_choice_parse_format( $values, $return_array = true, $radio = false ) { $return = []; if ( $radio ) { if ( $return_array ) { $return[ $values['value'] ] = $values['label']; } else { $return[ $values ] = $values; } } else { foreach( $values as $index => $value ) { if ( $return_array ) { $return[ $value['value'] ] = $value['label']; } else { $return[ $value ] = $value; } } } return $return; } } display-conditions/conditions/acf-date-time.php 0000644 00000006145 15112147616 0015654 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Acf_Date_Time * * @since 2.2.0 */ class Acf_Date_Time extends Acf_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'acf_date_time'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'ACF Date / Time', 'elementor-extras' ); } /** * Get Name Control * * Get the settings for the name control * * @since 2.2.0 * @return array */ public function get_name_control() { return wp_parse_args( [ 'description' => __( 'Search ACF "Date" and "Date Time" fields by label.', 'elementor-extras' ), 'placeholder' => __( 'Search Fields', 'elementor-extras' ), ], $this->get_name_control_options() ); } /** * Additional query control options * * @since 2.2.33 * @return bool */ public function get_additional_query_options() { return [ 'field_type' => [ 'date', ], ]; } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return array */ public function get_value_control() { $default_date_start = date( 'Y-m-d', strtotime( '-3 day' ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ); return [ 'label' => __( 'Before', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::DATE_TIME, 'picker_options' => [ 'enableTime' => true, ], 'label_block' => true, 'default' => $default_date_start, ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $key, $operator, $value ) { $show = false; global $post; $field_settings = $this->get_field_object( $key ); if ( $field_settings ) { $field_format = $field_settings['return_format']; $field_db_value = $this->get_field( $key, false, false ); // ACF saves values in these formats in the database // We use the db values to bypass days and months translations // not supported by PHP's DateTime $field_db_format = 'date_time_picker' === $field_settings['type'] ? 'Y-m-d H:i:s' : 'Ymd'; // Create date based on saved format $date = \DateTime::createFromFormat( $field_db_format, $field_db_value ); // Make sure it's a valid date if ( ! $date ) { return; } // Convert to timestamps $field_value_ts = strtotime( $date->format( $field_format ) ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ); $value_ts = strtotime( $value ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ); // Set display condition $show = $field_value_ts < $value_ts; } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/acf-post.php 0000644 00000006346 15112147616 0014773 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Acf_Post * * @since 2.2.0 */ class Acf_Post extends Acf_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'acf_post'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'ACF Post', 'elementor-extras' ); } /** * Get Name Control * * Get the settings for the name control * * @since 2.2.0 * @return array */ public function get_name_control() { return wp_parse_args( [ 'description' => __( 'Search ACF "Post Object" and "Relationship" fields by label.', 'elementor-extras' ), 'placeholder' => __( 'Search Fields', 'elementor-extras' ), ], $this->get_name_control_options() ); } /** * Additional query control options * * @since 2.2.33 * @return bool */ public function get_additional_query_options() { return [ 'field_type' => [ 'post', ], ]; } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return array */ public function get_value_control() { return [ 'type' => 'ee-query', 'default' => '', 'placeholder' => __( 'Search Posts', 'elementor-extras' ), 'description' => __( 'Select multiple posts to match for any of them. Leave blank to check if the field is set.', 'elementor-extras' ), 'label_block' => true, 'multiple' => true, 'query_type' => 'posts', 'object_type' => 'any', ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $key, $operator, $values ) { $show = false; $field_value = $this->get_field( $key ); if ( $field_value ) { if ( ! $values || '' === $values || empty( $values ) ) { return $this->compare( true, true, $operator ); } $values = (array)$values; $field_post_ids = $this->parse_field_values( $field_value ); $value_post_ids = array_map('intval', $values ); $show = ! empty( array_intersect( $field_post_ids, $value_post_ids ) ); } return $this->compare( $show, true, $operator ); } /** * Parse field values * * Depending on the type of field and return formats * this function returns an array with the post IDs set in * the field settings * * @since 2.2.0 * * @access public * * @param string $posts The posts saved in the field * @return array $return_values The array of post IDs */ public function parse_field_values( $posts ) { $return_values = []; if ( is_array( $posts ) ) { foreach ( $posts as $post ) { $return_values[] = ( is_a( $post, 'WP_Post' ) ) ? $post->ID : $post; } } else { $return_values[] = ( is_a( $posts, 'WP_Post' ) ) ? $posts->ID : $posts; } return $return_values; } } display-conditions/conditions/acf-taxonomy.php 0000644 00000006321 15112147616 0015655 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Acf_Taxonomy * * @since 2.2.0 */ class Acf_Taxonomy extends Acf_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'acf_taxonomy'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'ACF Taxonomy', 'elementor-extras' ); } /** * Get Name Control * * Get the settings for the name control * * @since 2.2.0 * @return array */ public function get_name_control() { return wp_parse_args( [ 'description' => __( 'Search ACF "Taxonomy" fields by label.', 'elementor-extras' ), 'placeholder' => __( 'Search Fields', 'elementor-extras' ), ], $this->get_name_control_options() ); } /** * Additional query control options * * @since 2.2.33 * @return bool */ public function get_additional_query_options() { return [ 'field_type' => [ 'taxonomy', ], ]; } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return array */ public function get_value_control() { return [ 'description' => __( 'Leave blank for any term.', 'elementor-extras' ), 'placeholder' => __( 'Search Terms', 'elementor-extras' ), 'type' => 'ee-query', 'post_type' => '', 'options' => [], 'label_block' => true, 'multiple' => true, 'query_type' => 'terms', 'include_type' => true, ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $key, $operator, $values ) { $show = false; $field_value = $this->get_field( $key ); if ( $field_value ) { if ( ! $values || '' === $values || empty( $values ) ) { return $this->compare( true, true, $operator ); } $values = (array)$values; $field_term_ids = $this->parse_field_values( $field_value ); $value_term_ids = array_map('intval', $values ); $show = ! empty( array_intersect( $field_term_ids, $value_term_ids ) ); } return $this->compare( $show, true, $operator ); } /** * Parse field values * * Depending on the return formats and number of field values * this function returns an array with the term IDs set in * the field settings * * @since 2.2.0 * * @access public * * @param string $posts The posts saved in the field * @return array $return_values The array of post IDs */ public function parse_field_values( $terms ) { $return_values = []; if ( is_array( $terms ) ) { foreach ( $terms as $term ) { $return_values[] = ( is_a( $term, 'WP_Term' ) ) ? $term->term_id : $term; } } else { $return_values[] = ( is_a( $terms, 'WP_Term' ) ) ? $terms->term_id : $terms; } return $return_values; } } display-conditions/conditions/acf-text.php 0000644 00000004560 15112147616 0014766 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Acf_Text * * @since 2.2.0 */ class Acf_Text extends Acf_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'acf_text'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'ACF Textual', 'elementor-extras' ); } /** * Get Name Control * * Get the settings for the name control * * @since 2.2.0 * @return array */ public function get_name_control() { return wp_parse_args( [ 'description' => __( 'Search ACF Textual ( text, textarea, wysiwyg, number, range, email, url and password ) fields by label. Leave blank to check if the field is set.', 'elementor-extras' ), 'placeholder' => __( 'Search Fields', 'elementor-extras' ), ], $this->get_name_control_options() ); } /** * Additional query control options * * @since 2.2.33 * @return bool */ public function get_additional_query_options() { return [ 'field_type' => [ 'textual', ], ]; } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return array */ public function get_value_control() { return [ 'type' => Controls_Manager::TEXT, 'default' => '', 'placeholder' => __( 'Value', 'elementor-extras' ), 'label_block' => true, ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $key, $operator, $value ) { $show = false; $field_value = $this->get_field( $key ); if ( $field_value ) { if ( '' === trim( $value ) ) { return $this->compare( true, true, $operator ); } $field_settings = $this->get_field_object( $key ); switch ( $field_settings['type'] ) { default: $show = $value === $field_value; break; } } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/acf-true-false.php 0000644 00000004401 15112147616 0016043 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Acf_True_False * * @since 2.2.0 */ class Acf_True_False extends Acf_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'acf_true_false'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'ACF True / False', 'elementor-extras' ); } /** * Get Name Control * * Get the settings for the name control * * @since 2.2.0 * @return array */ public function get_name_control() { return wp_parse_args( [ 'description' => __( 'Search ACF True / False field by label.', 'elementor-extras' ), 'placeholder' => __( 'Search Fields', 'elementor-extras' ), ], $this->get_name_control_options() ); } /** * Additional query control options * * @since 2.2.33 * @return bool */ public function get_additional_query_options() { return [ 'field_type' => [ 'boolean', ], 'show_field_type' => false, ]; } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => Controls_Manager::SELECT, 'default' => 'true', 'label_block' => true, 'options' => [ 'true' => __( 'True', 'elementor-extras' ), 'false' => __( 'False', 'elementor-extras' ), ], ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $key, $operator, $value ) { $show = false; // Handle string value for correct comparison $value = 'true' === $value ? true : false; global $post; // Compare setting with value $show = $value === $this->get_field( $key ); return $this->compare( $show, true, $operator ); } } display-conditions/conditions/authentication.php 0000644 00000003144 15112147616 0016267 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Authentication * * @since 2.2.0 */ class Authentication extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'visitor'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'authentication'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Login Status', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => Controls_Manager::SELECT, 'default' => 'authenticated', 'label_block' => true, 'options' => [ 'authenticated' => __( 'Logged in', 'elementor-extras' ), ], ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { return $this->compare( is_user_logged_in(), true, $operator ); } } display-conditions/conditions/author-archive.php 0000644 00000003571 15112147616 0016175 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Author_Archive * * @since 2.2.0 */ class Author_Archive extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'archive'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'author_archive'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Author', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => 'ee-query', 'default' => '', 'placeholder' => __( 'Any', 'elementor-extras' ), 'description' => __( 'Leave blank for all authors.', 'elementor-extras' ), 'multiple' => true, 'label_block' => true, 'query_type' => 'authors', ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $show = false; if ( is_array( $value ) && ! empty( $value ) ) { foreach ( $value as $_key => $_value ) { if ( is_author( $_value ) ) { $show = true; break; } } } else { $show = is_author( $value ); } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/browser.php 0000644 00000004675 15112147616 0014745 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Browser * * @since 2.2.0 */ class Browser extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'visitor'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'browser'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Browser', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => Controls_Manager::SELECT, 'default' => 'ie', 'label_block' => true, 'options' => [ 'ie' => 'Internet Explorer', 'firefox' => 'Mozilla Firefox', 'chrome' => 'Google Chrome', 'opera_mini' => 'Opera Mini', 'opera' => 'Opera', 'safari' => 'Safari', ], ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $browsers = [ 'ie' => [ 'MSIE', 'Trident', ], 'firefox' => 'Firefox', 'chrome' => 'Chrome', 'opera_mini' => 'Opera Mini', 'opera' => 'Opera', 'safari' => 'Safari', ]; $show = false; if ( 'ie' === $value ) { if ( false !== strpos( $_SERVER['HTTP_USER_AGENT'], $browsers[ $value ][0] ) || false !== strpos( $_SERVER['HTTP_USER_AGENT'], $browsers[ $value ][1] ) ) { $show = true; } } else { if ( false !== strpos( $_SERVER['HTTP_USER_AGENT'], $browsers[ $value ] ) ) { $show = true; // Additional check for Chrome that returns Safari if ( 'safari' === $value || 'firefox' === $value ) { if ( false !== strpos( $_SERVER['HTTP_USER_AGENT'], 'Chrome' ) ) { $show = false; } } } } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/date-archive.php 0000644 00000005002 15112147616 0015577 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Date_Archive * * @since 2.2.0 */ class Date_Archive extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'archive'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'date_archive'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Date', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => Controls_Manager::SELECT2, 'default' => '', 'placeholder' => __( 'Any', 'elementor-extras' ), 'description' => __( 'Leave blank or select all for any date based archive.', 'elementor-extras' ), 'multiple' => true, 'label_block' => true, 'options' => [ 'day' => __( 'Day', 'elementor-extras' ), 'month' => __( 'Month', 'elementor-extras' ), 'year' => __( 'Year', 'elementor-extras' ), ], ]; } /** * Checks a given date type against the current page template * * @since 2.2.0 * * @access protected * * @param string $type The type of date archive to check against */ protected function check_date_archive_type( $type ) { if ( 'day' === $type ) { // Day return is_day(); } elseif ( 'month' === $type ) { // Month return is_month(); } elseif ( 'year' === $type ) { // Year return is_year(); } return false; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $show = false; if ( is_array( $value ) && ! empty( $value ) ) { foreach ( $value as $_key => $_value ) { if ( $this->check_date_archive_type( $_value ) ) { $show = true; break; } } } else { $show = is_date( $value ); } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/date-time-before.php 0000644 00000004465 15112147616 0016370 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Date_Before * * @since 2.2.0 */ class Date_Time_Before extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'date_time'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'date_time_before'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Current Date & Time', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { $default_date = date( 'Y-m-d H:i', strtotime( '+3 day' ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ); return [ 'label' => __( 'Before', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::DATE_TIME, 'picker_options' => [ 'enableTime' => true, ], 'label_block' => true, 'default' => $default_date, ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { // Default returned bool to false $show = false; $today = new \DateTime(); $date = \DateTime::createFromFormat( 'Y-m-d H:i', $value ); // Check vars if ( ! $date ) // Make sure it's a date return; if ( function_exists( 'wp_timezone' ) ) { $timezone = wp_timezone(); // Set timezone $today->setTimeZone( $timezone ); } // Get tijmestamps for comparison $date_ts = $date->format("U"); $today_ts = $today->format("U") + $today->getOffset(); // Adding the offset // Check that today is before specified date $show = $today_ts < $date_ts; return $this->compare( $show, true, $operator ); } } display-conditions/conditions/date.php 0000644 00000005645 15112147616 0014175 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Date * * @since 2.2.0 */ class Date extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'date_time'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'date'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Current Date', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { $default_date_start = date( 'Y-m-d', strtotime( '-3 day' ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ); $default_date_end = date( 'Y-m-d', strtotime( '+3 day' ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ); $default_interval = $default_date_start . ' to ' . $default_date_end; return [ 'label' => __( 'In interval', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::DATE_TIME, 'picker_options' => [ 'enableTime' => false, 'mode' => 'range', ], 'label_block' => true, 'default' => $default_interval, ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { // Split control valur into two dates $intervals = explode( 'to' , preg_replace('/\s+/', '', $value ) ); // Make sure the explode return an array with exactly 2 indexes if ( ! is_array( $intervals ) || 2 !== count( $intervals ) ) return; // Set start and end dates $today = new \DateTime(); $start = \DateTime::createFromFormat( 'Y-m-d', $intervals[0] ); $end = \DateTime::createFromFormat( 'Y-m-d', $intervals[1] ); // Check vars if ( ! $start || ! $end ) // Make sure it's a date return; if ( function_exists( 'wp_timezone' ) ) { $timezone = wp_timezone(); // Set timezone $today->setTimeZone( $timezone ); } // Default returned bool to false $show = false; // Get tijmestamps for comparison $start_ts = $start->format("U"); $end_ts = $end->format("U"); $today_ts = $today->format("U") + $today->getOffset(); // Adding the offset // Check that user date is between start & end $show = ( ($today_ts >= $start_ts ) && ( $today_ts <= $end_ts ) ); return $this->compare( $show, true, $operator ); } } display-conditions/conditions/day.php 0000644 00000004324 15112147616 0014026 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Day * * @since 2.2.6 */ class Day extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.6 * @return string */ public function get_group() { return 'date_time'; } /** * Get Name * * Get the name of the module * * @since 2.2.6 * @return string */ public function get_name() { return 'day'; } /** * Get Title * * Get the title of the module * * @since 2.2.6 * @return string */ public function get_title() { return __( 'Day of Week', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.6 * @return string */ public function get_value_control() { return [ 'type' => Controls_Manager::SELECT2, 'multiple' => true, 'options' => [ '1' => __( 'Monday', 'elementor-extras' ), '2' => __( 'Tuesday', 'elementor-extras' ), '3' => __( 'Wednesday', 'elementor-extras' ), '4' => __( 'Thursday', 'elementor-extras' ), '5' => __( 'Friday', 'elementor-extras' ), '6' => __( 'Saturday', 'elementor-extras' ), '0' => __( 'Sunday', 'elementor-extras' ), ], 'label_block' => true, 'default' => '1', ]; } /** * Check day of week * * Checks wether today falls inside a * specified day of the week * * @since 2.2.6 * * @access protected * * @param string $name The control name to check * @param mixed $value The control value to check * @param string $operator Comparison operator. */ public function check( $name, $operator, $value ) { $show = false; $today = new \DateTime(); if ( function_exists( 'wp_timezone' ) ) { $timezone = wp_timezone(); // Set timezone $today->setTimeZone( $timezone ); } $day = $today->format('w'); $show = is_array( $value ) && ! empty( $value ) ? in_array( $day, $value ) : $value === $day; return self::compare( $show, true, $operator ); } } display-conditions/conditions/edd-cart.php 0000644 00000003531 15112147616 0014733 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Edd_Cart * * @since 2.2.0 */ class Edd_Cart extends Condition { /** * Checks if current condition is supported * * @since 2.2.0 * @return string */ public static function is_supported() { return class_exists( 'Easy_Digital_Downloads', false ); } /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'edd'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'edd_cart'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Cart', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return array */ public function get_value_control() { return [ 'type' => Controls_Manager::SELECT, 'default' => 'empty', 'label_block' => true, 'options' => [ 'empty' => __( 'Empty', 'elementor-extras' ), ], ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name, $operator, $value ) { if ( ! function_exists( 'edd_get_cart_contents' ) ) return false; $show = empty( edd_get_cart_contents() ); return $this->compare( $show, true, $operator ); } } display-conditions/conditions/os.php 0000644 00000005145 15112147616 0013674 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Os * * @since 2.2.0 */ class Os extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'visitor'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'os'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Operating System', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => Controls_Manager::SELECT, 'default' => 'iphone', 'label_block' => true, 'options' => [ 'iphone' => 'iPhone', 'windows' => 'Windows', 'open_bsd' => 'OpenBSD', 'sun_os' => 'SunOS', 'linux' => 'Linux', 'safari' => 'Safari', 'mac_os' => 'Mac OS', 'qnx' => 'QNX', 'beos' => 'BeOS', 'os2' => 'OS/2', 'search_bot' => 'Search Bot', ], ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $oses = [ 'iphone' => '(iPhone)', 'windows' => 'Win16|(Windows 95)|(Win95)|(Windows_95)|(Windows 98)|(Win98)|(Windows NT 5.0)|(Windows 2000)|(Windows NT 5.1)|(Windows XP)|(Windows NT 5.2)|(Windows NT 6.0)|(Windows Vista)|(Windows NT 6.1)|(Windows 7)|(Windows NT 4.0)|(WinNT4.0)|(WinNT)|(Windows NT)|Windows ME', 'open_bsd' => 'OpenBSD', 'sun_os' => 'SunOS', 'linux' => '(Linux)|(X11)', 'safari' => '(Safari)', 'mac_os' => '(Mac_PowerPC)|(Macintosh)', 'qnx' => 'QNX', 'beos' => 'BeOS', 'os2' => 'OS/2', 'search_bot' => '(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp/cat)|(msnbot)|(ia_archiver)', ]; return $this->compare( preg_match('@' . $oses[ $value ] . '@', $_SERVER['HTTP_USER_AGENT'] ), true, $operator ); } } display-conditions/conditions/page.php 0000644 00000003553 15112147616 0014170 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Page * * @since 2.2.0 */ class Page extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'single'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'page'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Page', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => 'ee-query', 'default' => '', 'placeholder' => __( 'Any', 'elementor-extras' ), 'description' => __( 'Leave blank for any page.', 'elementor-extras' ), 'label_block' => true, 'multiple' => true, 'query_type' => 'posts', 'object_type' => 'page', ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $show = false; if ( is_array( $value ) && ! empty( $value ) ) { foreach ( $value as $_key => $_value ) { if ( is_page( $_value ) ) { $show = true; break; } } } else { $show = is_page( $value ); } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/post-meta.php 0000644 00000004613 15112147616 0015163 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Condition * * @since 2.2.27 */ class Post_Meta extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.27 * @return string */ public function get_group() { return 'single'; } /** * Get Name * * Get the name of the module * * @since 2.2.27 * @return string */ public function get_name() { return 'post_meta'; } /** * Get Title * * Get the title of the module * * @since 2.2.27 * @return string */ public function get_title() { return __( 'Post Meta', 'elementor-extras' ); } /** * Get Name Control * * Get the settings for the name control * * @since 2.2.27 * @return array */ public function get_name_control() { return [ 'type' => Controls_Manager::TEXT, 'default' => '', 'placeholder' => __('meta_key', 'elementor-extras'), 'label_block' => true, ]; } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.27 * @return array */ public function get_value_control() { return [ 'type' => Controls_Manager::TEXT, 'default' => '', 'placeholder' => __('meta_value', 'elementor-extras'), 'description' => __('Leave empty to check if the current post has any meta value for the selected key.', 'elementor-extras'), 'label_block' => true, ]; } /** * Check condition * * @since 2.2.27 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $key, $operator, $value ) { $show = false; if ( $key ) { $meta_values = get_post_meta( get_the_ID(), $key ); // Returns false if no matching meta key is set if ( ( ! $value || '' === trim( $value ) || empty( $value ) ) && $meta_values ) { return $this->compare( true, true, $operator ); } foreach ( $meta_values as $meta_value ) { if ( $value === $meta_value ) { $show = true; break; } } } else { $show = true; } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/post-term.php 0000644 00000003704 15112147616 0015204 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Condition * * @since 2.2.39 */ class Post_Term extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.39 * @return string */ public function get_group() { return 'single'; } /** * Get Name * * Get the name of the module * * @since 2.2.39 * @return string */ public function get_name() { return 'post_term'; } /** * Get Title * * Get the title of the module * * @since 2.2.39 * @return string */ public function get_title() { return __( 'Post Term', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.39 * @return string */ public function get_value_control() { return [ 'description' => __( 'Leave blank or select all for any term.', 'elementor-extras' ), 'type' => 'ee-query', 'post_type' => '', 'options' => [], 'label_block' => true, 'multiple' => true, 'query_type' => 'terms', 'include_type' => true, ]; } /** * Check condition * * @since 2.2.39 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $value = (array) $value; if ( ! $value || empty( $value ) ) { return $this->compare( true, true, $operator ); } $show = false; foreach ( $value as $term_id ) { $term = get_term( $term_id ); if ( has_term( $term->name, $term->taxonomy ) ) { $show = true; break; } } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/post-type-archive.php 0000644 00000003761 15112147616 0016640 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Post_Type_Archive * * @since 2.2.0 */ class Post_Type_Archive extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'archive'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'post_type_archive'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Post Type', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => Controls_Manager::SELECT2, 'default' => '', 'placeholder' => __( 'Any', 'elementor-extras' ), 'description' => __( 'Leave blank or select all for any post type.', 'elementor-extras' ), 'multiple' => true, 'label_block' => true, 'options' => Utils::get_public_post_types_options(), ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $show = false; if ( is_array( $value ) && ! empty( $value ) ) { foreach ( $value as $_key => $_value ) { if ( is_post_type_archive( $_value ) ) { $show = true; break; } } } else { $show = is_post_type_archive( $value ); } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/post-type.php 0000644 00000003714 15112147616 0015217 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Post_Type * * @since 2.2.0 */ class Post_Type extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'single'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'post_type'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Post Type', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => Controls_Manager::SELECT2, 'default' => '', 'placeholder' => __( 'Any', 'elementor-extras' ), 'description' => __( 'Leave blank or select all for any post type.', 'elementor-extras' ), 'label_block' => true, 'multiple' => true, 'options' => Utils::get_public_post_types_options( true ), ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $show = false; if ( is_array( $value ) && ! empty( $value ) ) { foreach ( $value as $_key => $_value ) { if ( is_singular( $_value ) ) { $show = true; break; } } } else { $show = is_singular( $value ); } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/post.php 0000644 00000003642 15112147616 0014240 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Post * * @since 2.2.0 */ class Post extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'single'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'post'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Post', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => 'ee-query', 'default' => '', 'placeholder' => __( 'Any', 'elementor-extras' ), 'description' => __( 'Leave blank for any post.', 'elementor-extras' ), 'label_block' => true, 'multiple' => true, 'query_type' => 'posts', 'object_type' => 'post', ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $show = false; if ( is_array( $value ) && ! empty( $value ) ) { foreach ( $value as $_key => $_value ) { if ( is_single( $_value ) || is_singular( $_value ) ) { $show = true; break; } } } else { $show = is_single( $value ) || is_singular( $value ); } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/role.php 0000644 00000003332 15112147616 0014210 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Role * * @since 2.2.0 */ class Role extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'visitor'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'role'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'User Role', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { global $wp_roles; return [ 'type' => Controls_Manager::SELECT, 'description' => __( 'Warning: This condition applies only to logged in visitors.', 'elementor-extras' ), 'default' => 'subscriber', 'label_block' => true, 'options' => $wp_roles->get_names(), ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $user = wp_get_current_user(); return $this->compare( is_user_logged_in() && in_array( $value, $user->roles ), true, $operator ); } } display-conditions/conditions/search-results.php 0000644 00000005054 15112147616 0016216 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Search_Results * * @since 2.2.0 */ class Search_Results extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'archive'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'search_results'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Search', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => Controls_Manager::TEXT, 'default' => '', 'placeholder' => __( 'Keywords', 'elementor-extras' ), 'description' => __( 'Enter keywords, separated by commas, to condition the display on specific keywords and leave blank for any.', 'elementor-extras' ), 'label_block' => true, ]; } /** * Check if keyword exists in phrase * * @since 2.2.0 * * @access public * * @param string $keyword Keyword to search * @param string $phrase Phrase to search in */ protected function keyword_exists( $keyword, $phrase ) { return strpos( $phrase, trim( $keyword ) ) !== false; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $show = false; if ( is_search() ) { if ( empty( $value ) ) { // We're showing on all search pages $show = true; } else { // We're showing on specific keywords $phrase = get_search_query(); // The user search query if ( '' !== $phrase && ! empty( $phrase ) ) { // Only proceed if there is a query $keywords = explode( ',', $value ); // Separate keywords foreach ( $keywords as $index => $keyword ) { if ( $this->keyword_exists( trim( $keyword ), $phrase ) ) { $show = true; break; } } } } } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/shortcode.php 0000644 00000004055 15112147616 0015244 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Condition * * @since 2.2.27 */ class Shortcode extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.27 * @return string */ public function get_group() { return 'misc'; } /** * Get Name * * Get the name of the module * * @since 2.2.27 * @return string */ public function get_name() { return 'shortcode'; } /** * Get Title * * Get the title of the module * * @since 2.2.27 * @return string */ public function get_title() { return __( 'Shortcode', 'elementor-extras' ); } /** * Get Name Control * * Get the settings for the name control * * @since 2.2.27 * @return array */ public function get_name_control() { return [ 'type' => Controls_Manager::TEXT, 'default' => '', 'placeholder' => __( '[shortcode attribute="value"]', 'elementor-extras' ), 'label_block' => true, ]; } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.27 * @return string */ public function get_value_control() { return [ 'type' => Controls_Manager::TEXTAREA, 'default' => '', 'description' => __( 'Enter the string that the shortcode needs to return in order for the condition to apply.', 'elementor-extras' ), ]; } /** * Check condition * * @since 2.2.27 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $show = false; $output = do_shortcode( $name ); if ( is_string( $output ) && $value === $output ) { $show = true; } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/static-page.php 0000644 00000004150 15112147616 0015447 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Static_Page * * @since 2.2.0 */ class Static_Page extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'single'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'static_page'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Static Page', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => Controls_Manager::SELECT, 'default' => 'home', 'label_block' => true, 'options' => [ 'home' => __( 'Default Homepage', 'elementor-extras' ), 'static' => __( 'Static Homepage', 'elementor-extras' ), 'blog' => __( 'Blog Page', 'elementor-extras' ), '404' => __( '404 Page', 'elementor-extras' ), ], ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { if ( 'home' === $value ) { return $this->compare( ( is_front_page() && is_home() ), true, $operator ); } elseif ( 'static' === $value ) { return $this->compare( ( is_front_page() && ! is_home() ), true, $operator ); } elseif ( 'blog' === $value ) { return $this->compare( ( ! is_front_page() && is_home() ), true, $operator ); } elseif ( '404' === $value ) { return $this->compare( is_404(), true, $operator ); } } } display-conditions/conditions/taxonomy-archive.php 0000644 00000005040 15112147616 0016542 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Taxonomy_Archive * * @since 2.2.0 */ class Taxonomy_Archive extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'archive'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'taxonomy_archive'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Taxonomy', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => Controls_Manager::SELECT2, 'default' => '', 'placeholder' => __( 'Any', 'elementor-extras' ), 'description' => __( 'Leave blank or select all for any taxonomy archive.', 'elementor-extras' ), 'multiple' => true, 'label_block' => true, 'options' => Utils::get_taxonomies_options(), ]; } /** * Checks a given taxonomy against the current page template * * @since 2.2.0 * * @access protected * * @param string $taxonomy The taxonomy to check against */ protected function check_taxonomy_archive_type( $taxonomy ) { if ( 'category' === $taxonomy ) { return is_category(); } else if ( 'post_tag' === $taxonomy ) { return is_tag(); } else if ( '' === $taxonomy || empty( $taxonomy ) ) { return is_tax() || is_category() || is_tag(); } else { return is_tax( $taxonomy ); } return false; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $show = false; if ( is_array( $value ) && ! empty( $value ) ) { foreach ( $value as $_key => $_value ) { $show = $this->check_taxonomy_archive_type( $_value ); if ( $show ) break; } } else { $show = $this->check_taxonomy_archive_type( $value ); } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/term-archive.php 0000644 00000004570 15112147616 0015642 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Term_Archive * * @since 2.2.0 */ class Term_Archive extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'archive'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'term_archive'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Term', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'description' => __( 'Leave blank or select all for any term.', 'elementor-extras' ), 'type' => 'ee-query', 'post_type' => '', 'options' => [], 'label_block' => true, 'multiple' => true, 'query_type' => 'terms', 'include_type' => true, ]; } /** * Checks a given taxonomy term against the current page template * * @since 2.1.2 * * @access protected * * @param string $taxonomy The taxonomy to check against */ protected function check_term_archive_type( $term ) { if ( is_category( $term ) ) { return true; } else if ( is_tag( $term ) ) { return true; } else if ( is_tax() ) { if ( is_tax( get_queried_object()->taxonomy, $term ) ) { return true; } } return false; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $show = false; if ( is_array( $value ) && ! empty( $value ) ) { foreach ( $value as $_key => $_value ) { $show = $this->check_term_archive_type( $_value ); if ( $show ) break; } } else { $show = $this->check_term_archive_type( $value ); } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/time.php 0000644 00000004303 15112147616 0014204 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Time * * @since 2.2.0 */ class Time extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'date_time'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'time'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Time of Day', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'label' => __( 'Before', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::DATE_TIME, 'picker_options' => [ 'dateFormat' => "H:i", 'enableTime' => true, 'noCalendar' => true, ], 'label_block' => true, 'default' => '', ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { // Split control valur into two dates $time = date( 'H:i', strtotime( preg_replace('/\s+/', '', $value ) ) ); $now = date( 'H:i', strtotime("now") + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ); // Default returned bool to false $show = false; // Check vars if ( \DateTime::createFromFormat( 'H:i', $time ) === false ) // Make sure it's a valid DateTime format return; // Convert to timestamp $time_ts = strtotime( $time ); $now_ts = strtotime( $now ); // Check that user date is between start & end $show = ( $now_ts < $time_ts ); return $this->compare( $show, true, $operator ); } } display-conditions/conditions/user.php 0000644 00000003654 15112147616 0014234 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Author_Archive * * @since 2.2.0 */ class User extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'visitor'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'user'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'Current User', 'elementor-extras' ); } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return string */ public function get_value_control() { return [ 'type' => 'ee-query', 'default' => '', 'placeholder' => __( 'Any', 'elementor-extras' ), 'description' => __( 'Works only when visitor is a logged in user. Leave blank for all users.', 'elementor-extras' ), 'multiple' => true, 'label_block' => true, 'query_type' => 'users', ]; } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $show = false; if ( is_array( $value ) && ! empty( $value ) ) { foreach ( $value as $_key => $_value ) { if ( $_value == get_current_user_id() ) { $show = true; break; } } } else { $show = $value == get_current_user_id(); } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/var-base.php 0000644 00000002336 15112147616 0014752 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions * * @since 2.2.0 */ class Var_Base extends Condition { /** * Get Group * * Get the group of the condition * * @since 2.2.0 * @return string */ public function get_group() { return 'var'; } /** * Get Name Control * * Get the settings for the name control * * @since 2.2.0 * @return array */ public function get_name_control() { return [ 'type' => Controls_Manager::TEXT, 'default' => '', 'placeholder' => __( 'Name', 'elementor-extras' ), 'label_block' => true, ]; } /** * Get Value Control * * Get the settings for the value control * * @since 2.2.0 * @return array */ public function get_value_control() { return [ 'type' => Controls_Manager::TEXT, 'default' => '', 'description' => __( 'Leave blank to accept any value.', 'elementor-extras' ), 'placeholder' => __( 'Value', 'elementor-extras' ), 'label_block' => true, ]; } } display-conditions/conditions/var-get.php 0000644 00000002326 15112147616 0014616 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Var_Base * * @since 2.2.0 */ class Var_Get extends Var_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'var_get'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'GET', 'elementor-extras' ); } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $show = false; if ( isset( $_GET[ $name ] ) ) { if ( '' === trim( $value ) ) { $show = true; } else if ( $value === $_GET[ $name ] ) { $show = true; } } return $this->compare( $show, true, $operator ); } } display-conditions/conditions/var-post.php 0000644 00000002333 15112147616 0015022 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions\Conditions; // Extras for Elementor Classes use ElementorExtras\Base\Condition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Conditions\Var_Base * * @since 2.2.0 */ class Var_Post extends Var_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'var_post'; } /** * Get Title * * Get the title of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'POST', 'elementor-extras' ); } /** * Check condition * * @since 2.2.0 * * @access public * * @param string $name The control name to check * @param string $operator Comparison operator * @param mixed $value The control value to check */ public function check( $name = null, $operator, $value ) { $show = false; if ( isset( $_POST[ $name ] ) ) { if ( '' === trim( $value ) ) { $show = true; } else if ( $value === $_POST[ $name ] ) { $show = true; } } return $this->compare( $show, true, $operator ); } } display-conditions/module.php 0000644 00000031165 15112147616 0012370 0 ustar 00 <?php namespace ElementorExtras\Modules\DisplayConditions; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Base\Module_Base; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Box_Shadow; use Elementor\Repeater; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\DisplayConditions\Module * * @since 2.2.0 */ class Module extends Module_Base { /** * Display Conditions * * Holds all the conditions for display on the frontend * * @since 2.0.0 * @access protected * * @var bool */ protected $conditions = []; /** * Display Conditions * * Holds all the conditions classes * * @since 2.0.0 * @access protected * * @var bool */ protected $_conditions = []; /** * Conditions Repeater * * The repeater control * * @since 2.2.0 * @access protected * * @var bool */ protected $_conditions_repeater; const VISITOR_GROUP = 'visitor'; const DATE_TIME_GROUP = 'date_time'; const SINGLE_GROUP = 'single'; const ARCHIVE_GROUP = 'archive'; const ACF_GROUP = 'acf'; const EDD_GROUP = 'edd'; const VAR_GROUP = 'var'; const MISC_GROUP = 'misc'; public function get_groups() { return [ self::VISITOR_GROUP => [ 'label' => __( 'Visitor', 'elementor-extras' ), ], self::DATE_TIME_GROUP => [ 'label' => __( 'Date & Time', 'elementor-extras' ), ], self::SINGLE_GROUP => [ 'label' => __( 'Single', 'elementor-extras' ), ], self::ARCHIVE_GROUP => [ 'label' => __( 'Archive', 'elementor-extras' ), ], self::ACF_GROUP => [ 'label' => __( 'Post ACF', 'elementor-extras' ), ], self::EDD_GROUP => [ 'label' => __( 'Easy Digital Downloads', 'elementor-extras' ), ], self::VAR_GROUP => [ 'label' => __( 'Variables', 'elementor-extras' ), ], self::MISC_GROUP => [ 'label' => __( 'Misc', 'elementor-extras' ), ], ]; } /** * Display Conditions * * Holds all the conditions for display on the frontend * * @since 2.0.0 * @access protected * * @var bool */ protected $conditions_options = []; public function __construct() { parent::__construct(); $this->register_conditions(); } /** * @since 0.1.0 */ public function register_conditions() { $available_conditions = [ // Visitor 'authentication', 'user', 'role', 'os', 'browser', // Date Time 'date', 'date_time_before', 'time', 'day', // Single 'page', 'post', 'static_page', 'post_type', 'post_meta', 'post_term', //Archive 'taxonomy_archive', 'term_archive', 'post_type_archive', 'date_archive', 'author_archive', 'search_results', // ACF 'acf_text', 'acf_choice', 'acf_true_false', 'acf_post', 'acf_taxonomy', 'acf_date_time', // EDD 'edd_cart', // Variables 'var_get', 'var_post', // Misc 'shortcode', ]; foreach ( $available_conditions as $condition_name ) { $class_name = str_replace( '-', ' ', $condition_name ); $class_name = str_replace( ' ', '', ucwords( $class_name ) ); $class_name = __NAMESPACE__ . '\\Conditions\\' . $class_name; if ( class_exists( $class_name ) ) { if ( $class_name::is_supported() ) { $this->_conditions[ $condition_name ] = $class_name::instance(); } } } } /** * @param string $condition_name * * @return Module_Base|Module_Base[] */ public function get_conditions( $condition_name = null ) { if ( $condition_name ) { if ( isset( $this->_conditions[ $condition_name ] ) ) { return $this->_conditions[ $condition_name ]; } return null; } return $this->_conditions; } /** * Set conditions. * * Sets the conditions property to all conditions comparison values * * @since 2.0.0 * @access protected * @static * * @param mixed $conditions The conditions from the repeater field control * * @return void */ protected function set_conditions( $id, $conditions = [] ) { if ( ! $conditions ) return; foreach ( $conditions as $index => $condition ) { $key = $condition['ee_condition_key']; $name = null; if ( array_key_exists( 'ee_condition_' . $key . '_name' , $condition ) ) { $name = $condition['ee_condition_' . $key . '_name']; } $operator = $condition['ee_condition_operator']; $value = $condition['ee_condition_' . $key . '_value']; $_condition = $this->get_conditions( $key ); if ( ! $_condition ) { continue; } $_condition->set_element_id( $id ); $check = $_condition->check( $name, $operator, $value ); $this->conditions[ $id ][ $key . '_' . $condition['_id'] ] = $check; } } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'display-conditions'; } /** * Add Actions * * @since 2.0.0 * * @access protected */ public function add_actions() { // Activate controls for widgets add_action( 'elementor/element/common/section_elementor_extras_advanced/before_section_end', function( $element, $args ) { $this->add_controls( $element, $args ); }, 10, 2 ); add_action( 'elementor/element/section/section_elementor_extras_advanced/before_section_end', function( $element, $args ) { $this->add_controls( $element, $args ); }, 10, 2 ); // Conditions for widgets add_action( 'elementor/widget/render_content', function( $widget_content, $element ) { $settings = $element->get_settings(); if ( ! empty( $settings['ee_display_conditions_enable'] ) && 'yes' === $settings[ 'ee_display_conditions_enable' ] ) { // Set the conditions $this->set_conditions( $element->get_id(), $settings['ee_display_conditions'] ); if ( ! $this->is_visible( $element->get_id(), $settings['ee_display_conditions_relation'] ) ) { // Check the conditions if ( 'yes' !== $settings['ee_display_conditions_output'] ) { return; // And on frontend we stop the rendering of the widget } } } return $widget_content; }, 10, 2 ); // Conditions for widgets add_action( 'elementor/frontend/widget/before_render', function( $element ) { $settings = $element->get_settings(); if ( ! empty( $settings['ee_display_conditions_enable'] ) && 'yes' === $settings[ 'ee_display_conditions_enable' ] ) { // Set the conditions $this->set_conditions( $element->get_id(), $settings['ee_display_conditions'] ); if ( ! $this->is_visible( $element->get_id(), $settings['ee_display_conditions_relation'] ) ) { // Check the conditions $element->add_render_attribute( '_wrapper', 'class', 'ee-conditions--hidden' ); } } }, 10, 1 ); // Conditions for sections add_action( 'elementor/frontend/section/before_render', function( $element ) { $settings = $element->get_settings(); if ( ! empty( $settings['ee_display_conditions_enable'] ) && 'yes' === $settings[ 'ee_display_conditions_enable' ] ) { // Set the conditions $this->set_conditions( $element->get_id(), $settings['ee_display_conditions'] ); if ( ! $this->is_visible( $element->get_id(), $settings['ee_display_conditions_relation'] ) ) { // Check the conditions $element->add_render_attribute( '_wrapper', 'class', 'ee-conditions--hidden' ); } } }, 10, 1 ); } /** * Add Controls * * @since 2.2.0 * * @access private */ public function add_controls( $element, $args ) { $this->_conditions_repeater = new Repeater(); $element_type = $element->get_type(); $element->add_control( 'ee_display_conditions_enable', [ 'label' => __( 'Display Conditions', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, ] ); if ( 'widget' === $element_type ) { $element->add_control( 'ee_display_conditions_output', [ 'label' => __( 'Output HTML', 'elementor-extras' ), 'description' => sprintf( __( 'If enabled, the HTML code will exist on the page but the %s will be hidden using CSS.', 'elementor-extras' ), $element_type ), 'default' => 'yes', 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, 'condition' => [ 'ee_display_conditions_enable' => 'yes', ], ] ); } $element->add_control( 'ee_display_conditions_relation', [ 'label' => __( 'Display on', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'all', 'options' => [ 'all' => __( 'All conditions met', 'elementor-extras' ), 'any' => __( 'Any condition met', 'elementor-extras' ), ], 'condition' => [ 'ee_display_conditions_enable' => 'yes', ], ] ); $this->_conditions_repeater->add_control( 'ee_condition_key', [ 'type' => Controls_Manager::SELECT, 'default' => 'authentication', 'label_block' => true, 'groups' => $this->get_conditions_options(), ] ); $this->add_name_controls(); $this->_conditions_repeater->add_control( 'ee_condition_operator', [ 'type' => Controls_Manager::SELECT, 'default' => 'is', 'label_block' => true, 'options' => [ 'is' => __( 'Is', 'elementor-extras' ), 'not' => __( 'Is not', 'elementor-extras' ), ], ] ); $this->add_value_controls(); $element->add_control( 'ee_display_conditions', [ 'label' => __( 'Conditions', 'elementor-extras' ), 'type' => Controls_Manager::REPEATER, 'default' => [ [ 'ee_condition_key' => 'authentication', 'ee_condition_operator' => 'is', 'ee_condition_authentication_value' => 'authenticated', ], ], 'condition' => [ 'ee_display_conditions_enable' => 'yes', ], 'fields' => $this->_conditions_repeater->get_controls(), 'title_field' => __( 'Display If', 'elementor-extras'), ] ); } /** * Add Value Controls * * Loops through conditions and adds the controls * which select the value to check * * @since 2.2.0 * * @access private * @return void */ private function add_name_controls() { if ( ! $this->_conditions ) return; foreach ( $this->_conditions as $_condition ) { if ( false === $_condition->get_name_control() ) { continue; } $condition_name = $_condition->get_name(); $control_key = 'ee_condition_' . $condition_name . '_name'; $control_settings = $_condition->get_name_control(); // Show this only if the user select this specific condition $control_settings['condition'] = [ 'ee_condition_key' => $condition_name, ]; // $this->_conditions_repeater->add_control( $control_key, $control_settings ); } } /** * Add Value Controls * * Loops through conditions and adds the controls * which select the value to check * * @since 2.2.0 * * @access private * @return void */ private function add_value_controls() { if ( ! $this->_conditions ) return; foreach ( $this->_conditions as $_condition ) { $condition_name = $_condition->get_name(); $control_key = 'ee_condition_' . $condition_name . '_value'; $control_settings = $_condition->get_value_control(); // Show this only if the user select this specific condition $control_settings['condition'] = [ 'ee_condition_key' => $condition_name, ]; // $this->_conditions_repeater->add_control( $control_key, $control_settings ); } } /** * Set the Conditions options array * * @since 2.1.0 * * @access private */ private function get_conditions_options() { $groups = $this->get_groups(); foreach ( $this->_conditions as $_condition ) { $groups[ $_condition->get_group() ]['options'][ $_condition->get_name() ] = $_condition->get_title(); } return $groups; } /** * Check conditions. * * Checks for all or any conditions and returns true or false * depending on wether the content can be shown or not * * @since 2.0.0 * @access protected * @static * * @param mixed $relation Required conditions relation * * @return bool */ protected function is_visible( $id, $relation ) { if ( ! array_key_exists( $id, $this->conditions ) ) return; if ( ! \Elementor\Plugin::$instance->editor->is_edit_mode() ) { if ( 'any' === $relation ) { if ( ! in_array( true, $this->conditions[ $id ] ) ) return false; } else { if ( in_array( false, $this->conditions[ $id ] ) ) return false; } } return true; } } gallery/widgets/gallery-slider.php 0000644 00000323213 15112147616 0013311 0 ustar 00 <?php namespace ElementorExtras\Modules\Gallery\Widgets; use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Group_Control_Transition; use ElementorExtras\Modules\Gallery\Module; use ElementorExtras\Modules\Image\Module as ImageModule; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Control_Media; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Border; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Background; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Css_Filter; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Gallery_Slider * * @since 1.1.0 */ class Gallery_Slider extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 1.1.0 * @return string */ public function get_name() { return 'gallery-slider'; } /** * Get Title * * Get the title of the widget * * @since 1.1.0 * @return string */ public function get_title() { return __( 'Gallery Slider', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 1.1.0 * @return string */ public function get_icon() { return 'nicon nicon-slider-gallery'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 1.1.0 * @return array */ public function get_script_depends() { return [ 'swiper', ]; } /** * Register Widget Controls * * @since 1.1.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_gallery', [ 'label' => __( 'Gallery', 'elementor-extras' ), ] ); $this->add_control( 'wp_gallery', [ 'label' => __( 'Add Images', 'elementor-extras' ), 'type' => Controls_Manager::GALLERY, 'dynamic' => [ 'active' => true ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_thumbnails', [ 'label' => __( 'Thumbnails', 'elementor-extras' ), ] ); $this->add_control( 'show_thumbnails', [ 'type' => Controls_Manager::SWITCHER, 'label' => __( 'Thumbnails', 'elementor-extras' ), 'default' => 'yes', 'label_off' => __( 'Hide', 'elementor-extras' ), 'label_on' => __( 'Show', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'thumbnails_carousel', [ 'type' => Controls_Manager::SWITCHER, 'label' => __( 'Enable Carousel', 'elementor-extras' ), 'default' => '', 'label_off' => __( 'Hide', 'elementor-extras' ), 'label_on' => __( 'Show', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'thumbnails_hide_single', [ 'type' => Controls_Manager::SWITCHER, 'label' => __( 'Hide for Single Image', 'elementor-extras' ), 'default' => 'yes', 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'thumbnails_stretch', [ 'type' => Controls_Manager::SWITCHER, 'label' => __( 'Stretch Horizontally', 'elementor-extras' ), 'description' => __( 'Stretch thumbnails horizontally if their number is smaller that the selected Slides per View number' ), 'default' => 'yes', 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', ], 'frontend_available' => true, ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'thumbnail', 'label' => __( 'Thumbnails Size', 'elementor-extras' ), 'condition' => [ 'show_thumbnails!' => '', ], ] ); $this->add_responsive_control( 'columns', [ 'label' => __( 'Columns', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '3', 'tablet_default' => '6', 'mobile_default' => '4', 'options' => [ '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', ], 'prefix_class' => 'ee-grid-columns%s-', 'frontend_available' => true, 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel' => '', ], ] ); $this->add_control( 'gallery_rand', [ 'label' => __( 'Ordering', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => __( 'Default', 'elementor-extras' ), 'rand' => __( 'Random', 'elementor-extras' ), ], 'default' => '', 'condition' => [ 'show_thumbnails!' => '', ], ] ); $this->add_control( 'thumbnails_caption_type', [ 'label' => __( 'Caption', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'title' => __( 'Title', 'elementor-extras' ), 'caption' => __( 'Caption', 'elementor-extras' ), 'description' => __( 'Description', 'elementor-extras' ), ], 'condition' => [ 'show_thumbnails!' => '', ], ] ); $this->add_control( 'view', [ 'label' => __( 'View', 'elementor-extras' ), 'type' => Controls_Manager::HIDDEN, 'default' => 'traditional', 'condition' => [ 'show_thumbnails!' => '', ], ] ); $this->add_control( 'carousel_heading', [ 'label' => __( 'Carousel', 'elementor-extras' ), 'separator' => 'before', 'type' => Controls_Manager::HEADING, 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', ] ] ); $this->add_control( 'carousel_orientation', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Orientation', 'elementor-extras' ), 'default' => 'horizontal', 'tablet_default' => 'horizontal', 'mobile_default' => 'horizontal', 'options' => [ 'horizontal' => __( 'Horizontal', 'elementor-extras' ), 'vertical' => __( 'Vertical', 'elementor-extras' ), ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', ], 'frontend_available' => true, ] ); $slides_per_column = range( 1, 6 ); $slides_per_column = array_combine( $slides_per_column, $slides_per_column ); $this->add_responsive_control( 'carousel_slides_per_view', [ 'label' => __( 'Slides per View', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'tablet_default' => '', 'mobile_default' => '', 'options' => [ '' => __( 'Default', 'elementor-extras' ), '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'carousel_slides_per_column', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Slides per Column', 'elementor-extras' ), 'description' => __( 'For Vertical direction this defines the number of slides per row.', 'elementor-extras' ), 'options' => [ '' => __( 'Default', 'elementor-extras' ) ] + $slides_per_column, 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_orientation!' => 'vertical', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'carousel_slides_to_scroll', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Slides to Scroll', 'elementor-extras' ), 'options' => [ '' => __( 'Default', 'elementor-extras' ) ] + $slides_per_column, 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'carousel_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 24, 'unit' => 'px', ], 'tablet_default' => [ 'size' => 12, 'unit' => 'px', ], 'mobile_default' => [ 'size' => 6, 'unit' => 'px', ], 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'carousel_resistance', [ 'label' => __( 'Resistance', 'elementor-extras' ), 'description' => __( 'Set the value for resistant bounds.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.25, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.05, ], ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'carousel_speed', [ 'label' => __( 'Speed (ms)', 'elementor-extras' ), 'description' => __( 'Duration of the effect transition.', 'elementor-extras' ) , 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 500, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 2000, 'step' => 100, ], ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'carousel_arrows', [ 'label' => __( 'Arrows', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'on', 'label_on' => __( 'On', 'elementor-extras' ), 'label_off' => __( 'Off', 'elementor-extras' ), 'return_value' => 'on', 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', ], 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_preview', [ 'label' => __( 'Preview', 'elementor-extras' ), ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'preview', 'label' => __( 'Preview Size', 'elementor-extras' ), 'default' => 'full', ] ); // $this->add_control( // 'lazy', // [ // 'type' => Controls_Manager::SELECT, // 'label' => __( 'Lazy Load', 'elementor-extras' ), // 'description' => __( 'On Demand: load image when slide is changed, Progressive: load all images after page loads.', 'elementor-extras' ), // 'options' => [ // '' => __( 'Off', 'elementor-extras' ), // 'ondemand' => __( 'On Demand', 'elementor-extras' ), // 'progressive' => __( 'Progressive', 'elementor-extras' ), // ], // 'default' => '', // 'frontend_available' => true, // ] // ); $this->add_control( 'link_to', [ 'label' => __( 'Link to', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'none', 'options' => [ 'none' => __( 'None', 'elementor-extras' ), 'file' => __( 'Media File', 'elementor-extras' ), 'custom' => __( 'Custom URL', 'elementor-extras' ), ], ] ); $this->add_control( 'link', [ 'label' => 'Link to', 'type' => Controls_Manager::URL, 'placeholder' => __( 'http://your-link.com', 'elementor-extras' ), 'condition' => [ 'link_to' => 'custom', ], 'show_label' => false, ] ); $this->add_control( 'open_lightbox', [ 'label' => __( 'Lightbox', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), 'yes' => __( 'Yes', 'elementor-extras' ), 'no' => __( 'No', 'elementor-extras' ), ], 'condition' => [ 'link_to' => 'file', ], ] ); $this->add_control( 'lightbox_slideshow', [ 'label' => __( 'Lightbox Slideshow', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'condition' => [ 'link_to' => 'file', 'open_lightbox' => ['default', 'yes'], ], ] ); // $this->add_control( // 'preview_stretch', // [ // 'label' => __( 'Image Stretch', 'elementor-extras' ), // 'type' => Controls_Manager::SELECT, // 'default' => 'yes', // 'options' => [ // 'no' => __( 'No', 'elementor-extras' ), // 'yes' => __( 'Yes', 'elementor-extras' ), // ], // ] // ); $this->add_control( 'caption_type', [ 'label' => __( 'Caption', 'elementor-extras' ), 'type' => Controls_Manager::SELECT2, 'multiple' => true, 'label_block' => true, 'default' => ['caption'], 'options' => [ '' => __( 'None', 'elementor-extras' ), 'title' => __( 'Title', 'elementor-extras' ), 'caption' => __( 'Caption', 'elementor-extras' ), 'description' => __( 'Description', 'elementor-extras' ), ], ] ); $this->add_control( 'preview_slider_heading', [ 'label' => __( 'Slider', 'elementor-extras' ), 'separator' => 'before', 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'direction', [ 'label' => __( 'Slide Direction', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'ltr', 'options' => [ 'ltr' => __( 'Left', 'elementor-extras' ), 'rtl' => __( 'Right', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_control( 'infinite', [ 'label' => __( 'Infinite Loop', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'yes', 'options' => [ 'yes' => __( 'Yes', 'elementor-extras' ), 'no' => __( 'No', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_control( 'effect', [ 'label' => __( 'Effect', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'separator' => 'before', 'default' => 'slide', 'options' => [ 'slide' => __( 'Slide', 'elementor-extras' ), 'fade' => __( 'Fade', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_control( 'speed', [ 'label' => __( 'Duration (ms)', 'elementor-extras' ), 'description' => __( 'How long should the effect transition last.', 'elementor-extras' ) , 'type' => Controls_Manager::NUMBER, 'default' => 1000, 'min' => 0, 'max' => 2000, 'step' => 100, 'frontend_available' => true, ] ); $this->add_control( 'ken_burns', [ 'label' => __( 'Ken Burns', 'elementor-extras' ), 'type' => Controls_Manager::POPOVER_TOGGLE, 'default' => '', 'condition' => [ 'effect' => 'fade', ], ] ); $this->start_popover(); $this->add_control( 'ken_burns_scale', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 2, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-swiper__container--kenburns .ee-swiper__slide img' => 'transform: scale({{SIZE}});', ], 'condition' => [ 'effect' => 'fade', 'ken_burns!' => '', ], ] ); $this->add_control( 'ken_burns_origin', [ 'label' => __( 'Transform Origin', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'separator' => 'before', 'label_block' => true, 'options' => [ '' => __('Default', 'elementor-extras'), 'random' => __('Random', 'elementor-extras'), 'custom' => __('Custom', 'elementor-extras'), ], 'default' => '', 'condition' => [ 'effect' => 'fade', 'ken_burns!' => '', ], ] ); $this->add_control( 'ken_burns_origin_x', [ 'label' => __( 'X Anchor Point', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-pro' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-pro' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-pro' ), 'icon' => 'eicon-h-align-right', ], ], 'condition' => [ 'effect' => 'fade', 'ken_burns!' => '', 'ken_burns_origin' => 'custom', ], ] ); $this->add_control( 'ken_burns_origin_y', [ 'label' => __( 'Y Anchor Point', 'elementor-pro' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-pro' ), 'icon' => 'eicon-v-align-top', ], 'center' => [ 'title' => __( 'Center', 'elementor-pro' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-pro' ), 'icon' => 'eicon-v-align-bottom', ], ], 'selectors' => [ '{{WRAPPER}} .ee-swiper__container--kenburns .ee-swiper__slide img' => 'transform-origin: {{ken_burns_origin_x.VALUE}} {{VALUE}}', ], 'condition' => [ 'effect' => 'fade', 'ken_burns!' => '', 'ken_burns_origin_x!' => '', 'ken_burns_origin' => 'custom', ], ] ); $this->add_control( 'ken_burns_duration', [ 'label' => __( 'Duration', 'elementor-extras' ), 'separator' => 'before', 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0.1, 'max' => 10, 'step' => 0.5, ], ], 'selectors' => [ '{{WRAPPER}} .ee-swiper__container--kenburns .ee-swiper__slide img' => 'transition-duration: {{SIZE}}s;', ], 'condition' => [ 'effect' => 'fade', 'ken_burns!' => '', ], ] ); $this->add_control( 'ken_burns_easing', [ 'label' => __( 'Easing', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => Group_Control_Transition::get_easings(), 'default' => 'linear', 'selectors' => [ '{{WRAPPER}} .ee-swiper__container--kenburns .ee-swiper__slide img' => 'transition-timing-function: {{VALUE}};', ], 'condition' => [ 'effect' => 'fade', 'ken_burns!' => '', ], ] ); $this->end_popover(); $this->add_control( 'resistance', [ 'label' => __( 'Resistance', 'elementor-extras' ), 'description' => __( 'Set the value for resistant bounds.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.25, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.05, ], ], 'frontend_available' => true, ] ); $this->add_control( 'autoplay', [ 'label' => __( 'Autoplay', 'elementor-extras' ), 'separator' => 'before', 'type' => Controls_Manager::POPOVER_TOGGLE, 'default' => '', 'frontend_available' => true, ] ); $this->start_popover(); $this->add_control( 'autoplay_speed', [ 'label' => __( 'Autoplay Speed', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 5000, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 10000, 'step' => 1000, ], ], 'condition' => [ 'autoplay' => 'yes', ], 'frontend_available' => true, ] ); $this->add_control( 'autoplay_disable_on_interaction', [ 'label' => __( 'Disable on Interaction', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'frontend_available' => true, 'condition' => [ 'autoplay' => 'yes', ], ] ); $this->add_control( 'pause_on_hover', [ 'label' => __( 'Pause on Hover', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'frontend_available' => true, 'condition' => [ 'autoplay' => 'yes', ], ] ); $this->end_popover(); $this->add_control( 'adaptive_height', [ 'type' => Controls_Manager::SWITCHER, 'label' => __( 'Auto Height', 'elementor-extras' ), 'default' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'show_arrows', [ 'label' => __( 'Arrows', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'On', 'elementor-extras' ), 'label_off' => __( 'Off', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_layout', [ 'label' => __( 'Layout', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'preview_position', [ 'label' => __( 'Preview Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'left', 'tablet_default' => 'top', 'mobile_default' => 'top', 'options' => [ 'top' => __( 'Top', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), 'left' => __( 'Left', 'elementor-extras' ), ], 'prefix_class' => 'ee-gallery-slider--', 'condition' => [ 'show_thumbnails!' => '', ], ] ); $this->add_control( 'preview_stack', [ 'label' => __( 'Stack on', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'tablet', 'tablet_default' => 'top', 'mobile_default' => 'top', 'options' => [ 'tablet' => __( 'Tablet & Mobile', 'elementor-extras' ), 'mobile' => __( 'Mobile Only', 'elementor-extras' ), ], 'prefix_class' => 'ee-gallery-slider--stack-', 'condition' => [ 'preview_position!' => 'top', 'show_thumbnails!' => '', ], ] ); $this->add_responsive_control( 'layout_horizontal_align', [ 'label' => __( 'Horizontal Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'default' => 'flex-start', 'selectors' => [ '{{WRAPPER}}.ee-gallery-slider--top .ee-gallery-slider' => 'align-items: {{VALUE}}', ], 'condition' => [ 'preview_position' => 'top', ], ] ); $this->add_responsive_control( 'layout_vertical_align', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], ], 'default' => 'flex-start', 'selectors' => [ '{{WRAPPER}}:not(.ee-gallery-slider--top) .ee-gallery-slider' => 'align-items: {{VALUE}}', ], 'condition' => [ 'preview_position!' => 'top', ], ] ); $this->add_responsive_control( 'preview_width', [ 'label' => __( 'Preview Width (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'size' => 70, ], 'condition' => [ 'preview_position!' => 'top', 'show_thumbnails!' => '', ], 'selectors' => [ '{{WRAPPER}}.ee-gallery-slider--left .ee-gallery-slider__preview' => 'width: {{SIZE}}%', '{{WRAPPER}}.ee-gallery-slider--right .ee-gallery-slider__preview' => 'width: {{SIZE}}%', '{{WRAPPER}}.ee-gallery-slider--left .ee-gallery-slider__gallery' => 'width: calc(100% - {{SIZE}}%)', '{{WRAPPER}}.ee-gallery-slider--right .ee-gallery-slider__gallery' => 'width: calc(100% - {{SIZE}}%)', ], ] ); $this->add_responsive_control( 'carousel_width', [ 'label' => __( 'Carousel Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'size' => 100, 'unit' => '%', ], 'condition' => [ 'preview_position' => 'top', 'show_thumbnails!' => '', ], 'selectors' => [ '{{WRAPPER}}.ee-gallery-slider--top .ee-gallery-slider__gallery' => 'max-width: {{SIZE}}{{unit}}', ], ] ); $wrapper_horizontal_margin = is_rtl() ? 'margin-right' : 'margin-left'; $preview_horizontal_padding = is_rtl() ? 'padding-right' : 'padding-left'; $this->add_responsive_control( 'preview_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'default' => [ 'size' => 24, ], 'selectors' => [ '{{WRAPPER}}.ee-gallery-slider--left .ee-gallery-slider > *, {{WRAPPER}}.ee-gallery-slider--right .ee-gallery-slider > *' => $preview_horizontal_padding . ': {{SIZE}}{{UNIT}};', '{{WRAPPER}}.ee-gallery-slider--left .ee-gallery-slider, {{WRAPPER}}.ee-gallery-slider--right .ee-gallery-slider' => $wrapper_horizontal_margin . ': -{{SIZE}}{{UNIT}};', '{{WRAPPER}}.ee-gallery-slider--top .ee-gallery-slider__preview' => 'margin-bottom: {{SIZE}}{{UNIT}};', '(tablet){{WRAPPER}}.ee-gallery-slider--stack-tablet .ee-gallery-slider__preview' => 'margin-bottom: {{SIZE}}{{UNIT}};', '(mobile){{WRAPPER}}.ee-gallery-slider--stack-mobile .ee-gallery-slider__preview' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'show_thumbnails!' => '', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_slides', [ 'label' => __( 'Slides', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'slides_custom_height', [ 'label' => __( 'Custom Height', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', ] ); $this->add_control( 'slides_image_fit', [ 'label' => __( 'Image Fit', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'cover', 'options' => [ 'cover' => __('Cover', 'elementor-extras'), 'contain' => __('Contain', 'elementor-extras'), ], 'selectors' => [ '{{WRAPPER}} .ee-slider__media__thumbnail img' => 'object-fit: {{VALUE}}', ], 'condition' => [ 'slides_custom_height!' => '', 'effect' => 'slide', ], ] ); $this->add_responsive_control( 'slides_height', [ 'label' => __( 'Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .ee-slider__media:before' => 'padding-bottom: {{SIZE}}%', ], 'condition' => [ 'slides_custom_height!' => '', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'preview_border', 'label' => __( 'Image Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-gallery-slider__slider', ] ); $this->add_control( 'preview_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__slider' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'preview_box_shadow', 'selector' => '{{WRAPPER}} .ee-gallery-slider__slider', 'separator' => '', ] ); $this->add_control( 'arrows_style_heading', [ 'label' => __( 'Arrows', 'elementor-extras' ), 'separator' => 'before', 'type' => Controls_Manager::HEADING, 'condition' => [ 'show_arrows!' => '', ] ] ); $this->add_control( 'arrows_position', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Position', 'elementor-extras' ), 'default' => 'middle', 'options' => [ 'top' => __( 'Top', 'elementor-extras' ), 'middle' => __( 'Middle', 'elementor-extras' ), 'bottom' => __( 'Bottom', 'elementor-extras' ), ], 'condition' => [ 'show_arrows!' => '', ], ] ); $this->add_responsive_control( 'arrows_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 12, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__preview .ee-swiper__button' => 'font-size: {{SIZE}}px;', ], 'condition' => [ 'show_arrows!' => '', ] ] ); $this->add_responsive_control( 'arrows_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__preview .ee-swiper__button' => 'padding: {{SIZE}}em;', ], 'condition' => [ 'show_arrows!' => '', ] ] ); $this->add_responsive_control( 'arrows_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__preview .ee-swiper__navigation--inside.ee-swiper__navigation--middle.ee-arrows--horizontal .ee-swiper__button' => 'margin-left: {{SIZE}}px; margin-right: {{SIZE}}px;', '{{WRAPPER}} .ee-gallery-slider__preview .ee-swiper__navigation--inside:not(.ee-swiper__navigation--middle).ee-arrows--horizontal .ee-swiper__button' => 'margin: {{SIZE}}px;', ], 'condition' => [ 'show_arrows!' => '', ] ] ); $this->add_responsive_control( 'arrows_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__preview .ee-swiper__button' => 'border-radius: {{SIZE}}%;', ], 'condition' => [ 'show_arrows!' => '', ], 'separator' => 'after', ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'arrows', 'selector' => '{{WRAPPER}} .ee-gallery-slider__preview .ee-swiper__button, {{WRAPPER}} .ee-gallery-slider__preview .ee-swiper__button i:before', 'condition' => [ 'show_arrows!' => '', ] ] ); $this->start_controls_tabs( 'arrows_tabs_hover' ); $this->start_controls_tab( 'arrows_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ 'show_arrows!' => '', ] ] ); $this->add_control( 'arrows_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__preview .ee-swiper__button i:before' => 'color: {{VALUE}};', ], 'condition' => [ 'show_arrows!' => '', ] ] ); $this->add_control( 'arrows_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__preview .ee-swiper__button' => 'background-color: {{VALUE}};', ], 'condition' => [ 'show_arrows!' => '', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'arrows_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ 'show_arrows!' => '', ] ] ); $this->add_control( 'arrows_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__preview .ee-swiper__button:hover i:before' => 'color: {{VALUE}};', ], 'condition' => [ 'show_arrows!' => '', ] ] ); $this->add_control( 'arrows_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__preview .ee-swiper__button:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ 'show_arrows!' => '', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'arrows_tab_disabled', [ 'label' => __( 'Disabled', 'elementor-extras' ), 'condition' => [ 'show_arrows!' => '', ] ] ); $this->add_responsive_control( 'arrows_opacity_disabled', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.05, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__preview .ee-swiper__button.ee-swiper__button--disabled' => 'opacity: {{SIZE}};', ], 'condition' => [ 'show_arrows!' => '', ] ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_style_preview_captions', [ 'label' => __( 'Preview Captions', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_control( 'preview_vertical_align', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], ], 'default' => 'bottom', 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_control( 'preview_horizontal_align', [ 'label' => __( 'Horizontal Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], 'justify' => [ 'title' => __( 'Justify', 'elementor-extras' ), 'icon' => 'eicon-h-align-stretch', ], ], 'default' => 'justify', 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_control( 'preview_align', [ 'label' => __( 'Text Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}} .ee-slider__media__caption' => 'text-align: {{VALUE}};', ], 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'preview_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-slider__media__caption', 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_control( 'preview_text_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-slider__media__caption' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_control( 'preview_text_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-slider__media__caption' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'preview_text_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-slider__media__caption', // 'separator' => '', 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_control( 'preview_text_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-slider__media__caption' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_control( 'preview_captions_title', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'caption_type' => 'title', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'preview_title_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-slider__media__caption .ee-caption__title', 'condition' => [ 'caption_type' => 'title', ], ] ); $this->add_control( 'preview_title_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-slider__media__caption .ee-caption__title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'caption_type' => 'title', ], ] ); $this->add_control( 'preview_captions_caption', [ 'label' => __( 'Caption', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'caption_type' => 'caption', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'preview_caption_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-slider__media__caption .ee-caption__caption', 'condition' => [ 'caption_type' => 'caption', ], ] ); $this->add_control( 'preview_caption_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-slider__media__caption .ee-caption__caption' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'caption_type' => 'caption', ], ] ); $this->add_control( 'preview_captions_description', [ 'label' => __( 'Description', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'caption_type' => 'description', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'preview_description_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-slider__media__caption .ee-caption__description', 'condition' => [ 'caption_type' => 'description', ], ] ); $this->add_control( 'preview_description_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-slider__media__caption .ee-caption__description' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'caption_type' => 'description', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_preview_hover_effects', [ 'label' => __( 'Preview Hover Effects', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_control( 'hover_preview_captions_heading', [ 'label' => __( 'Captions', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'preview_caption', 'selector' => '{{WRAPPER}} .ee-slider__media__content, {{WRAPPER}} .ee-slider__media__caption', 'condition' => [ 'caption_type!' => [], ], ] ); $this->update_control( 'preview_caption_transition', array( 'default' => 'custom', )); $this->add_control( 'preview_caption_effect', [ 'label' => __( 'Effect', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'fade-in' => __( 'Fade In', 'elementor-extras' ), 'fade-out' => __( 'Fade Out', 'elementor-extras' ), 'from-top' => __( 'From Top', 'elementor-extras' ), 'from-right' => __( 'From Right', 'elementor-extras' ), 'from-bottom' => __( 'From Bottom', 'elementor-extras' ), 'from-left' => __( 'From Left', 'elementor-extras' ), 'fade-from-top' => __( 'Fade From Top', 'elementor-extras' ), 'fade-from-right' => __( 'Fade From Right', 'elementor-extras' ), 'fade-from-bottom' => __( 'Fade From Bottom', 'elementor-extras' ), 'fade-from-left' => __( 'Fade From Left', 'elementor-extras' ), 'to-top' => __( 'To Top', 'elementor-extras' ), 'to-right' => __( 'To Right', 'elementor-extras' ), 'to-bottom' => __( 'To Bottom', 'elementor-extras' ), 'to-left' => __( 'To Left', 'elementor-extras' ), 'fade-to-top' => __( 'Fade To Top', 'elementor-extras' ), 'fade-to-right' => __( 'Fade To Right', 'elementor-extras' ), 'fade-to-bottom' => __( 'Fade To Bottom', 'elementor-extras' ), 'fade-to-left' => __( 'Fade To Left', 'elementor-extras' ), ], 'condition' => [ 'caption_type!' => [], 'preview_caption_transition!' => '', ], ] ); $this->start_controls_tabs( 'preview_caption_style' ); $this->start_controls_tab( 'preview_caption_style_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_control( 'preview_text_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-slider__media__caption' => 'color: {{VALUE}};', ], 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'preview_text_background', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .ee-slider__media__caption', 'default' => 'classic', 'condition' => [ 'caption_type!' => [], ], 'exclude' => [ 'image', ] ] ); $this->add_control( 'preview_text_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-slider__media__caption' => 'opacity: {{SIZE}}', ], 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'preview_text_box_shadow', 'selector' => '{{WRAPPER}} .ee-slider__media__caption', 'separator' => '', 'condition' => [ 'caption_type!' => [], ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'preview_caption_style_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_control( 'preview_text_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-slider__media:hover .ee-slider__media__caption' => 'color: {{VALUE}};', ], 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'preview_text_background_hover', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .ee-slider__media:hover .ee-slider__media__caption', 'default' => 'classic', 'condition' => [ 'caption_type!' => [], ], 'exclude' => [ 'image', ] ] ); $this->add_control( 'preview_text_opacity_hover', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-slider__media:hover .ee-slider__media__caption' => 'opacity: {{SIZE}}', ], 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_control( 'preview_text_border_color_hover', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-slider__media:hover .ee-slider__media__caption' => 'border-color: {{VALUE}};', ], 'condition' => [ 'caption_type!' => [], ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'preview_text_box_shadow_hover', 'selector' => '{{WRAPPER}} .ee-slider__media:hover .ee-slider__media__caption', 'separator' => '', 'condition' => [ 'caption_type!' => [], ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_style_thumbnails', [ 'label' => __( 'Thumbnails', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'show_thumbnails!' => '', ], ] ); $this->add_control( 'image_align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'prefix_class' => 'ee-grid-halign--', 'condition' => [ 'thumbnails_carousel' => '', ], ] ); $this->add_control( 'image_vertical_align', [ 'label' => __( 'Vertical Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], 'stretch' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-v-align-stretch', ], ], 'condition' => [ 'carousel_orientation!' => 'vertical', ], 'prefix_class' => 'ee-grid-align--', ] ); $this->add_control( 'image_vertical_stretch', [ 'label' => __( 'Stretch', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'stretch', 'return_value' => 'stretch', 'condition' => [ 'carousel_orientation' => 'vertical', ], 'prefix_class' => 'ee-grid-align--', ] ); $this->add_responsive_control( 'image_stretch_ratio', [ 'label' => __( 'Image Size Ratio', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '100' ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:before' => 'padding-bottom: {{SIZE}}%;', ], 'condition' => [ 'image_vertical_align' => 'stretch', 'carousel_orientation!' => 'vertical', ], ] ); $columns_horizontal_margin = is_rtl() ? 'margin-right' : 'margin-left'; $columns_horizontal_padding = is_rtl() ? 'padding-right' : 'padding-left'; $this->add_responsive_control( 'image_horizontal_spacing', [ 'label' => __( 'Horizontal Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'default' => [ 'size' => 24, ], 'selectors' => [ '{{WRAPPER}} .ee-grid__item' => $columns_horizontal_padding . ': {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-grid' => $columns_horizontal_margin . ': -{{SIZE}}{{UNIT}};', '(desktop){{WRAPPER}} .ee-grid__item' => 'max-width: calc( 100% / {{columns.SIZE}} );', '(tablet){{WRAPPER}} .ee-grid__item' => 'max-width: calc( 100% / {{columns_tablet.SIZE}} );', '(mobile){{WRAPPER}} .ee-grid__item' => 'max-width: calc( 100% / {{columns_mobile.SIZE}} );', ], 'condition' => [ 'thumbnails_carousel' => '', ], ] ); $this->add_responsive_control( 'image_vertical_spacing', [ 'label' => __( 'Vertical spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'default' => [ 'size' => 24, ], 'selectors' => [ '{{WRAPPER}} .ee-grid__item' => 'padding-bottom: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-grid' => 'margin-bottom: -{{SIZE}}{{UNIT}};', ], 'condition' => [ 'thumbnails_carousel' => '', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'image_border', 'label' => __( 'Image Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-gallery__media-wrapper', 'separator' => '', ] ); $this->add_control( 'image_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'carousel_style_heading', [ 'label' => __( 'Carousel', 'elementor-extras' ), 'separator' => 'before', 'type' => Controls_Manager::HEADING, 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_orientation' => 'vertical', ], ] ); $this->add_responsive_control( 'carousel_height', [ 'label' => __( 'Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => ['px'], 'range' => [ 'px' => [ 'min' => 100, 'max' => 2000, ], ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_orientation' => 'vertical', ], 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__carousel' => 'height: {{SIZE}}px', ], 'frontend_available' => true, ] ); $this->add_control( 'carousel_arrows_style_heading', [ 'label' => __( 'Arrows', 'elementor-extras' ), 'separator' => 'before', 'type' => Controls_Manager::HEADING, 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', ], ] ); $this->add_control( 'carousel_arrows_position', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Position', 'elementor-extras' ), 'default' => 'middle', 'options' => [ 'top' => __( 'Top', 'elementor-extras' ), 'middle' => __( 'Middle', 'elementor-extras' ), 'bottom' => __( 'Bottom', 'elementor-extras' ), ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', 'carousel_orientation' => 'horizontal', ], ] ); $this->add_control( 'carousel_arrows_position_vertical', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Position', 'elementor-extras' ), 'default' => 'center', 'options' => [ 'left' => __( 'Left', 'elementor-extras' ), 'center' => __( 'Center', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', 'carousel_orientation' => 'vertical', ], ] ); $this->add_responsive_control( 'carousel_arrows_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 12, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 12, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__button' => 'font-size: {{SIZE}}px;', ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', ] ] ); $this->add_responsive_control( 'carousel_arrows_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.4, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__button' => 'padding: {{SIZE}}em;', ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', ] ] ); $this->add_responsive_control( 'carousel_arrows_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 24, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__navigation.ee-swiper__navigation--middle.ee-arrows--horizontal .ee-swiper__button' => 'margin-left: {{SIZE}}px; margin-right: {{SIZE}}px;', '{{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__navigation:not(.ee-swiper__navigation--middle).ee-arrows--horizontal .ee-swiper__button' => 'margin: {{SIZE}}px;', '{{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__navigation .ee-swiper__navigation--center.ee-arrows--vertical .ee-swiper__button' => 'margin-top: {{SIZE}}px; margin-bottom: {{SIZE}}px;', '{{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__navigation:not(.ee-swiper__navigation--center).ee-arrows--vertical .ee-swiper__button' => 'margin: {{SIZE}}px;', ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', ] ] ); $this->add_responsive_control( 'carousel_arrows_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__button' => 'border-radius: {{SIZE}}%;', ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'carousel_arrows', 'selector' => '{{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__button, {{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__button i:before', 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', ] ] ); $this->start_controls_tabs( 'carousel_arrows_tabs_hover' ); $this->start_controls_tab( 'carousel_arrows_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', ] ] ); $this->add_control( 'carousel_arrows_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__button i:before' => 'color: {{VALUE}};', ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', ] ] ); $this->add_control( 'carousel_arrows_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__button' => 'background-color: {{VALUE}};', ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'carousel_arrows_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ 'carousel_arrows!' => '', 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', ] ] ); $this->add_control( 'carousel_arrows_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__button:hover i:before' => 'color: {{VALUE}};', ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', ] ] ); $this->add_control( 'carousel_arrows_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__button:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'carousel_arrows_tab_disabled', [ 'label' => __( 'Disabled', 'elementor-extras' ), 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', ] ] ); $this->add_responsive_control( 'carousel_arrows_opacity_disabled', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.05, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery-slider__gallery .ee-swiper__button.ee-swiper__button--disabled' => 'opacity: {{SIZE}};', ], 'condition' => [ 'show_thumbnails!' => '', 'thumbnails_carousel!' => '', 'carousel_arrows!' => '', ] ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_style_captions', [ 'label' => __( 'Thumbnails Captions', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'thumbnails_caption_type!' => '', 'show_thumbnails!' => '', ], ] ); $this->add_control( 'vertical_align', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], ], 'default' => 'bottom', 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'horizontal_align', [ 'label' => __( 'Horizontal Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], 'justify' => [ 'title' => __( 'Justify', 'elementor-extras' ), 'icon' => 'eicon-h-align-stretch', ], ], 'default' => 'justify', 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'align', [ 'label' => __( 'Text Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'text-align: {{VALUE}};', ], 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-gallery__media__caption', 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'text_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'text_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'thumbnails_caption_type!' => '', ], 'separator' => 'after', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'text_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-gallery__media__caption', 'separator' => '', 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'text_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_thumbnails_hover_effects', [ 'label' => __( 'Thumbnails Hover Effects', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'show_thumbnails!' => '', ], ] ); $this->add_control( 'hover_thubmanils_images_heading', [ 'label' => __( 'Images', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'image', 'selector' => '{{WRAPPER}} .ee-gallery__media-wrapper, {{WRAPPER}} .ee-gallery__media__thumbnail, {{WRAPPER}} .ee-gallery__media__thumbnail img', 'separator' => '', ] ); $this->update_control( 'image_transition', array( 'default' => 'custom', )); $this->start_controls_tabs( 'image_style' ); $this->start_controls_tab( 'image_style_default', [ 'label' => __( 'Default', 'elementor-extras' ), ] ); $this->add_control( 'image_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery__media-wrapper' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'image_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__thumbnail img' => 'opacity: {{SIZE}}', ], ] ); $this->add_responsive_control( 'image_scale', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 2, 'step'=> 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__thumbnail img' => 'transform: scale({{SIZE}});', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'image_box_shadow', 'selector' => '{{WRAPPER}} .ee-gallery__media-wrapper', 'separator' => '', ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'image_css_filters', 'selector' => '{{WRAPPER}} .ee-gallery__media__thumbnail img', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'image_style_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), ] ); $this->add_control( 'image_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media-wrapper' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'image_opacity_hover', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__thumbnail img' => 'opacity: {{SIZE}}', ], ] ); $this->add_responsive_control( 'image_scale_hover', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 2, 'step'=> 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__thumbnail img' => 'transform: scale({{SIZE}});', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'image_box_shadow_hover', 'selector' => '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media-wrapper', 'separator' => '', ] ); $this->add_control( 'image_border_color_hover', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media-wrapper' => 'border-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'image_css_filters_hover', 'selector' => '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__thumbnail img', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'image_style_active', [ 'label' => __( 'Active', 'elementor-extras' ), ] ); $this->add_control( 'image_background_color_active', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media-wrapper' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'image_opacity_active', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media__thumbnail img' => 'opacity: {{SIZE}}', ], ] ); $this->add_responsive_control( 'image_scale_active', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 2, 'step'=> 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media__thumbnail img' => 'transform: scale({{SIZE}});', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'image_box_shadow_active', 'selector' => '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media-wrapper', 'separator' => '', ] ); $this->add_control( 'image_border_color_active', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media-wrapper' => 'border-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'image_css_filters_active', 'selector' => '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media__thumbnail img', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'hover_thubmanils_captions_heading', [ 'label' => __( 'Captions', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'caption', 'selector' => '{{WRAPPER}} .ee-gallery__media__content, {{WRAPPER}} .ee-gallery__media__caption', 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->update_control( 'caption_transition', array( 'default' => 'custom', )); $this->add_control( 'caption_effect', [ 'label' => __( 'Effect', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'fade-in' => __( 'Fade In', 'elementor-extras' ), 'fade-out' => __( 'Fade Out', 'elementor-extras' ), 'from-top' => __( 'From Top', 'elementor-extras' ), 'from-right' => __( 'From Right', 'elementor-extras' ), 'from-bottom' => __( 'From Bottom', 'elementor-extras' ), 'from-left' => __( 'From Left', 'elementor-extras' ), 'fade-from-top' => __( 'Fade From Top', 'elementor-extras' ), 'fade-from-right' => __( 'Fade From Right', 'elementor-extras' ), 'fade-from-bottom' => __( 'Fade From Bottom', 'elementor-extras' ), 'fade-from-left' => __( 'Fade From Left', 'elementor-extras' ), 'to-top' => __( 'To Top', 'elementor-extras' ), 'to-right' => __( 'To Right', 'elementor-extras' ), 'to-bottom' => __( 'To Bottom', 'elementor-extras' ), 'to-left' => __( 'To Left', 'elementor-extras' ), 'fade-to-top' => __( 'Fade To Top', 'elementor-extras' ), 'fade-to-right' => __( 'Fade To Right', 'elementor-extras' ), 'fade-to-bottom' => __( 'Fade To Bottom', 'elementor-extras' ), 'fade-to-left' => __( 'Fade To Left', 'elementor-extras' ), ], 'condition' => [ 'thumbnails_caption_type!' => '', 'caption_transition!' => '', ], ] ); $this->start_controls_tabs( 'caption_style' ); $this->start_controls_tab( 'caption_style_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'text_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'color: {{VALUE}};', ], 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'text_background_color', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'background-color: {{VALUE}};', ], 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'text_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'opacity: {{SIZE}}', ], 'condition' => [ 'thumbnails_caption_type!' => '', 'tilt_enable' => 'yes', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'text_box_shadow', 'selector' => '{{WRAPPER}} .ee-gallery__media__caption', 'separator' => '', 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'caption_style_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'text_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__caption' => 'color: {{VALUE}};', ], 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'text_background_color_hover', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__caption' => 'background-color: {{VALUE}};', ], 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'text_opacity_hover', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__caption' => 'opacity: {{SIZE}}', ], 'condition' => [ 'thumbnails_caption_type!' => '', 'tilt_enable' => 'yes', ], ] ); $this->add_control( 'text_border_color_hover', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__caption' => 'border-color: {{VALUE}};', ], 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'text_box_shadow_hover', 'selector' => '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__caption', 'separator' => '', 'condition' => [ 'thumbnails_caption_type!' => '', 'tilt_enable' => 'yes', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'caption_style_active', [ 'label' => __( 'Active', 'elementor-extras' ), 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'text_color_active', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media__caption' => 'color: {{VALUE}};', ], 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'text_background_color_active', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media__caption' => 'background-color: {{VALUE}};', ], 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_control( 'text_opacity_active', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media__caption' => 'opacity: {{SIZE}}', ], 'condition' => [ 'thumbnails_caption_type!' => '', 'tilt_enable' => 'yes', ], ] ); $this->add_control( 'text_border_color_active', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media__caption' => 'border-color: {{VALUE}};', ], 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'text_box_shadow_active', 'selector' => '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media__caption', 'separator' => '', 'condition' => [ 'thumbnails_caption_type!' => '', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'hover_thubmanils_overlay_heading', [ 'label' => __( 'Overlay', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'overlay', 'selector' => '{{WRAPPER}} .ee-gallery__media__overlay', 'separator' => 'after', ] ); $this->update_control( 'overlay_transition', array( 'default' => 'custom', )); $this->start_controls_tabs( 'overlay_style' ); $this->start_controls_tab( 'overlay_style_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'overlay_background', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .ee-gallery__media__overlay', 'default' => 'classic', 'exclude' => [ 'image', ] ] ); $this->add_control( 'overlay_blend', [ 'label' => __( 'Blend mode', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'normal', 'options' => [ 'normal' => __( 'Normal', 'elementor-extras' ), 'multiply' => __( 'Multiply', 'elementor-extras' ), 'screen' => __( 'Screen', 'elementor-extras' ), 'overlay' => __( 'Overlay', 'elementor-extras' ), 'darken' => __( 'Darken', 'elementor-extras' ), 'lighten' => __( 'Lighten', 'elementor-extras' ), 'color' => __( 'Color', 'elementor-extras' ), 'color-dodge' => __( 'Color Dodge', 'elementor-extras' ), 'hue' => __( 'Hue', 'elementor-extras' ), ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__overlay' => 'mix-blend-mode: {{VALUE}};', ], ] ); $this->add_control( 'overlay_blend_notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => sprintf( __( 'Please check blend mode support for your browser %1$s here %2$s', 'elementor-extras' ), '<a href="https://caniuse.com/#search=mix-blend-mode" target="_blank">', '</a>' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'condition' => [ 'overlay_blend!' => 'normal' ], ] ); $this->add_responsive_control( 'overlay_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 48, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__overlay' => 'top: {{SIZE}}px; right: {{SIZE}}px; bottom: {{SIZE}}px; left: {{SIZE}}px', ], ] ); $this->add_responsive_control( 'overlay_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__overlay' => 'opacity: {{SIZE}}', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'overlay_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-gallery__media__overlay', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'overlay_style_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'overlay_background_hover', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__overlay', 'default' => 'classic', 'exclude' => [ 'image', ] ] ); $this->add_responsive_control( 'overlay_margin_hover', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 48, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__overlay' => 'top: {{SIZE}}px; right: {{SIZE}}px; bottom: {{SIZE}}px; left: {{SIZE}}px', ], ] ); $this->add_responsive_control( 'overlay_opacity_hover', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__overlay' => 'opacity: {{SIZE}}', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'overlay_border_hover', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__overlay', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'overlay_style_active', [ 'label' => __( 'Active', 'elementor-extras' ) ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'overlay_background_active', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media__overlay', 'default' => 'classic', 'exclude' => [ 'image', ] ] ); $this->add_responsive_control( 'overlay_margin_active', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 48, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media__overlay' => 'top: {{SIZE}}px; right: {{SIZE}}px; bottom: {{SIZE}}px; left: {{SIZE}}px', ], ] ); $this->add_responsive_control( 'overlay_opacity_active', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media__overlay' => 'opacity: {{SIZE}}', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'overlay_border_active', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-gallery__item.is--active .ee-gallery__media__overlay', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 1.1.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); if ( ! $settings['wp_gallery'] ) return; $this->add_render_attribute( [ 'wrapper' => [ 'class' => 'ee-gallery-slider', ], 'gallery-thumbnail' => [ 'class' => [ 'ee-media__thumbnail', 'ee-gallery__media__thumbnail', ], ], 'gallery-overlay' => [ 'class' => [ 'ee-media__overlay', 'ee-gallery__media__overlay', ], ], 'gallery-content' => [ 'class' => [ 'ee-media__content', 'ee-gallery__media__content', ], ], 'gallery-caption' => [ 'class' => [ 'wp-caption-text', 'ee-media__content__caption', 'ee-gallery__media__caption', ], ], 'gallery-item' => [ 'class' => [ 'ee-gallery__item', 'ee-grid__item', ], ], ] ); if ( $settings['columns'] ) { $this->add_render_attribute( 'shortcode', 'columns', $settings['columns'] ); } if ( ! empty( $settings['gallery_rand'] ) ) { $this->add_render_attribute( 'shortcode', 'orderby', $settings['gallery_rand'] ); } ?><div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>> <?php $this->render_preview(); ?> <?php $this->render_gallery(); ?> </div><?php } /** * Render Gallery * * Renders gallery for thumbnails * * @since 2.2.24 * @return void */ protected function render_gallery() { $settings = $this->get_settings_for_display(); $hide_single = '' !== $settings['thumbnails_hide_single'] && 2 > count( $settings['wp_gallery'] ); if ( '' === $settings['show_thumbnails'] || $hide_single ) { return; } $is_carousel = '' !== $settings['thumbnails_carousel']; $this->add_render_attribute( [ 'gallery-wrapper' => [ 'class' => [ 'ee-gallery-slider__gallery', ], ], 'gallery' => [ 'class' => [ 'ee-grid', 'ee-grid--gallery', 'ee-gallery', 'ee-gallery__gallery', 'ee-media-align--' . $settings['vertical_align'], 'ee-media-align--' . $settings['horizontal_align'], 'ee-media-effect__content--' . $settings['caption_effect'], ], ], ] ); if ( $is_carousel ) { $this->add_render_attribute( [ 'gallery-wrapper' => [ 'class' => [ 'ee-swiper', ], ], 'swiper-container-wrapper' => [ 'class' => [ 'ee-gallery-slider__carousel-wrapper', 'ee-swiper__container-wrapper', ], ], 'swiper-container' => [ 'class' => [ 'swiper-container', 'ee-swiper__container', 'ee-gallery-slider__carousel', ], ], 'gallery' => [ 'class' => [ 'ee-swiper__wrapper', 'swiper-wrapper', ], ], 'gallery-item' => [ 'class' => [ 'ee-swiper__slide', 'swiper-slide', ], ], ] ); } ?><div <?php echo $this->get_render_attribute_string( 'gallery-wrapper' ); ?>><?php if ( $is_carousel ) { ?><div <?php echo $this->get_render_attribute_string( 'swiper-container-wrapper' ); ?>><?php ?><div <?php echo $this->get_render_attribute_string( 'swiper-container' ); ?>><?php } ?><div <?php echo $this->get_render_attribute_string( 'gallery' ); ?>> <?php echo $this->render_gallery_items(); ?> </div><?php if ( $is_carousel ) { ?></div><!-- .ee-swiper --><?php if ( '' !== $settings['carousel_arrows'] ) { $this->render_swiper_navigation( 'carousel', $settings['carousel_orientation'], $settings['carousel_arrows_position'], $settings['carousel_arrows_position_vertical'] ); } ?></div><!-- .ee-swiper__container-wrapper --><?php } ?></div><?php } /** * Render WP Gallery * * Render gallery from wp gallery data * * @since 1.1.0 * @return void */ protected function render_gallery_items() { $settings = $this->get_settings_for_display(); $gallery = $settings['wp_gallery']; $media_tag = 'figure'; foreach ( $gallery as $index => $item ) { $item_url = ( in_array( 'url', $item ) ) ? $item['url'] : ''; $image = Module::get_image_info( $item['id'], $item_url, $settings['thumbnail_size'] ); $gallery_media_key = $this->get_repeater_setting_key( 'gallery-media', 'wp_gallery', $index ); $gallery_media_wrapper_key = $this->get_repeater_setting_key( 'gallery-media-wrapper', 'wp_gallery', $index ); $this->add_render_attribute( [ $gallery_media_key => [ 'class' => [ 'ee-media', 'ee-gallery__media', ], ], $gallery_media_wrapper_key => [ 'class' => [ 'ee-media__wrapper', 'ee-gallery__media-wrapper', ], ], ] ); if ( empty( $image ) ) continue; ?> <div <?php echo $this->get_render_attribute_string( 'gallery-item' ); ?>> <<?php echo $media_tag; ?> <?php echo $this->get_render_attribute_string( $gallery_media_key ); ?>> <div <?php echo $this->get_render_attribute_string( $gallery_media_wrapper_key ); ?>> <?php $this->render_image_thumbnail( $image ); ?> <?php $this->render_image_overlay(); ?> <?php $this->render_image_caption( $item ); ?> </div> </<?php echo $media_tag; ?>> </div> <?php } } /** * Render Image Thumbnail * * @since 1.1.0 * @param image|array The image information * @return void */ protected function render_image_thumbnail( $image ) { ?><div <?php echo $this->get_render_attribute_string( 'gallery-thumbnail' ); ?>> <?php echo $image['image']; ?> </div><?php } /** * Render Image Caption * * @since 1.1.0 * @param item|array The repeater item * @param settings|array The widget settings * @return void */ protected function render_image_caption( $item ) { if ( '' === $this->get_settings('thumbnails_caption_type') ) { return; } $caption = ImageModule::get_image_caption( $item['id'], $this->get_settings('thumbnails_caption_type') ); if ( ! $caption ) { return; } ?><figcaption <?php echo $this->get_render_attribute_string( 'gallery-content' ); ?>> <div <?php echo $this->get_render_attribute_string( 'gallery-caption' ); ?>> <?php echo $caption; ?> </div> </figcaption><?php } /** * Render Image Overlay * * @since 1.1.0 * @return void */ protected function render_image_overlay() { ?><div <?php echo $this->get_render_attribute_string( 'gallery-overlay' ); ?>></div><?php } /** * Render Carousel * * @since 1.1.0 * @return void */ private function render_preview() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'preview' => [ 'class' => [ 'ee-gallery-slider__preview', 'ee-swiper', ], ], 'slider-container' => [ 'class' => 'ee-gallery-slider__slider-wrapper', ], 'swiper-wrapper' => [ 'class' => [ 'ee-swiper__container', 'swiper', 'ee-gallery-slider__slider', 'ee-media-align--' . $settings['preview_vertical_align'], 'ee-media-align--' . $settings['preview_horizontal_align'], 'ee-media-effect__content--' . $settings['preview_caption_effect'], ], ], 'slider' => [ 'class' => [ 'swiper-wrapper', 'ee-swiper__wrapper', ], ], ] ); if ( ! empty( $settings['ken_burns'] ) && '' !== $settings['ken_burns'] ) { $this->add_render_attribute( 'swiper-wrapper', 'class', 'ee-swiper__container--kenburns' ); if ( 'random' === $settings['ken_burns_origin'] ) { $this->add_render_attribute( 'swiper-wrapper', 'class', 'ee-swiper__container--kenburns-random' ); } } ?><div <?php echo $this->get_render_attribute_string( 'preview' ); ?> dir="<?php echo $settings['direction']; ?>"> <div <?php echo $this->get_render_attribute_string( 'slider-container' ); ?>> <div <?php echo $this->get_render_attribute_string( 'swiper-wrapper' ); ?>> <div <?php echo $this->get_render_attribute_string( 'slider' ); ?>> <?php echo $this->render_preview_items(); ?> </div> </div><?php if ( '' !== $settings['show_arrows'] ) { $this->render_swiper_navigation( 'slider', 'horizontal', $settings['arrows_position'] ); } ?></div><?php ?></div><?php } /** * Render Preview Items * * @since 2.2.24 * @return void */ private function render_preview_items() { $settings = $this->get_settings_for_display(); $gallery = $settings['wp_gallery']; foreach ( $gallery as $index => $item ) { $url = Group_Control_Image_Size::get_attachment_image_src( $item['id'], 'preview', $settings ); $link = Module::get_link_url( $item, $settings ); $captions = $settings['caption_type'] ? ImageModule::get_image_caption( $item['id'], $settings['caption_type'] ) : false; $slide_key = $this->get_repeater_setting_key( 'slide', 'wp_gallery', $index ); $media_key = $this->get_repeater_setting_key( 'media', 'wp_gallery', $index ); $media_wrapper_key = $this->get_repeater_setting_key( 'media-wrapper', 'wp_gallery', $index ); $thumbnail_key = $this->get_repeater_setting_key( 'thumbnail', 'wp_gallery', $index ); $image_key = $this->get_repeater_setting_key( 'image', 'wp_gallery', $index ); $media_tag = 'figure'; $this->add_render_attribute( [ $slide_key => [ 'class' => [ 'ee-slider__slide', 'ee-swiper__slide', 'swiper-slide', ], ], $media_key => [ 'class' => [ 'ee-media', 'ee-slider__media', 'ee-swiper__slide__media', ], ], $media_wrapper_key => [ 'class' => [ 'ee-media__wrapper', 'ee-slider__media-wrapper', ], ], $thumbnail_key => [ 'class' => [ 'ee-media__thumbnail', 'ee-slider__media__thumbnail', ], ], $image_key => [ 'alt' => esc_attr( Control_Media::get_image_alt( $item ) ), 'src' => esc_attr( $url ), 'class' => 'ee-media__thumbnail__image', ], ] ); if ( '' !== $settings['slides_custom_height'] ) { $this->add_render_attribute( $media_key, 'class', 'ee-media--stretch' ); } if ( $link ) { $media_tag = 'a'; if ( ! empty( $link['url'] ) ) { $this->add_render_attribute( $media_key, 'href', $link['url'] ); } if ( ! empty( $link['is_external'] ) ) { $this->add_render_attribute( $media_key, 'target', '_blank' ); } if ( ! empty( $link['nofollow'] ) ) { $this->add_render_attribute( $media_key, 'rel', 'nofollow' ); } $this->add_lightbox_data_attributes( $media_key, $item['id'], $settings['open_lightbox'], $this->get_id_for_loop() ); if ( $this->_is_edit_mode ) { $this->add_render_attribute( $media_key, 'class', 'elementor-clickable' ); } } if ( ! empty( $captions ) ) { $content_key = $this->get_repeater_setting_key( 'content', 'wp_gallery', $index ); $caption_key = $this->get_repeater_setting_key( 'caption', 'wp_gallery', $index ); $this->add_render_attribute( [ $content_key => [ 'class' => [ 'ee-media__content', 'ee-slider__media__content', ], ], $caption_key => [ 'class' => [ 'ee-caption', 'ee-media__content__caption', 'ee-slider__media__caption', ], ], ] ); } ?><div <?php echo $this->get_render_attribute_string( $slide_key ); ?>> <<?php echo $media_tag; ?> <?php echo $this->get_render_attribute_string( $media_key ); ?>> <div <?php echo $this->get_render_attribute_string( $media_wrapper_key ); ?>> <div <?php echo $this->get_render_attribute_string( $thumbnail_key ); ?>> <img <?php echo $this->get_render_attribute_string( $image_key ); ?> /> </div> <?php if ( $captions ) { ?> <div <?php echo $this->get_render_attribute_string( $content_key ); ?>> <figcaption <?php echo $this->get_render_attribute_string( $caption_key ); ?>> <?php foreach ( (array)$captions as $caption_type => $caption ) { call_user_func_array( '\ElementorExtras\Modules\Image\Module::render_image_' . $caption_type, [ $caption ] ); } ?> </figcaption> </div> <?php } ?> </div> </<?php echo $media_tag; ?>> </div><?php } } /** * Render Swiper Navigation * * Outputs markup for the swiper navigation * * @since 2.2.24 * @return void */ protected function render_swiper_navigation( $key, $direction, $halign = 'center', $valign = 'middle' ) { $settings = $this->get_settings(); $nav_key = $this->get_repeater_setting_key( 'navigation', 'swiper', $key ); $this->add_render_attribute( [ $nav_key => [ 'class' => [ 'ee-arrows', 'ee-arrows--' . $direction, 'ee-swiper__navigation', 'ee-swiper__navigation--inside', 'ee-swiper__navigation--' . $halign, 'ee-swiper__navigation--' . $valign, ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( $nav_key ); ?>><?php if ( 2 <= count( $settings['wp_gallery'] ) ) { $this->render_swiper_arrows( $key ); } ?></div><?php } /** * Render Swiper Arrows * * Outputs markup for the swiper arrows navigation * * @since 2.2.24 * @return void */ protected function render_swiper_arrows( $key ) { $prev = is_rtl() ? 'right' : 'left'; $next = is_rtl() ? 'left' : 'right'; $prev_key = $this->get_repeater_setting_key( 'arrow', 'prev', $key ); $prev_icon_key = $this->get_repeater_setting_key( 'arrow-icon', 'prev', $key ); $next_key = $this->get_repeater_setting_key( 'arrow', 'next', $key ); $next_icon_key = $this->get_repeater_setting_key( 'arrow-icon', 'next', $key ); $this->add_render_attribute( [ $prev_key => [ 'class' => [ 'ee-swiper__button', 'ee-swiper__button--prev', 'ee-arrow', 'ee-arrow--prev', 'ee-swiper__button--prev-' . $key, ], ], $prev_icon_key => [ 'class' => 'eicon-chevron-' . $prev, ], $next_key => [ 'class' => [ 'ee-swiper__button', 'ee-swiper__button--next', 'ee-arrow', 'ee-arrow--next', 'ee-swiper__button--next-' . $key, ], ], $next_icon_key => [ 'class' => 'eicon-chevron-' . $next, ], ] ); ?><div <?php echo $this->get_render_attribute_string( $prev_key ); ?>> <i <?php echo $this->get_render_attribute_string( $prev_icon_key ); ?>></i> </div> <div <?php echo $this->get_render_attribute_string( $next_key ); ?>> <i <?php echo $this->get_render_attribute_string( $next_icon_key ); ?>></i> </div><?php } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 1.1.0 * @return void */ protected function content_template() {} } gallery/widgets/gallery.php 0000644 00000257147 15112147616 0012045 0 ustar 00 <?php namespace ElementorExtras\Modules\Gallery\Widgets; // Extras for Elementor Classes use ElementorExtras\ElementorExtrasPlugin as Plugin; use ElementorExtras\Group_Control_Transition; use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\Gallery\Module; use ElementorExtras\Modules\Image\Module as ImageModule; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Repeater; use Elementor\Utils; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Border; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Css_Filter; use Elementor\Modules\DynamicTags\Module as TagsModule; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Gallery * * @since 2.1.0 */ class Gallery extends Extras_Widget { /** * Instagram Access token. * * @since 2.1.0 * @var string */ private $insta_access_token = null; /** * Instagram API URL. * * @since 2.1.0 * @var string */ private $insta_api_url = 'https://www.instagram.com/'; /** * Official Instagram API URL. * * @since 2.1.0 * @var string */ private $insta_official_api_url = 'https://graph.instagram.com/'; /** * Get Name * * Get the name of the widget * * @since 2.1.0 * @return string */ public function get_name() { return 'gallery-extra'; } /** * Get Title * * Get the title of the widget * * @since 2.1.0 * @return string */ public function get_title() { return __( 'Gallery', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 2.1.0 * @return string */ public function get_icon() { return 'nicon nicon-image-gallery'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 2.1.0 * @return array */ public function get_script_depends() { return [ 'tilt', 'parallax-gallery', 'jquery-resize-ee', 'isotope', 'packery-mode', 'imagesloaded', ]; } /** * Register Widget Controls * * @since 2.1.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_gallery', [ 'label' => __( 'Gallery', 'elementor-extras' ), ] ); $this->add_control( 'gallery_type', [ 'label' => __( 'Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'wordpress', 'options' => [ 'wordpress' => __( 'Wordpress', 'elementor-extras' ), 'manual' => __( 'Manual', 'elementor-extras' ), 'instagram' => __( 'Instagram', 'elementor-extras' ), ], ] ); $this->add_control( 'insta_display', [ 'label' => __( 'Display', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'feed', 'options' => [ 'feed' => __( 'My Photos', 'elementor-extras' ), 'tags' => __( 'Tagged Photos', 'elementor-extras' ), ], 'condition' => [ 'gallery_type' => 'instagram', ], ] ); if ( ! $this->get_insta_global_access_token() ) { $this->add_control( 'access_token_missing', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => sprintf( __( 'The global Instagram access token is missing. You can use a custom one below or add it %1$shere%2$s. Find out %3$show to get your access token%4$s.', 'elementor-extras' ), '<a target="_blank" href="' . admin_url( 'admin.php?page=elementor-extras#elementor_extras_apis' ) . '">', '</a>', '<a target="_blank" href="' . Plugin::$instance->get_link('docs_ig_token') . '">', '</a>' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'condition' => [ 'gallery_type' => 'instagram', 'insta_display' => 'feed', ], ] ); } $this->add_control( 'access_token', [ 'label' => __( 'Override Global Access Token', 'elementor-extras' ), 'description' => sprintf( __( 'Leave blank to use the global token set under Elementor > Extras > APIs. %1$sHow to get an access token%2$s', 'elementor-extras' ), '<a target="_blank" href="' . Plugin::$instance->get_link('docs_ig_token') . '">', '</a>' ), 'label_block' => true, 'default' => '', 'type' => Controls_Manager::TEXT, 'condition' => [ 'gallery_type' => 'instagram', 'insta_display' => 'feed', ], ] ); $this->add_control( 'insta_hashtag', [ 'label' => __( 'Hashtag', 'elementor-extras' ), 'description' => __( 'Enter without the # symbol', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'condition' => [ 'gallery_type' => 'instagram', 'insta_display' => 'tags', ], 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, ], ], ] ); $gallery_items = new Repeater(); $gallery_items->add_control( 'image', [ 'label' => __( 'Choose Image', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], ] ); $gallery_items->add_control( 'link', [ 'label' => __( 'Link to', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'file', 'options' => [ 'file' => __( 'Media File', 'elementor-extras' ), 'attachment' => __( 'Attachment Page', 'elementor-extras' ), 'custom' => __( 'Custom URL', 'elementor-extras' ), '' => __( 'None', 'elementor-extras' ), ], ] ); $gallery_items->add_control( 'link_url', [ 'label' => __( 'Link', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'placeholder' => esc_url( home_url( '/' ) ), 'default' => [ 'url' => esc_url( home_url( '/' ) ), ], 'condition' => [ 'link' => 'custom', ] ] ); $gallery_items->start_controls_tabs('custom'); $gallery_items->start_controls_tab( 'custom_desktop', [ 'label' => __( 'Desktop', 'elementor-extras' ), ] ); $gallery_items->add_control( 'custom_size', [ 'label' => __( 'Custom Size', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', ] ); $gallery_items->add_control( 'width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'label_block' => true, 'default' => '', 'options' => [ '' => __( 'Default', 'elementor-extras' ), '100%' => __( 'Full Width', 'elementor-extras' ), '50%' => __( 'One Half', 'elementor-extras' ), '33.3333%' => __( 'One Third', 'elementor-extras' ), '66.6666%' => __( 'Two Thirds', 'elementor-extras' ), '25%' => __( 'One Quarter', 'elementor-extras' ), '75%' => __( 'Three Quarters', 'elementor-extras' ), '20%' => __( 'One Fifth', 'elementor-extras' ), '40%' => __( 'Two Fifths', 'elementor-extras' ), '60%' => __( 'Three Fifths', 'elementor-extras' ), '80%' => __( 'Four Fifths', 'elementor-extras' ), '16.6666%' => __( 'One Sixth', 'elementor-extras' ), '83.3333%' => __( 'Five Sixths', 'elementor-extras' ), ], 'selectors' => [ '(desktop+){{WRAPPER}} {{CURRENT_ITEM}}.ee-grid__item--custom-size' => 'width: {{VALUE}};', ], 'condition' => [ 'custom_size!' => '' ], ] ); $gallery_items->add_control( 'height_ratio', [ 'label' => __( 'Image Size Ratio', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 200, ], ], 'selectors' => [ '(desktop+){{WRAPPER}} {{CURRENT_ITEM}} .ee-media--stretch:before' => 'padding-bottom: {{SIZE}}%;', ], 'condition' => [ 'custom_size!' => '' ], ] ); $gallery_items->end_controls_tab(); $gallery_items->start_controls_tab( 'custom_tablet', [ 'label' => __( 'Tablet', 'elementor-extras' ), ] ); $gallery_items->add_control( 'custom_size_tablet', [ 'label' => __( 'Custom Size', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', ] ); $gallery_items->add_control( 'width_tablet', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'label_block' => true, 'options' => [ '' => __( 'Default', 'elementor-extras' ), '100%' => __( 'Full Width', 'elementor-extras' ), '50%' => __( 'One Half', 'elementor-extras' ), '33.3333%' => __( 'One Third', 'elementor-extras' ), '66.6666%' => __( 'Two Thirds', 'elementor-extras' ), '25%' => __( 'One Quarter', 'elementor-extras' ), '75%' => __( 'Three Quarters', 'elementor-extras' ), '20%' => __( 'One Fifth', 'elementor-extras' ), '40%' => __( 'Two Fifths', 'elementor-extras' ), '60%' => __( 'Three Fifths', 'elementor-extras' ), '80%' => __( 'Four Fifths', 'elementor-extras' ), '16.6666%' => __( 'One Sixth', 'elementor-extras' ), '83.3333%' => __( 'Five Sixths', 'elementor-extras' ), ], 'selectors' => [ '(tablet+)(tablet-){{WRAPPER}} {{CURRENT_ITEM}}.ee-grid__item--custom-size' => 'width: {{VALUE}};', ], 'condition' => [ 'custom_size_tablet!' => '' ], ] ); $gallery_items->add_control( 'height_ratio_tablet', [ 'label' => __( 'Image Size Ratio', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 200, ], ], 'selectors' => [ '(tablet+)(tablet-){{WRAPPER}} {{CURRENT_ITEM}} .ee-media--stretch:before' => 'padding-bottom: {{SIZE}}%;', ], 'condition' => [ 'custom_size_tablet!' => '' ], ] ); $gallery_items->end_controls_tab(); $gallery_items->start_controls_tab( 'custom_mobile', [ 'label' => __( 'Mobile', 'elementor-extras' ), ] ); $gallery_items->add_control( 'custom_size_mobile', [ 'label' => __( 'Custom Size', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', ] ); $gallery_items->add_control( 'width_mobile', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'label_block' => true, 'options' => [ '' => __( 'Default', 'elementor-extras' ), '100%' => __( 'Full Width', 'elementor-extras' ), '50%' => __( 'One Half', 'elementor-extras' ), '33.3333%' => __( 'One Third', 'elementor-extras' ), '66.6666%' => __( 'Two Thirds', 'elementor-extras' ), '25%' => __( 'One Quarter', 'elementor-extras' ), '75%' => __( 'Three Quarters', 'elementor-extras' ), '20%' => __( 'One Fifth', 'elementor-extras' ), '40%' => __( 'Two Fifths', 'elementor-extras' ), '60%' => __( 'Three Fifths', 'elementor-extras' ), '80%' => __( 'Four Fifths', 'elementor-extras' ), '16.6666%' => __( 'One Sixth', 'elementor-extras' ), '83.3333%' => __( 'Five Sixths', 'elementor-extras' ), ], 'selectors' => [ '(mobile){{WRAPPER}} {{CURRENT_ITEM}}.ee-grid__item--custom-size' => 'width: {{VALUE}};', ], 'condition' => [ 'custom_size_mobile!' => '' ], ] ); $gallery_items->add_control( 'height_ratio_mobile', [ 'label' => __( 'Image Size Ratio', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 200, ], ], 'selectors' => [ '(mobile){{WRAPPER}} {{CURRENT_ITEM}} .ee-media--stretch:before' => 'padding-bottom: {{SIZE}}%;', ], 'condition' => [ 'custom_size_mobile!' => '' ], ] ); $gallery_items->end_controls_tab(); $gallery_items->end_controls_tab(); $this->add_control( 'gallery', [ 'label' => __( 'Images', 'elementor-extras' ), 'type' => Controls_Manager::REPEATER, 'default' => [ [], [], [], [], [], [], ], 'fields' => $gallery_items->get_controls(), 'condition' => [ 'gallery_type' => 'manual', ] ] ); $this->add_control( 'images_heading', [ 'label' => __( 'Images', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'gallery_type' => 'wordpress', ] ] ); $this->add_control( 'wp_gallery', [ 'label' => __( 'Add Images', 'elementor-extras' ), 'type' => Controls_Manager::GALLERY, 'dynamic' => [ 'active' => true, ], 'condition' => [ 'gallery_type' => 'wordpress', ] ] ); $this->end_controls_section(); $this->start_controls_section( 'section_gallery_settings', [ 'label' => __( 'Settings', 'elementor-extras' ), ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'thumbnail', 'default' => 'full', 'condition' => [ 'gallery_type!' => 'instagram', ], ] ); $this->add_control( 'insta_image_size', [ 'label' => __( 'Image Size', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'standard', 'options' => [ 'thumbnail' => __( 'Thumbnail (150x150)', 'elementor-extras' ), 'low' => __( 'Low (320x320)', 'elementor-extras' ), 'standard' => __( 'Standard (640x640)', 'elementor-extras' ), 'high' => __( 'High (original)', 'elementor-extras' ), ], 'condition' => [ 'gallery_type' => 'instagram', ], ] ); $this->add_responsive_control( 'columns', [ 'label' => __( 'Columns', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '3', 'tablet_default' => '2', 'mobile_default' => '1', 'options' => [ '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', ], 'prefix_class' => 'ee-grid-columns%s-', 'frontend_available' => true, ] ); $this->add_control( 'columns_notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'If you are specifying the widths for each image individually, set this to correspond to the lowest width in your gallery.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', 'condition' => [ 'gallery_type' => 'manual', ] ] ); $this->add_control( 'gallery_link', [ 'label' => __( 'Link to', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'file', 'options' => [ 'file' => __( 'Media File', 'elementor-extras' ), 'attachment' => __( 'Attachment Page', 'elementor-extras' ), '' => __( 'None', 'elementor-extras' ), ], 'condition' => [ 'gallery_type' => [ 'wordpress', 'instagram' ], ] ] ); $this->add_control( 'open_lightbox', [ 'label' => __( 'Lightbox', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), 'yes' => __( 'Yes', 'elementor-extras' ), 'no' => __( 'No', 'elementor-extras' ), ], 'condition' => [ 'gallery_link' => 'file', ], ] ); $this->add_control( 'lightbox_slideshow', [ 'label' => __( 'Lightbox Slideshow', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'condition' => [ 'gallery_link' => 'file', 'open_lightbox' => ['default', 'yes'], ], ] ); $this->add_control( 'gallery_rand', [ 'label' => __( 'Ordering', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => __( 'Default', 'elementor-extras' ), 'rand' => __( 'Random', 'elementor-extras' ), ], 'default' => '', ] ); $this->add_control( 'gallery_display_caption', [ 'label' => __( 'Caption', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Show', 'elementor-extras' ), 'none' => __( 'Hide', 'elementor-extras' ), ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'display: {{VALUE}};', ], ] ); $this->add_control( 'gallery_caption', [ 'label' => __( 'Caption Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'caption', 'options' => [ 'title' => __( 'Title', 'elementor-extras' ), 'caption' => __( 'Caption', 'elementor-extras' ), 'description' => __( 'Description', 'elementor-extras' ), ], 'condition' => [ 'gallery_display_caption' => '', 'gallery_type!' => 'instagram', ], ] ); $this->add_control( 'view', [ 'label' => __( 'View', 'elementor-extras' ), 'type' => Controls_Manager::HIDDEN, 'default' => 'traditional', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_gallery_instagram', [ 'label' => __( 'Instagram', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, 'condition' => [ 'gallery_type' => 'instagram', 'gallery_display_caption' => '', ], ] ); $this->add_control( 'insta_counter_comments', [ 'label' => __( 'Show Comments', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Show', 'elementor-extras' ), 'label_off' => __( 'Hide', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'gallery_type' => 'instagram', 'gallery_display_caption' => '', ], ] ); $this->add_control( 'insta_counter_likes', [ 'label' => __( 'Show Likes', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Show', 'elementor-extras' ), 'label_off' => __( 'Hide', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'gallery_type' => 'instagram', 'gallery_display_caption' => '', ], ] ); $this->add_control( 'insta_counter_caption', [ 'label' => __( 'Show Caption', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Show', 'elementor-extras' ), 'label_off' => __( 'Hide', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'gallery_type' => 'instagram', 'gallery_display_caption' => '', ], ] ); $this->add_control( 'insta_caption_length', [ 'label' => __( 'Caption Length', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 30, 'condition' => [ 'gallery_type' => 'instagram', ], 'dynamic' => [ 'active' => true, ], ] ); $this->add_control( 'insta_posts_counter', [ 'label' => __( 'Number of Posts', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 10, 'condition' => [ 'gallery_type' => 'instagram', ], 'dynamic' => [ 'active' => true, ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_gallery_parallax', [ 'label' => __( 'Parallax', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'parallax_enable', [ 'label' => __( 'Parallax', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'separator' => 'before', 'frontend_available' => true, ] ); $this->add_control( 'parallax_disable_on', [ 'label' => __( 'Disable for', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'mobile', 'options' => [ 'none' => __( 'None', 'elementor-extras' ), 'tablet' => __( 'Mobile and tablet', 'elementor-extras' ), 'mobile' => __( 'Mobile only', 'elementor-extras' ), ], 'condition' => [ 'parallax_enable' => 'yes', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'parallax_speed', [ 'label' => __( 'Parallax speed', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.5 ], 'tablet_default' => [ 'size' => 0.5 ], 'mobile_default' => [ 'size' => 0.5 ], 'range' => [ 'px' => [ 'min' => 0.05, 'max' => 1, 'step' => 0.01, ], ], 'condition' => [ 'parallax_enable' => 'yes', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'image_distance', [ 'label' => __( 'Parallax Distance (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'size' => '10', ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__item.is--3d .ee-gallery__media' => 'margin-left: calc({{SIZE}}%/2); margin-right: calc({{SIZE}}%/2);', ], 'condition' => [ 'parallax_enable' => 'yes', 'image_vertical_align!' => 'stretch', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_gallery_masonry', [ 'label' => __( 'Masonry', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, 'condition' => [ 'parallax_enable!' => 'yes', ], ] ); $this->add_control( 'masonry_enable', [ 'label' => __( 'Enable', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, 'separator' => 'before', 'condition' => [ 'parallax_enable!' => 'yes', ], ] ); $this->add_control( 'masonry_layout', [ 'label' => __( 'Layout', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'columns', 'options' => [ 'columns' => [ 'title' => __( 'Columns', 'elementor-extras' ), 'icon' => 'nicon nicon-masonry-columns', ], 'mixed' => [ 'title' => __( 'Mixed', 'elementor-extras' ), 'icon' => 'nicon nicon-masonry-mixed', ], ], 'label_block' => false, 'condition' => [ 'masonry_enable!' => '', 'parallax_enable!' => 'yes', ], 'prefix_class' => 'ee-grid-masonry-layout--', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_gallery_tilt', [ 'label' => __( 'Tilt', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'tilt_enable', [ 'label' => __( 'Enable', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'tilt_depth', [ 'label' => __( 'Depth', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, 'condition' => [ 'tilt_enable!' => '', ], ] ); $this->add_control( 'tile_depth_warning', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Depth disables CSS overflow: hidden which disables border radius for thumbnails.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'condition' => [ 'tilt_enable!' => '', 'tilt_depth!' => '', ], ] ); $this->add_control( 'tilt_axis', [ 'label' => __( 'Axis', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Both', 'elementor-extras' ), 'x' => __( 'X Only', 'elementor-extras' ), 'y' => __( 'Y Only', 'elementor-extras' ), ], 'frontend_available' => true, 'condition' => [ 'tilt_enable' => 'yes', ], ] ); $this->add_control( 'tilt_amount', [ 'label' => __( 'Amount', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 10, 'max' => 40, ], ], 'default' => [ 'size' => 20, ], 'frontend_available' => true, 'condition' => [ 'tilt_enable' => 'yes', ], ] ); $this->add_control( 'tilt_caption_depth', [ 'label' => __( 'Depth', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'size' => 20, ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__tilt .ee-gallery__media__content' => 'transform: translateZ({{SIZE}}px);', ], 'condition' => [ 'tilt_enable!' => '', 'tilt_depth!' => '', ], ] ); $this->add_control( 'tilt_scale', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 1.5, 'step' => 0.01, ], ], 'default' => [ 'size' => 1.05, ], 'frontend_available' => true, 'condition' => [ 'tilt_enable' => 'yes', ], ] ); $this->add_control( 'tilt_speed', [ 'label' => __( 'Speed', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 100, 'max' => 1000, 'step' => 50, ], ], 'default' => [ 'size' => 800, ], 'frontend_available' => true, 'condition' => [ 'tilt_enable' => 'yes', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_gallery_layout', [ 'label' => __( 'Layout', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'image_align', [ 'label' => __( 'Horizontal Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'left', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'prefix_class' => 'ee-grid-halign%s--', 'condition' => [ 'masonry_enable' => '', ], ] ); $this->add_responsive_control( 'image_vertical_align', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'top', 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], 'stretch' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-v-align-stretch', ], ], 'prefix_class' => 'ee-grid-align%s--', 'condition' => [ 'masonry_enable' => '', ], ] ); $this->add_responsive_control( 'image_stretch_ratio', [ 'label' => __( 'Image Size Ratio', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '100' ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 200, ], ], 'condition' => [ 'image_vertical_align' => 'stretch', ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:before' => 'padding-bottom: {{SIZE}}%;', ], ] ); $columns_horizontal_margin = is_rtl() ? 'margin-left' : 'margin-right'; $columns_horizontal_padding = is_rtl() ? 'padding-left' : 'padding-right'; $this->add_control( 'image_horizontal_space', [ 'label' => __( 'Horizontal Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'custom', 'options' => [ 'none' => __( 'None', 'elementor-extras' ), 'custom' => __( 'Custom', 'elementor-extras' ), 'overlap' => __( 'Overlap', 'elementor-extras' ), ], 'condition' => [ 'masonry_layout!' => 'mixed', ], ] ); $this->add_responsive_control( 'image_horizontal_spacing', [ 'label' => __( 'Horizontal Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'default' => [ 'size' => 24, ], 'selectors' => [ '{{WRAPPER}} .ee-gallery' => $columns_horizontal_margin . ': -{{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-gallery__item' => $columns_horizontal_padding . ': {{SIZE}}{{UNIT}};', ], 'condition' => [ 'image_horizontal_space' => 'custom', 'masonry_layout!' => 'mixed', ], ] ); $this->add_responsive_control( 'image_overlap', [ 'label' => __( 'Horizontal Overlap', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'default' => [ 'size' => 0, ], 'selectors' => [ '{{WRAPPER}} .ee-gallery' => 'margin-left: {{SIZE}}{{UNIT}}; margin-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-gallery__item .ee-gallery__media' => 'margin-left: -{{SIZE}}{{UNIT}}; margin-right: -{{SIZE}}{{UNIT}};', ], 'condition' => [ 'image_horizontal_space' => 'overlap', 'masonry_layout!' => 'mixed', ], ] ); $this->add_responsive_control( 'image_vertical_spacing', [ 'label' => __( 'Vertical Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'default' => [ 'size' => 24, ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__item .ee-gallery__media' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'masonry_layout!' => 'mixed', ], ] ); $this->add_responsive_control( 'image_mixed_masonry_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'default' => [ 'size' => 24, ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media-wrapper' => 'margin: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-gallery' => 'margin: -{{SIZE}}{{UNIT}};', ], 'condition' => [ 'masonry_enable!' => '', 'masonry_layout' => 'mixed', ], ] ); $this->add_responsive_control( 'overflow', [ 'label' => __( 'Overflow', 'elementor-extras' ), 'description' => __( 'Hiding overflow solves the horizontal scroll issue on mobile devices, but affects shadows and tilt effects which will be hidden outside the grid area.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'separator' => 'before', 'default' => '', 'tablet_default'=> 'yes', 'mobile_default'=> 'yes', 'label_on' => __( 'Hidden', 'elementor-extras' ), 'label_off' => __( 'Visible', 'elementor-extras' ), 'prefix_class' => 'ee-gallery-overflow%s--', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_gallery_images', [ 'label' => __( 'Thumbnails', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'image_border', 'label' => __( 'Image Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-gallery__media-wrapper', 'separator' => '', ] ); $this->add_control( 'image_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'image_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__thumbnail' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_content', [ 'label' => __( 'Captions', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_control( 'align', [ 'label' => __( 'Text Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'text-align: {{VALUE}};', ], 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_control( 'vertical_align', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], ], 'default' => 'bottom', 'prefix_class' => 'ee-media-align--', 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_control( 'horizontal_align', [ 'label' => __( 'Horizontal Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], 'justify' => [ 'title' => __( 'Justify', 'elementor-extras' ), 'icon' => 'eicon-h-align-stretch', ], ], 'default' => 'justify', 'prefix_class' => 'ee-media-align--', 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-gallery__media__caption', 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_control( 'text_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_control( 'text_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'gallery_display_caption' => '', ], 'separator' => 'after', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'text_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-gallery__media__caption', 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_control( 'text_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_instagram_style', [ 'label' => __( 'Instagram', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'gallery_type' => 'instagram', 'gallery_display_caption' => '', ], ] ); $this->add_control( 'insta_counters_heading', [ 'label' => __( 'Counters', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'gallery_type' => 'instagram', 'gallery_display_caption' => '', ], ] ); $this->add_responsive_control( 'insta_counters_align', [ 'label' => __( 'Horizontal Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'label_block' => false, 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-caption__insta' => 'justify-content: {{VALIE}}', ], 'condition' => [ 'gallery_type' => 'instagram', 'gallery_display_caption' => '', ], ] ); $this->add_responsive_control( 'insta_counters_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .ee-caption__insta:not(:first-child)' => 'padding-top: {{SIZE}}px;', ], 'condition' => [ 'gallery_type' => 'instagram', 'gallery_display_caption' => '', ], ] ); $this->add_responsive_control( 'insta_counters_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .ee-caption__insta__counter:not(:first-child)' => 'margin-left: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'gallery_type' => 'instagram', 'gallery_display_caption' => '', ], ] ); $this->add_control( 'insta_icons_heading', [ 'label' => __( 'Icons', 'elementor-extras' ), 'separator' => 'before', 'type' => Controls_Manager::HEADING, ] ); $this->add_responsive_control( 'insta_icons_style', [ 'label' => __( 'Style', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'label_block' => false, 'options' => [ 'solid' => [ 'title' => __( 'Solid', 'elementor-extras' ), 'icon' => 'fa fa-comment', ], 'outline' => [ 'title' => __( 'Outline', 'elementor-extras' ), 'icon' => 'fa fa-comment-o', ], ], 'condition' => [ 'gallery_type' => 'instagram', 'gallery_display_caption' => '', ], ] ); $this->add_responsive_control( 'insta_icons_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .ee-caption__insta__icon' => 'margin-right: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'gallery_type' => 'instagram', 'gallery_display_caption' => '', ], ] ); $this->add_responsive_control( 'insta_icons_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 2, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-caption__insta__icon' => 'font-size: {{SIZE}}em;', ], 'condition' => [ 'gallery_type' => 'instagram', 'gallery_display_caption' => '', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_hover_effects', [ 'label' => __( 'Hover Effects', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'hover_images_heading', [ 'label' => __( 'Images', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'image_transition', 'selector' => '{{WRAPPER}} .ee-gallery__media-wrapper, {{WRAPPER}} .ee-gallery__media__thumbnail img', 'separator' => '', ] ); $this->start_controls_tabs( 'image_style' ); $this->start_controls_tab( 'image_style_default', [ 'label' => __( 'Default', 'elementor-extras' ), ] ); $this->add_responsive_control( 'image_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__thumbnail img' => 'opacity: {{SIZE}}', ], ] ); $this->add_responsive_control( 'image_scale', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 2, 'step'=> 0.01, ], ], 'condition' => [ 'tilt_enable!' => 'yes', ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__thumbnail img' => 'transform: scale({{SIZE}});', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'image_box_shadow', 'selector' => '{{WRAPPER}} .ee-gallery__media-wrapper', 'separator' => '', ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'image_css_filters', 'selector' => '{{WRAPPER}} .ee-gallery__media__thumbnail img', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'image_style_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), ] ); $this->add_responsive_control( 'image_opacity_hover', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__thumbnail img' => 'opacity: {{SIZE}}', ], ] ); $this->add_responsive_control( 'image_scale_hover', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 2, 'step'=> 0.01, ], ], 'condition' => [ 'tilt_enable!' => 'yes', ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__thumbnail img' => 'transform: scale({{SIZE}});', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'image_box_shadow_hover', 'selector' => '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media-wrapper', 'separator' => '', ] ); $this->add_control( 'image_border_color_hover', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media-wrapper' => 'border-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'image_css_filters_hover', 'selector' => '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__thumbnail img', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'hover_overlay_heading', [ 'label' => __( 'Overlay', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'overlay_transition', 'selector' => '{{WRAPPER}} .ee-gallery__media__overlay', ] ); $this->start_controls_tabs( 'overlay_style' ); $this->start_controls_tab( 'overlay_style_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'overlay_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__overlay' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'overlay_blend', [ 'label' => __( 'Blend mode', 'elementor-extras' ), 'description' => __( 'Using blend mode removes the impact of depth properties from the tilt effect.', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'normal', 'options' => [ 'normal' => __( 'Normal', 'elementor-extras' ), 'multiply' => __( 'Multiply', 'elementor-extras' ), 'screen' => __( 'Screen', 'elementor-extras' ), 'overlay' => __( 'Overlay', 'elementor-extras' ), 'darken' => __( 'Darken', 'elementor-extras' ), 'lighten' => __( 'Lighten', 'elementor-extras' ), 'color' => __( 'Color', 'elementor-extras' ), 'color-dodge' => __( 'Color Dodge', 'elementor-extras' ), 'hue' => __( 'Hue', 'elementor-extras' ), ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__overlay' => 'mix-blend-mode: {{VALUE}};', ], ] ); $this->add_control( 'overlay_blend_notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => sprintf( __( 'Please check blend mode support for your browser %1$s here %2$s', 'elementor-extras' ), '<a href="https://caniuse.com/#search=mix-blend-mode" target="_blank">', '</a>' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'condition' => [ 'overlay_blend!' => 'normal' ], ] ); $this->add_responsive_control( 'overlay_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 48, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__overlay' => 'top: {{SIZE}}px; right: {{SIZE}}px; bottom: {{SIZE}}px; left: {{SIZE}}px', ], ] ); $this->add_responsive_control( 'overlay_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__overlay' => 'opacity: {{SIZE}}', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'overlay_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-gallery__media__overlay', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'overlay_style_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'overlay_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__overlay' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'overlay_margin_hover', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 48, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__overlay' => 'top: {{SIZE}}px; right: {{SIZE}}px; bottom: {{SIZE}}px; left: {{SIZE}}px', ], ] ); $this->add_responsive_control( 'overlay_opacity_hover', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__overlay' => 'opacity: {{SIZE}}', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'overlay_border_hover', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__overlay', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'hover_captions_heading', [ 'label' => __( 'Captions', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'content', 'selector' => '{{WRAPPER}} .ee-gallery__media__content, {{WRAPPER}} .ee-gallery__media__caption', 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->update_control( 'content_transition', array( 'default' => 'custom', )); $this->add_control( 'content_effect', [ 'label' => __( 'Effect', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'fade-in' => __( 'Fade In', 'elementor-extras' ), 'fade-out' => __( 'Fade Out', 'elementor-extras' ), 'from-top' => __( 'From Top', 'elementor-extras' ), 'from-right' => __( 'From Right', 'elementor-extras' ), 'from-bottom' => __( 'From Bottom', 'elementor-extras' ), 'from-left' => __( 'From Left', 'elementor-extras' ), 'fade-from-top' => __( 'Fade From Top', 'elementor-extras' ), 'fade-from-right' => __( 'Fade From Right', 'elementor-extras' ), 'fade-from-bottom' => __( 'Fade From Bottom', 'elementor-extras' ), 'fade-from-left' => __( 'Fade From Left', 'elementor-extras' ), 'to-top' => __( 'To Top', 'elementor-extras' ), 'to-right' => __( 'To Right', 'elementor-extras' ), 'to-bottom' => __( 'To Bottom', 'elementor-extras' ), 'to-left' => __( 'To Left', 'elementor-extras' ), 'fade-to-top' => __( 'Fade To Top', 'elementor-extras' ), 'fade-to-right' => __( 'Fade To Right', 'elementor-extras' ), 'fade-to-bottom' => __( 'Fade To Bottom', 'elementor-extras' ), 'fade-to-left' => __( 'Fade To Left', 'elementor-extras' ), ], 'prefix_class' => 'ee-media-effect__content--', 'condition' => [ 'gallery_display_caption' => '', 'tilt_enable!' => 'yes', 'content_transition!' => '', ], ] ); $this->start_controls_tabs( 'caption_style' ); $this->start_controls_tab( 'caption_style_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_control( 'text_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'color: {{VALUE}};', ], 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_control( 'text_background_color', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'background-color: {{VALUE}};', ], 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_control( 'text_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media__caption' => 'opacity: {{SIZE}}', ], 'condition' => [ 'tilt_enable' => 'yes', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'text_box_shadow', 'selector' => '{{WRAPPER}} .ee-gallery__media__caption', 'separator' => '', 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'caption_style_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_control( 'text_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__caption' => 'color: {{VALUE}};', ], 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_control( 'text_background_color_hover', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__caption' => 'background-color: {{VALUE}};', ], 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_control( 'text_opacity_hover', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__caption' => 'opacity: {{SIZE}}', ], 'condition' => [ 'tilt_enable' => 'yes', ], ] ); $this->add_control( 'text_border_color_hover', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__caption' => 'border-color: {{VALUE}};', ], 'condition' => [ 'gallery_display_caption' => '', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'text_box_shadow_hover', 'selector' => '{{WRAPPER}} .ee-gallery__media:hover .ee-gallery__media__caption', 'separator' => '', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 2.1.0 * @return void */ protected function render() { $settings = $this->get_settings(); $this->add_render_attribute( [ 'wrapper' => [ 'class' => 'ee-gallery-wrapper', ], 'gallery' => [ 'class' => [ 'ee-gallery', 'ee-grid', 'ee-grid--gallery', 'ee-gallery__gallery', ], ], 'gallery-thumbnail' => [ 'class' => [ 'ee-media__thumbnail', 'ee-gallery__media__thumbnail', ], ], 'gallery-overlay' => [ 'class' => [ 'ee-media__overlay', 'ee-gallery__media__overlay', ], ], 'gallery-content' => [ 'class' => [ 'ee-media__content', 'ee-gallery__media__content', ], ], 'gallery-caption' => [ 'class' => [ 'wp-caption-text', 'ee-media__content__caption', 'ee-gallery__media__caption', 'ee-caption', 'ee-caption--' . $settings['gallery_type'], ], ], ] ); if ( 'manual' === $settings['gallery_type'] ) { $this->render_gallery(); } elseif ( 'wordpress' === $settings['gallery_type'] ) { $this->render_wp_gallery(); } elseif ( 'instagram' === $settings['gallery_type'] ) { $this->render_instagram_gallery(); } } /** * Render Gallery Start * * Render start tags for gallery wrappers * * @since 2.2.23 * @return void */ protected function render_gallery_start() { ?><div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>> <div <?php echo $this->get_render_attribute_string( 'gallery' ); ?>><?php $this->render_grid_sizer(); } /** * Render Gallery End * * Render end tags for gallery wrappers * * @since 2.2.23 * @return void */ protected function render_gallery_end() { ?></div> </div><?php $this->render_masonry_script(); } /** * Render Gallery * * Render custom gallery * * @since 2.1.0 * @return void */ protected function render_gallery() { $settings = $this->get_settings(); $gallery = $settings['gallery']; if ( ! empty( $settings['gallery_rand'] ) ) { shuffle( $gallery ); } $this->render_gallery_start(); foreach ( $gallery as $index => $item ) { $media_tag = 'figure'; $item_key = $this->get_repeater_setting_key( 'item', 'gallery', $index ); $media_key = $this->get_repeater_setting_key( 'media', 'gallery', $index ); $media_wrapper_key = $this->get_repeater_setting_key( 'media-wrapper', 'gallery', $index ); $this->add_render_attribute( [ $item_key => [ 'class' => [ 'ee-gallery__item', 'ee-grid__item', 'elementor-repeater-item-' . $item['_id'], ], ], $media_key => [ 'class' => [ 'ee-media', 'ee-gallery__media', ], ], $media_wrapper_key => [ 'class' => [ 'ee-media__wrapper', 'ee-gallery__media-wrapper', ], ], ] ); if ( 'yes' === $item['custom_size'] || 'yes' === $item['custom_size_tablet'] || 'yes' === $item['custom_size_mobile'] ) { $this->add_render_attribute( [ $media_key => [ 'class' => 'ee-media--stretch', ], $item_key => [ 'class' => 'ee-grid__item--custom-size', ], ] ); } if ( '' !== $item['link'] ) { $media_tag = 'a'; if ( 'file' === $item['link'] ) { $item_link = $item['image']['url']; if ( $item['image']['id'] ) { $item_link = wp_get_attachment_image_src( $item['image']['id'], 'full' ); $item_link = $item_link[0]; } $slideshow = $settings['lightbox_slideshow'] ? $this->get_id_for_loop() : false; $this->add_lightbox_data_attributes( $media_key, $item['image']['id'], $settings['open_lightbox'], $slideshow ); if ( $this->_is_edit_mode ) { $this->add_render_attribute( $media_key, 'class', 'elementor-clickable' ); } } else if ( 'attachment' === $item['link'] ) { $item_link = get_attachment_link( $item['image']['id'] ); } else if ( 'custom' === $item['link'] ) { if ( ! empty( $item['link_url']['url'] ) ) { $item_link = $item['link_url']['url']; if ( ! empty( $item['link_url']['is_external'] ) ) { $this->add_render_attribute( $media_key, 'target', '_blank' ); } if ( ! empty( $item['link_url']['nofollow'] ) ) { $this->add_render_attribute( $media_key, 'rel', 'nofollow' ); } } } $this->add_render_attribute( $media_key, 'href', $item_link ); } if ( 'yes' === $settings['tilt_enable'] ) { $this->add_render_attribute( $media_wrapper_key, 'class', 'ee-gallery__tilt' ); if ( 'yes' === $settings['tilt_depth'] ) { $this->add_render_attribute( $media_wrapper_key, 'class', 'ee-gallery__tilt--depth' ); } } ?> <div <?php echo $this->get_render_attribute_string( $item_key ); ?>> <<?php echo $media_tag; ?> <?php echo $this->get_render_attribute_string( $media_key ); ?>> <div <?php echo $this->get_render_attribute_string( $media_wrapper_key ); ?>><?php $this->render_image_thumbnail( $item, $index ); $this->render_image_overlay(); $this->render_image_caption( $item, $index ); ?></div> </<?php echo $media_tag; ?>> </div> <?php } $this->render_gallery_end(); } /** * Render WP Gallery * * Render wordpress gallery * * @since 2.1.0 * @return void */ protected function render_wp_gallery() { $settings = $this->get_settings(); $gallery = $this->get_settings_for_display( 'wp_gallery' ); $media_tag = 'figure'; if ( ! empty( $settings['gallery_rand'] ) ) { shuffle( $gallery ); } if ( '' !== $settings['gallery_link'] ) { $media_tag = 'a'; } if ( empty( $gallery ) ) { return; } $this->render_gallery_start(); foreach ( $gallery as $index => $item ) { $gallery_media_key = 'gallery-media' . $index; $gallery_media_wrapper_key = 'gallery-media-wrapper' . $index; $gallery_item_key = 'gallery-item' . $index; $item_url = ( in_array( 'url', $item ) ) ? $item['url'] : ''; $item['image'] = Module::get_image_info( $item['id'], $item_url, $settings['thumbnail_size'] ); $this->add_render_attribute( [ $gallery_media_key => [ 'class' => [ 'ee-media', 'ee-gallery__media', ], ], $gallery_media_wrapper_key => [ 'class' => [ 'ee-media__wrapper', 'ee-gallery__media-wrapper', ], ], $gallery_item_key => [ 'class' => [ 'ee-gallery__item', 'ee-gallery__item--' . ( $index + 1 ), 'ee-grid__item', ], ], ] ); if ( '' !== $settings['gallery_link'] ) { if ( 'file' === $settings['gallery_link'] ) { $item_link = wp_get_attachment_image_src( $item['id'], 'full' ); $item_link = $item_link[0]; $slideshow = $settings['lightbox_slideshow'] ? $this->get_id_for_loop() : false; $this->add_lightbox_data_attributes( $gallery_media_key, $item['id'], $settings['open_lightbox'], $slideshow ); if ( $this->_is_edit_mode ) { $this->add_render_attribute( $gallery_media_key, 'class', 'elementor-clickable' ); } } else if ( 'attachment' === $settings['gallery_link'] ) { $item_link = get_attachment_link( $item['id'] ); } $this->add_render_attribute( $gallery_media_key, 'href', $item_link ); } if ( 'yes' === $settings['tilt_enable'] ) { $this->add_render_attribute( $gallery_media_wrapper_key, 'class', 'ee-gallery__tilt' ); if ( 'yes' === $settings['tilt_depth'] ) { $this->add_render_attribute( $gallery_media_wrapper_key, 'class', 'ee-gallery__tilt--depth' ); } } ?><div <?php echo $this->get_render_attribute_string( $gallery_item_key ); ?>> <<?php echo $media_tag; ?> <?php echo $this->get_render_attribute_string( $gallery_media_key ); ?>> <div <?php echo $this->get_render_attribute_string( $gallery_media_wrapper_key ); ?>><?php $this->render_image_thumbnail( $item, $index ); $this->render_image_overlay(); $this->render_image_caption( $item, $index ); ?></div> </<?php echo $media_tag; ?>> </div><?php } $this->render_gallery_end(); } /** * Render the instagram gallery * * @since 2.1.0 * @return empty */ protected function render_instagram_gallery() { $settings = $this->get_settings(); if ( 'tags' === $settings['insta_display'] && empty( $settings['insta_hashtag'] ) ) { return _e( 'Please enter a hashtag.', 'elementor-extras' ); } if ( 'feed' === $settings['insta_display'] && ! $this->get_insta_access_token() ) { return _e( 'Please enter your Instagram access token.', 'elementor-extras' ); } $media_tag = 'figure'; $icon_style = 'outline' === $this->get_settings( 'insta_icons_style' ) ? '-o' : '' ; $this->add_render_attribute([ 'caption-text' => [ 'class' => 'ee-caption__text', ], 'caption-insta' => [ 'class' => 'ee-caption__insta', ], 'insta-counter-comments' => [ 'class' => [ 'ee-caption__insta__counter', 'ee-caption__insta__counter--comments', ] ], 'insta-counter-comments-icon' => [ 'class' => [ 'fa', 'fa-comment' . $icon_style, 'ee-caption__insta__icon', ] ], 'insta-counter-likes' => [ 'class' => [ 'ee-caption__insta__counter', 'ee-caption__insta__counter--likes', ] ], 'insta-counter-likes-icon' => [ 'class' => [ 'fa', 'fa-heart' . $icon_style, 'ee-caption__insta__icon', ] ], ]); if ( '' !== $settings['gallery_link'] ) { $media_tag = 'a'; } $gallery = $this->get_insta_posts( $settings ); if ( empty( $gallery ) || is_wp_error( $gallery ) ) { $message = is_wp_error( $gallery ) ? $gallery->get_error_message() : esc_html__( 'No Posts Found', 'elementor-extras' ); echo $message; return; } if ( ! empty( $settings['gallery_rand'] ) ) { shuffle( $gallery ); } $this->render_gallery_start(); foreach ( $gallery as $index => $item ) { $item_key = $this->get_repeater_setting_key( 'item', 'gallery', $index ); $media_key = $this->get_repeater_setting_key( 'media', 'gallery', $index ); $image_key = $this->get_repeater_setting_key( 'image', 'gallery', $index ); $media_wrapper_key = $this->get_repeater_setting_key( 'wrapper', 'gallery', $index ); $this->add_render_attribute( [ $item_key => [ 'class' => [ 'ee-gallery__item', 'ee-grid__item', 'elementor-repeater-item-' . $index, ], ], $media_key => [ 'class' => [ 'ee-media', 'ee-gallery__media', ], ], $media_wrapper_key => [ 'class' => [ 'ee-media__wrapper', 'ee-gallery__media-wrapper', ], ], ] ); if ( '' !== $settings['gallery_link'] ) { if ( 'file' === $settings['gallery_link'] ) { $item_link = $this->get_insta_image_url( $item, 'high' ); $this->add_render_attribute( $media_key, [ 'data-elementor-open-lightbox' => $settings['open_lightbox'], 'data-elementor-lightbox-title' => $item['caption'], ] ); if ( $settings['lightbox_slideshow'] ) { $this->add_render_attribute( $media_key, 'data-elementor-lightbox-slideshow', $this->get_id() ); } if ( $this->_is_edit_mode ) { $this->add_render_attribute( $media_key, 'class', 'elementor-clickable' ); } } else if ( 'attachment' === $settings['gallery_link'] ) { $item_link = $item['link']; $this->add_render_attribute( $media_key, 'target', '_blank' ); } $this->add_render_attribute( $media_key, 'href', $item_link ); } if ( 'yes' === $settings['tilt_enable'] ) { $this->add_render_attribute( $media_wrapper_key, 'class', 'ee-gallery__tilt' ); if ( 'yes' === $settings['tilt_depth'] ) { $this->add_render_attribute( $media_wrapper_key, 'class', 'ee-gallery__tilt--depth' ); } } ?><div <?php echo $this->get_render_attribute_string( $item_key ); ?>> <<?php echo $media_tag; ?> <?php echo $this->get_render_attribute_string( $media_key ); ?>> <div <?php echo $this->get_render_attribute_string( $media_wrapper_key ); ?>> <?php $this->render_image_thumbnail( $item, $index ); ?> <?php $this->render_image_overlay(); ?> <?php $this->render_image_caption( $item, $index ); ?> </div> </<?php echo $media_tag; ?>> </div><?php } $this->render_gallery_end(); } /** * Render Grid Sizer * * The sizer for masonry layout mode * * @since 2.1.0 * @return void */ protected function render_grid_sizer() { $settings = $this->get_settings(); if ( 'yes' === $settings['masonry_enable'] && 'yes' !== $settings['parallax_enable'] ) { ?><div class="ee-grid__item ee-grid__item--sizer"></div><?php } } /** * Render Image Thumbnail * * @since 2.1.0 * @return void */ protected function render_image_thumbnail( $item, $index ) { $settings = $this->get_settings(); $thumbnail_url = $this->get_thumbnail_image_url( $item, $settings ); $thumbnail_alt = $this->get_thumbnail_image_alt( $item ); $thumbnail_title = $this->get_thumbnail_image_title( $item ); $image_key = $this->get_repeater_setting_key( 'image', 'gallery', $index ); $this->add_render_attribute( $image_key, 'src', $thumbnail_url ); if ( '' !== $thumbnail_alt ) { $this->add_render_attribute( $image_key, 'alt', $thumbnail_alt ); } if ( '' !== $thumbnail_title ) { $this->add_render_attribute( $image_key, 'title', $thumbnail_title ); } ?><div <?php echo $this->get_render_attribute_string( 'gallery-thumbnail' ); ?>> <img <?php echo $this->get_render_attribute_string( $image_key ); ?> /> </div><?php } /** * Render Image Caption * * @since 2.1.0 * @return void */ protected function render_image_caption( $item, $index ) { $settings = $this->get_settings(); $caption = $this->get_item_caption( $item ); if ( ! $caption ) return; ?><figcaption <?php echo $this->get_render_attribute_string( 'gallery-content' ); ?>> <div <?php echo $this->get_render_attribute_string( 'gallery-caption' ); ?>> <?php echo $caption; ?> </div> </figcaption><?php } /** * Render Image Overlay * * @since 2.1.0 * @return void */ protected function render_image_overlay() { ?><div <?php echo $this->get_render_attribute_string( 'gallery-overlay' ); ?>></div><?php } /** * Get Thumbnail Image URL * * @since 2.1.0 * @return string The url of the attachment */ protected function get_thumbnail_image_url( $item, array $settings ) { if ( $this->is_instagram_gallery() ) { $image_url = $this->get_insta_image_url( $item, $this->get_settings('insta_image_size') ); } else { $image_url = Group_Control_Image_Size::get_attachment_image_src( $item['image']['id'], 'thumbnail', $settings ); } if ( ! $image_url ) { $image_url = $item['image']['url']; } return $image_url; } /** * Get Insta Thumbnail Image URL * * @since 2.2.23 * @return string The url of the instagram post image */ protected function get_insta_image_url( $item, $size = 'high' ) { $thumbnail = $item['thumbnail']; if ( ! empty( $thumbnail[ $size ] ) ) { $image_url = $thumbnail[ $size ]['src']; } else { $image_url = isset( $item['image'] ) ? $item['image'] : ''; } return $image_url; } /** * Get Thumbnail Image Alt Text * * @since 2.1.0 * @return void */ protected function get_thumbnail_image_alt( $item ) { if ( $this->is_instagram_gallery() ) return $item['caption']; return trim( strip_tags( get_post_meta( $item['image']['id'], '_wp_attachment_image_alt', true) ) ); } /** * Get Thumbnail Image Title * * @since 2.1.0 * @return void */ protected function get_thumbnail_image_title( $item ) { if ( $this->is_instagram_gallery() ) return $item['caption']; return trim( strip_tags( get_the_title( $item['image']['id'] ) ) ); } /** * Get Item Caption * * @since 2.1.0 * @return void */ protected function get_item_caption( $item ) { if ( $this->is_instagram_gallery() ) { return $this->get_insta_caption( $item ); } $attachment = get_post( $item['image']['id'] ); return ImageModule::get_image_caption( $attachment, $this->get_settings( 'gallery_caption' ) ); } /** * Get Insta Caption * * @since 2.1.0 * @return void */ protected function get_insta_caption( $item ) { $settings = $this->get_settings(); ob_start(); if ( '' !== $settings['insta_counter_caption'] ) { ?><div <?php echo $this->get_render_attribute_string( 'caption-text' ); ?>><?php echo $item['caption']; ?></div><?php } if ( '' !== $settings['insta_counter_comments'] || '' !== $settings['insta_counter_likes'] ) { ?><div <?php echo $this->get_render_attribute_string( 'caption-insta' ); ?>><?php if ( '' !== $settings['insta_counter_comments'] ) { ?><span <?php echo $this->get_render_attribute_string( 'insta-counter-comments' ); ?>> <i <?php echo $this->get_render_attribute_string( 'insta-counter-comments-icon' ); ?>></i><?php echo $item['comments']; ?> </span><?php } if ( '' !== $settings['insta_counter_likes'] ) { ?><span <?php echo $this->get_render_attribute_string( 'insta-counter-likes' ); ?>> <i <?php echo $this->get_render_attribute_string( 'insta-counter-likes-icon' ); ?>></i><?php echo $item['likes']; ?> </span><?php } ?></div><?php } return ob_get_clean(); } /** * Get Instagram Comments * * @since 2.1.0 * @return void */ protected function get_insta_comments( $item ) { if ( $this->is_instagram_gallery() ) return $item['comments']; } /** * Render Masonry script * * @since 2.1.0 * @return void */ protected function render_masonry_script() { if ( ! $this->_is_edit_mode ) return; if ( 'yes' !== $this->get_settings( 'masonry_enable' ) || 'yes' === $this->get_settings( 'parallax_enable' ) ) return; ?><script type="text/javascript"> jQuery( document ).ready( function( $ ) { $( '.ee-gallery' ).each( function() { var $scope_id = '<?php echo $this->get_id(); ?>', $scope = $( '[data-id="' + $scope_id + '"]' ); // Don't move forward if this is not our widget if ( $(this).closest( $scope ).length < 1 ) { return; } var $gallery = $(this), isotopeArgs = { itemSelector : '.ee-gallery__item', percentPosition : true, hiddenStyle : { opacity : 0, }, }; var $isotope = $gallery.isotope( isotopeArgs ); $isotope.masonry(); $gallery.find('.ee-gallery__item')._resize( function() { $isotope.masonry(); }); $(window).resize( function() { $isotope.masonry(); }); } ); } ); </script><?php } /** * Check if gallery source is Instagram * * @since 2.1.0 * @return string */ public function is_instagram_gallery() { $settings = $this->get_settings(); if ( 'instagram' === $settings['gallery_type'] ) { return true; } return false; } /** * Retrieve Instagram posts. * * @since 2.1.0 * @param array $settings * @return array */ public function get_insta_posts( $settings ) { // $user = $this->get_insta_user_id(); // $user_media = $this->get_insta_user_media( $user['id'] ); // foreach( $user_media['data'] as $media ) { // $media_object = $this->get_insta_media( $media['id'] ); // } $response = $this->get_insta_remote( $this->get_fetch_url() ); if ( is_wp_error( $response ) ) { return $response; } $data = ( 'tags' === $settings['insta_display'] ) ? $this->get_insta_tags_response_data( $response ) : $this->get_insta_feed_response_data( $response ); if ( empty( $data ) ) { return array(); } return $data; } /** * Retrieve response from API * * @since 2.1.0 * @return array|WP_Error */ public function get_insta_remote( $url ) { $response = wp_remote_get( $url, array( 'timeout' => 60, 'sslverify' => false ) ); $response_code = wp_remote_retrieve_response_code( $response ); $result = json_decode( wp_remote_retrieve_body( $response ), true ); if ( 200 !== $response_code ) { $message = is_array( $result ) && isset( $result['error']['message'] ) ? $result['error']['message'] : __( 'No posts found', 'elementor-extras' ); return new \WP_Error( $response_code, $message ); } if ( ! is_array( $result ) ) { return new \WP_Error( 'error', __( 'Data Error', 'elementor-extras' ) ); } return $result; } public function get_insta_user_id() { $result = $this->get_insta_remote( $this->get_user_url() ); return $result; } public function get_insta_user_media( $user_id ) { $result = $this->get_insta_remote( $this->get_user_media_url( $user_id ) ); return $result; } public function get_insta_media( $media_id ) { $result = $this->get_insta_remote( $this->get_media_url( $media_id ) ); return $result; } /** * Retrieve a grab URL. * * @since 2.1.0 * @return string */ public function get_fetch_url() { $settings = $this->get_settings(); if ( 'tags' == $settings['insta_display'] ) { $url = sprintf( $this->get_tags_endpoint(), $settings['insta_hashtag'] ); $url = add_query_arg( array( '__a' => 1 ), $url ); } else if ( 'feed' == $settings['insta_display'] ) { $url = $this->get_feed_endpoint(); $url = add_query_arg( [ 'fields' => 'id,media_type,media_url,thumbnail_url,permalink,caption,likes_count,likes', 'access_token' => $this->get_insta_access_token(), ], $url ); } return $url; } public function get_user_url() { $url = $this->get_user_endpoint(); $url = add_query_arg( [ 'access_token' => $this->get_insta_access_token(), // 'fields' => 'media.limit(10){comments_count,like_count,likes,likes_count,media_url,permalink,caption}', ], $url ); return $url; } public function get_user_media_url( $user_id ) { $url = sprintf( $this->get_user_media_endpoint(), $user_id ); $url = add_query_arg( [ 'access_token' => $this->get_insta_access_token(), 'fields' => 'id,like_count', ], $url ); return $url; } public function get_media_url( $media_id ) { $url = sprintf( $this->get_media_endpoint(), $media_id ); $url = add_query_arg( [ 'access_token' => $this->get_insta_access_token(), 'fields' => 'id,media_type,media_url,timestamp,like_count', ], $url ); return $url; } /** * Retrieve a URL for own photos. * * @since 2.1.0 * @return string */ public function get_feed_endpoint() { return $this->insta_official_api_url . 'me/media/'; } /** * Retrieve a URL for photos by hashtag. * * @since 2.1.0 * @return string */ public function get_tags_endpoint() { return $this->insta_api_url . 'explore/tags/%s/'; } public function get_user_endpoint() { return $this->insta_official_api_url . 'me/'; } public function get_user_media_endpoint() { return $this->insta_official_api_url . '%s/media/'; } public function get_media_endpoint() { return $this->insta_official_api_url . '%s/'; } /** * Get data from response * * @param $response * @since 2.1.0 * * @return array */ public function get_insta_feed_response_data( $response ) { if ( ! array_key_exists( 'data', $response ) ) { // Avoid PHP notices return; } $response_posts = $response['data']; if ( empty( $response_posts ) ) { return array(); } $return_data = array(); $posts = array_slice( $response_posts, 0, $this->get_settings('insta_posts_counter'), true ); foreach ( $posts as $post ) { $_post = array(); $_post['id'] = $post['id']; $_post['link'] = $post['permalink']; $_post['caption'] = ''; $_post['image'] = 'VIDEO' === $post['media_type'] ? $post['thumbnail_url'] : $post['media_url']; $_post['comments'] = ! empty( $post['comments_count'] ) ? $post['comments_count'] : 0; $_post['likes'] = ! empty( $post['likes_count'] ) ? $post['likes_count'] : 0;; $_post['thumbnail'] = $this->get_insta_feed_thumbnail_data( $post ); if ( ! empty( $post['caption'] ) ) { $_post['caption'] = wp_html_excerpt( $post['caption'], $this->get_settings('insta_caption_length'), '…' ); } $return_data[] = $_post; } return $return_data; } /** * Get thumbnail data from response data * * @param $post * @since 2.1.0 * * @return array */ public function get_insta_feed_thumbnail_data( $post ) { $thumbnail = array( 'thumbnail' => false, 'low' => false, 'standard' => false, 'high' => false, ); if ( ! empty( $post['images'] ) && is_array( $post['images'] ) ) { $data = $post['images']; $thumbnail['thumbnail'] = [ 'src' => $data['thumbnail']['url'], 'config_width' => $data['thumbnail']['width'], 'config_height' => $data['thumbnail']['height'], ]; $thumbnail['low'] = [ 'src' => $data['low_resolution']['url'], 'config_width' => $data['low_resolution']['width'], 'config_height' => $data['low_resolution']['height'], ]; $thumbnail['standard'] = [ 'src' => $data['standard_resolution']['url'], 'config_width' => $data['standard_resolution']['width'], 'config_height' => $data['standard_resolution']['height'], ]; $thumbnail['high'] = $thumbnail['standard']; } return $thumbnail; } /** * Get data from response * * @param $response * @since 2.1.0 * * @return array */ public function get_insta_tags_response_data( $response ) { $settings = $this->get_settings(); $response_posts = $response['graphql']['hashtag']['edge_hashtag_to_media']['edges']; if ( empty( $response_posts ) ) { $response_posts = $response['graphql']['hashtag']['edge_hashtag_to_top_posts']['edges']; } $return_data = array(); $posts = array_slice( $response_posts, 0, $settings['insta_posts_counter'], true ); foreach ( $posts as $post ) { $_post = array(); $_post['link'] = sprintf( $this->insta_api_url . 'p/%s/', $post['node']['shortcode'] ); $_post['caption'] = ''; $_post['comments'] = $post['node']['edge_media_to_comment']['count']; $_post['likes'] = $post['node']['edge_liked_by']['count']; $_post['thumbnail'] = $this->get_insta_tags_thumbnail_data( $post ); if ( isset( $post['node']['edge_media_to_caption']['edges'][0]['node']['text'] ) ) { $_post['caption'] = wp_html_excerpt( $post['node']['edge_media_to_caption']['edges'][0]['node']['text'], $settings['insta_caption_length'], '…' ); } $return_data[] = $_post; } return $return_data; } /** * Generate thumbnail resources. * * @since 2.1.0 * @param $post_data * * @return array */ public function get_insta_tags_thumbnail_data( $post ) { $post = $post['node']; $thumbnail = array( 'thumbnail' => false, 'low' => false, 'standard' => false, 'high' => false, ); if ( is_array( $post['thumbnail_resources'] ) && ! empty( $post['thumbnail_resources'] ) ) { foreach ( $post['thumbnail_resources'] as $key => $resources_data ) { if ( 150 === $resources_data['config_width'] ) { $thumbnail['thumbnail'] = $resources_data; continue; } if ( 320 === $resources_data['config_width'] ) { $thumbnail['low'] = $resources_data; continue; } if ( 640 === $resources_data['config_width'] ) { $thumbnail['standard'] = $resources_data; continue; } } } if ( ! empty( $post['display_url'] ) ) { $thumbnail['high'] = array( 'src' => $post['display_url'], 'config_width' => $post['dimensions']['width'], 'config_height' => $post['dimensions']['height'], ) ; } return $thumbnail; } /** * Get Instagram access token. * * @since 2.1.0 * @return string */ public function get_insta_access_token() { $settings = $this->get_settings_for_display(); if ( ! $this->insta_access_token ) { $custom_access_token = $settings['access_token']; if ( '' !== trim( $custom_access_token ) ) { $this->insta_access_token = $custom_access_token; } else { $this->insta_access_token = $this->get_insta_global_access_token(); } } return $this->insta_access_token; } /** * Get Instagram access token from wp options. * * @since 2.2.23 * @return string */ public function get_insta_global_access_token() { return \ElementorExtras\ElementorExtrasPlugin::$instance->settings->get_option( 'instagram_access_token', 'elementor_extras_apis', false ); } /** * Content Template * * Javascript content template for quick rendering * * @since 2.1.0 * @return void */ protected function content_template() {} } gallery/module.php 0000644 00000003622 15112147616 0010210 0 ustar 00 <?php namespace ElementorExtras\Modules\Gallery; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Gallery\Module * * @since 1.6.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.6.0 * @return string */ public function get_name() { return 'gallery'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.6.0 * @return array */ public function get_widgets() { return [ 'Gallery', 'Gallery_Slider', ]; } /** * Get Link URL * * Get the attachment link url from the settings * * @since 1.6.0 * @return array */ public static function get_link_url( $attachment, $instance ) { if ( 'none' === $instance['link_to'] ) { return false; } if ( 'custom' === $instance['link_to'] ) { if ( empty( $instance['link']['url'] ) ) { return false; } return $instance['link']; } return [ 'url' => wp_get_attachment_url( $attachment['id'] ), ]; } /** * Get Image Info * * Get image information as array * * @since 1.6.0 * @return array */ public static function get_image_info( $image_id, $image_url = '', $image_size = '' ) { if ( ! $image_id ) return false; $info = []; if ( ! empty( $image_id ) ) { // Existing attachment $attachment = get_post( $image_id ); if ( ! $attachment ) return; $info['id'] = $image_id; $info['url'] = $image_url; $info['image'] = wp_get_attachment_image( $attachment->ID, $image_size, true ); $info['caption'] = $attachment->post_excerpt; } else { // Placeholder image, most likely if ( empty( $image_url ) ) return; $info['id'] = false; $info['url'] = $image_url; $info['image'] = '<img src="' . $image_url . '" />'; $info['caption'] = ''; } return $info; } } heading/widgets/heading.php 0000644 00000025231 15112147616 0011730 0 ustar 00 <?php namespace ElementorExtras\Modules\Heading\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Group_Control_Long_Shadow; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Background; use Elementor\Modules\DynamicTags\Module as TagsModule; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Heading * * @since 0.1.0 */ class Heading extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 0.1.0 * @return string */ public function get_name() { return 'heading-extended'; } /** * Get Title * * Get the title of the widget * * @since 0.1.0 * @return string */ public function get_title() { return __( 'Heading Extra', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 0.1.0 * @return string */ public function get_icon() { return 'nicon nicon-heading-extended'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 0.1.0 * @return array */ public function get_script_depends() { return [ 'jquery-long-shadow' ]; } /** * Register Widget Controls * * @since 0.1.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_title', [ 'label' => __( 'Title', 'elementor-extras' ), ] ); $this->add_control( 'title', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::TEXTAREA, 'placeholder' => __( 'Enter your title', 'elementor-extras' ), 'default' => __( 'This is heading element', 'elementor-extras' ), 'dynamic' => [ 'active' => true, ], ] ); $this->add_control( 'link', [ 'label' => __( 'Link', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'placeholder' => esc_url( home_url( '/' ) ), 'default' => [ 'url' => '', ], 'dynamic' => [ 'active' => true, ], 'separator' => 'before', ] ); $this->add_control( 'size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), 'small' => __( 'Small', 'elementor-extras' ), 'medium' => __( 'Medium', 'elementor-extras' ), 'large' => __( 'Large', 'elementor-extras' ), 'xl' => __( 'XL', 'elementor-extras' ), 'xxl' => __( 'XXL', 'elementor-extras' ), ], ] ); $this->add_control( 'header_size', [ 'label' => __( 'HTML Tag', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => __( 'H1', 'elementor-extras' ), 'h2' => __( 'H2', 'elementor-extras' ), 'h3' => __( 'H3', 'elementor-extras' ), 'h4' => __( 'H4', 'elementor-extras' ), 'h5' => __( 'H5', 'elementor-extras' ), 'h6' => __( 'H6', 'elementor-extras' ), 'div' => __( 'div', 'elementor-extras' ), 'span' => __( 'span', 'elementor-extras' ), 'p' => __( 'p', 'elementor-extras' ), ], 'default' => 'h1', ] ); $this->add_responsive_control( 'align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], 'justify' => [ 'title' => __( 'Justified', 'elementor-extras' ), 'icon' => 'fa fa-align-justify', ], ], 'default' => '', 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'view', [ 'label' => __( 'View', 'elementor-extras' ), 'type' => Controls_Manager::HIDDEN, 'default' => 'traditional', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_title_fill', [ 'label' => __( 'Fill', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'title_fill', [ 'label' => __( 'Fill', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'solid' => __( 'Color', 'elementor-extras' ), 'gradient' => __( 'Background', 'elementor-extras' ), ], 'default' => 'solid', 'prefix_class' => 'ee-heading--' ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'gradient', 'types' => [ 'gradient', 'classic' ], 'selector' => '{{WRAPPER}} .ee-heading__text', 'default' => 'gradient', 'condition' => [ 'title_fill' => 'gradient' ] ] ); $this->add_control( 'title_color', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-heading__text' => 'color: {{VALUE}};', ], 'condition' => [ 'title_fill' => 'solid' ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_title_type', [ 'label' => __( 'Typography', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'typography', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, ], 'selector' => '{{WRAPPER}} .ee-heading', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_title_shadow', [ 'label' => __( 'Shadow', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'title_classic_shadow', 'selector' => '{{WRAPPER}} .ee-heading__text-shadow', ] ); $this->add_group_control( Group_Control_Long_Shadow::get_type(), [ 'name' => 'title_long_shadow', 'selector' => '{{WRAPPER}} .ee-heading__long-shadow', ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 0.1.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); if ( empty( $settings['title'] ) ) return; $this->add_render_attribute( [ 'heading' => [ 'class' => 'ee-heading', 'data-title' => $settings['title'], ], ] ); if ( ! empty( $settings['size'] ) ) { $this->add_render_attribute( 'heading', 'class', 'elementor-size-' . $settings['size'] ); } if ( ! empty( $settings['link']['url'] ) ) { $this->add_render_attribute( 'link', 'href', $settings['link']['url'] ); if ( $settings['link']['is_external'] ) { $this->add_render_attribute( 'link', 'target', '_blank' ); } if ( ! empty( $settings['link']['nofollow'] ) ) { $this->add_render_attribute( 'link', 'rel', 'nofollow' ); } } if ( ! empty( $settings['link']['url'] ) ) { ?><a <?php echo $this->get_render_attribute_string( 'link' ); ?>><?php } ?> <<?php echo $settings['header_size']; ?> <?php echo $this->get_render_attribute_string('heading'); ?>><?php echo $this->render_heading_text(); echo $this->render_heading_text_shadow(); echo $this->render_heading_long_shadow(); ?></<?php echo $settings['header_size']; ?>> <?php if ( ! empty( $settings['link']['url'] ) ) { ?></a><?php } } /** * Render Heading Text * * @since 0.1.0 * @return void */ protected function render_heading_text() { $this->add_render_attribute( 'heading-text', 'class', 'ee-heading__text' ); ?><span <?php echo $this->get_render_attribute_string( 'heading-text' ); ?>> <?php echo $this->parse_text_editor( $this->get_settings_for_display('title') ); ?> </span><?php } /** * Render Heading Text Shadow * * @since 0.1.0 * @return void */ protected function render_heading_text_shadow() { if ( '' === $this->get_settings('title_classic_shadow_text_shadow_type') ) return; $this->add_render_attribute( 'heading-text-shadow', 'class', 'ee-heading__text-shadow' ); ?><span <?php echo $this->get_render_attribute_string( 'heading-text-shadow' ); ?>> <?php echo $this->parse_text_editor( $this->get_settings_for_display('title') ); ?> </span><?php } /** * Render Heading Long Shadow * * @since 0.1.0 * @return void */ protected function render_heading_long_shadow() { if ( 'yes' !== $this->get_settings_for_display('title_long_shadow_enable') ) return; $this->add_render_attribute( 'heading-long-shadow', 'class', 'ee-heading__long-shadow' ); ?><span <?php echo $this->get_render_attribute_string( 'heading-long-shadow' ); ?>> <?php echo $this->parse_text_editor( $this->get_settings_for_display('title') ); ?> </span><?php } /** * Content Template * * Javascript content template for quick rendering * * @since 0.1.0 * @return void */ protected function content_template() { ?><# view.addRenderAttribute( { 'heading' : { 'class' : [ 'ee-heading' ], 'data-title' : settings.title, }, 'heading-text' : { 'class' : [ 'ee-heading__text', ], }, 'heading-text-shadow' : { 'class' : [ 'ee-heading__text-shadow', ], }, 'heading-long-shadow' : { 'class' : [ 'ee-heading__long-shadow', ], }, } ); if ( '' !== settings.size ) { view.addRenderAttribute( 'heading', 'class', 'elementor-size-' + settings.size ); } if ( '' !== settings.link.url ) { #><a href="{{ settings.link.url }}"><# } #> <{{ settings.header_size }} {{{ view.getRenderAttributeString( 'heading' ) }}}> <span {{{ view.getRenderAttributeString( 'heading-text' ) }}}>{{{ settings.title }}}</span> <span {{{ view.getRenderAttributeString( 'heading-text-shadow' ) }}}>{{{ settings.title }}}</span> <# if ( '' !== settings.title_long_shadow_enable ) { #><span {{{ view.getRenderAttributeString( 'heading-long-shadow' ) }}}>{{{ settings.title }}}</span><# } #></{{ settings.header_size }}> <# if ( '' !== settings.link.url ) { #></a><# } #><?php } } heading/widgets/text-divider.php 0000644 00000036330 15112147616 0012743 0 ustar 00 <?php namespace ElementorExtras\Modules\Heading\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Utils; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Background; use Elementor\Group_Control_Border; use Elementor\Group_Control_Box_Shadow; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Text_Divider * * @since 0.1.0 */ class Text_Divider extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 0.1.0 * @return string */ public function get_name() { return 'text-divider'; } /** * Get Title * * Get the title of the widget * * @since 0.1.0 * @return string */ public function get_title() { return __( 'Text Divider', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 0.1.0 * @return string */ public function get_icon() { return 'nicon nicon-divider-text'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 0.1.0 * @return array */ public function get_script_depends() { return [ 'elementor-extras' ]; } /** * Register Widget Controls * * @since 0.1.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_text', [ 'label' => __( 'General', 'elementor-extras' ), ] ); $this->add_control( 'text', [ 'label' => __( 'Text', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Text Divider', 'elementor-extras' ), 'dynamic' => [ 'active'=> true ], ] ); $this->add_control( 'text_html_tag', [ 'label' => __( 'HTML Tag', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => __( 'H1', 'elementor-extras' ), 'h2' => __( 'H2', 'elementor-extras' ), 'h3' => __( 'H3', 'elementor-extras' ), 'h4' => __( 'H4', 'elementor-extras' ), 'h5' => __( 'H5', 'elementor-extras' ), 'h6' => __( 'H6', 'elementor-extras' ), 'div' => __( 'div', 'elementor-extras' ), 'span' => __( 'span', 'elementor-extras' ), 'p' => __( 'p', 'elementor-extras' ), ], 'default' => 'h6', ] ); $this->add_control( 'link', [ 'label' => __( 'Link', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'placeholder' => esc_url( home_url( '/' ) ), 'default' => [ 'url' => '', ], 'dynamic' => [ 'active'=> true ], ] ); $this->add_responsive_control( 'horizontal_align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-text-divider' => 'justify-content: {{VALUE}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_text_style', [ 'label' => __( 'Text', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'align', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'prefix_class' => 'ee-text-divider--' ] ); $this->add_control( 'text_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}} .ee-text-divider__text' => 'text-align: {{VALUE}};', ], ] ); $this->add_responsive_control( 'text_space', [ 'label' => __( 'Text Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 6, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-text-divider__text' => 'margin-left: {{SIZE}}{{UNIT}}; margin-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}}.ee-text-divider--left .ee-text-divider__text' => 'margin-left: 0; margin-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}}.ee-text-divider--right .ee-text-divider__text' => 'margin-right: 0; margin-left: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'text-padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .ee-text-divider__text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'text_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em' ], 'selectors' => [ '{{WRAPPER}} .ee-text-divider__text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'text_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_SECONDARY, ], 'selectors' => [ '{{WRAPPER}} .ee-text-divider__text, {{WRAPPER}} .ee-text-divider__text a' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'text_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-text-divider__text' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'text_border', 'label' => __( 'Text Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-text-divider__text', ] ); $this->add_control( 'text_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-text-divider__text' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'text_box_shadow', 'selector' => '{{WRAPPER}} .ee-text-divider__text', ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'text_shadow', 'selector' => '{{WRAPPER}} .ee-text-divider__text', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'text_typography', 'selector' => '{{WRAPPER}} .ee-text-divider__text', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_SECONDARY, ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_divider_style', [ 'label' => __( 'Divider', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'vertical_align', [ 'label' => __( 'Vertical Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'flex-start' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'center' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'flex-end' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], 'baseline' => [ 'title' => __( 'Baseline', 'elementor-extras' ), 'icon' => 'nicon nicon-v-align-baseline', ], ], 'selectors' => [ '{{WRAPPER}} .ee-text-divider' => 'align-items: {{VALUE}};', ], ] ); $this->add_control( 'divider_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1000, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, ], ], 'selectors' => [ '{{WRAPPER}} .ee-text-divider__before' => 'max-width: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-text-divider__after' => 'max-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'divider_height', [ 'label' => __( 'Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-text-divider__before' => 'height: {{SIZE}}{{UNIT}}', '{{WRAPPER}} .ee-text-divider__after' => 'height: {{SIZE}}{{UNIT}}', ], ] ); $this->add_control( 'divider_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_SECONDARY, ], 'selectors' => [ '{{WRAPPER}} .ee-text-divider__divider' => 'background-color: {{VALUE}};', ], ] ); $this->start_controls_tabs( 'divider_style_tabs' ); $this->start_controls_tab( 'divider_before_tab', [ 'label' => __( 'Before', 'elementor-extras' ), 'condition' => [ 'align!' => 'left', ] ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'divider_before_background', 'types' => [ 'none', 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .ee-text-divider__divider.ee-text-divider__before', 'condition' => [ 'align!' => 'left' ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'divider_after_tab', [ 'label' => __( 'After', 'elementor-extras' ), 'condition' => [ 'align!' => 'right' ] ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'divider_after_background', 'types' => [ 'none', 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .ee-text-divider__divider.ee-text-divider__after', 'condition' => [ 'align!' => 'right' ] ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 0.1.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); $has_link = false; $this->add_render_attribute( [ 'wrapper' => [ 'class' => 'ee-text-divider' ], 'text' => [ 'class' => 'ee-text-divider__text' ], 'before' => [ 'class' => [ 'ee-text-divider__divider', 'ee-text-divider__before', ], ], 'after' => [ 'class' => [ 'ee-text-divider__divider', 'ee-text-divider__after', ], ], ] ); $this->add_inline_editing_attributes( 'text', 'basic' ); if ( ! empty( $settings['link']['url'] ) ) { $has_link = true; $this->add_render_attribute( 'link', 'href', $settings['link']['url'] ); if ( $settings['link']['is_external'] ) { $this->add_render_attribute( 'link', 'target', '_blank' ); } if ( ! empty( $settings['link']['nofollow'] ) ) { $this->add_render_attribute( 'link', 'rel', 'nofollow' ); } } ?> <div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>> <div <?php echo $this->get_render_attribute_string( 'before' ); ?>></div> <<?php echo $settings['text_html_tag']; ?> <?php echo $this->get_render_attribute_string( 'text' ); ?>> <?php if ( $has_link ) { ?><a <?php echo $this->get_render_attribute_string( 'link' ); ?>><?php } ?> <?php echo $this->parse_text_editor( $settings['text'] ) ?> <?php if ( $has_link ) { ?></a><?php } ?> </<?php echo $settings['text_html_tag']; ?>> <div <?php echo $this->get_render_attribute_string( 'after' ); ?>></div> </div> <?php } /** * Content Template * * Javascript content template for quick rendering * * @since 0.1.0 * @return void */ protected function content_template() { ?><# var has_link = false; view.addRenderAttribute( { 'wrapper' : { 'class' : 'ee-text-divider', }, 'text' : { 'class' : [ 'ee-text-divider__text', 'elementor-inline-editing', ], 'data-elementor-inline-editing-toolbar' : 'basic', 'data-elementor-setting-key' : 'text', }, 'before' : { class : [ 'ee-text-divider__divider', 'ee-text-divider__before', ], }, 'after' : { class : [ 'ee-text-divider__divider', 'ee-text-divider__after', ], }, } ); if ( settings.link.url ) { has_link = true; view.addRenderAttribute( 'link', 'href', settings.link.url ); } #><div <div {{{ view.getRenderAttributeString( 'wrapper' ) }}}> <div {{{ view.getRenderAttributeString( 'before' ) }}}></div> <{{ settings.text_html_tag }} {{{ view.getRenderAttributeString( 'text' ) }}}> <# if ( has_link ) { #><a {{{ view.getRenderAttributeString( 'link' ) }}}><# } #> {{{ settings.text }}} <# if ( has_link ) { #></a><# } #> </{{ settings.text_html_tag }}> <div {{{ view.getRenderAttributeString( 'after' ) }}}></div> </div> <?php } /** * Adds the current widget's fields to WPML translatable widgets * * @access public * @since 1.8.0 * @return array */ public function wpml_widgets_to_translate_filter( $widgets ) { $widgets[ $this->get_name() ] = [ 'conditions' => [ 'widgetType' => $this->get_name() ], 'fields' => [ [ 'field' => 'text', 'type' => __( 'Text Divider: heading', 'elementor-extras' ), 'editor_type' => 'LINE' ], ], ]; return $widgets; } } heading/module.php 0000644 00000001152 15112147616 0010144 0 ustar 00 <?php namespace ElementorExtras\Modules\Heading; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Heading\Module * * @since 1.6.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.6.0 * @return string */ public function get_name() { return 'heading'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.6.0 * @return array */ public function get_widgets() { return [ 'Heading', 'Text_Divider' ]; } } hotspots/widgets/hotspots.php 0000644 00000117210 15112147616 0012477 0 ustar 00 <?php namespace ElementorExtras\Modules\Hotspots\Widgets; // Extras for Elementor Classes use ElementorExtras\Utils as ExtrasUtils; use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Icons_Manager; use Elementor\Controls_Manager; use Elementor\Utils; use Elementor\Repeater; use Elementor\Group_Control_Border; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Css_Filter; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Hotspots * * @since 0.1.0 */ class Hotspots extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 0.1.0 * @return string */ public function get_name() { return 'hotspots'; } /** * Get Title * * Get the title of the widget * * @since 0.1.0 * @return string */ public function get_title() { return __( 'Hotspots', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 0.1.0 * @return string */ public function get_icon() { return 'nicon nicon-hotspots'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 0.1.0 * @return array */ public function get_script_depends() { return [ 'hotips', 'resize', ]; } /** * Register Widget Controls * * @since 0.1.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_image', [ 'label' => __( 'Image', 'elementor-extras' ), ] ); $this->add_control( 'image', [ 'label' => __( 'Choose Image', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true ], 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'image', // Actually its `image_size` 'label' => __( 'Image Size', 'elementor-extras' ), 'default' => 'large', ] ); $this->add_responsive_control( 'align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'view', [ 'label' => __( 'View', 'elementor-extras' ), 'type' => Controls_Manager::HIDDEN, 'default' => 'traditional', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_hotspots', [ 'label' => __( 'Hotspots', 'elementor-extras' ), 'condition' => [ 'image[url]!' => '', ] ] ); $repeater = new Repeater(); $repeater->start_controls_tabs( 'hotspots_repeater' ); $repeater->start_controls_tab( 'tab_content', [ 'label' => __( 'Content', 'elementor-extras' ) ] ); $repeater->add_control( 'hotspot', [ 'label' => __( 'Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'text', 'options' => [ 'text' => __( 'Text', 'elementor-extras' ), 'icon' => __( 'Icon', 'elementor-extras' ), ], ] ); $repeater->add_control( 'text', [ 'default' => __( 'X', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'label' => __( 'Text', 'elementor-extras' ), 'separator' => 'none', 'dynamic' => [ 'active' => true, ], 'condition' => [ 'hotspot' => 'text' ] ] ); $repeater->add_control( 'selected_icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'icon', 'skin' => 'inline', 'label_block' => false, 'condition' => [ 'hotspot' => 'icon' ], ] ); $repeater->add_control( 'link', [ 'label' => __( 'Link', 'elementor-extras' ), 'description' => __( 'Active only when tolltips\' Trigger is set to Hover or if tooltip is disabled responsively, below a certain breakpoint.', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'label_block' => false, 'dynamic' => [ 'active' => true, ], 'placeholder' => esc_url( home_url( '/' ) ), 'frontend_available' => true, ] ); $repeater->add_control( 'content', [ 'label' => __( 'Tooltip Content', 'elementor-extras' ), 'type' => Controls_Manager::WYSIWYG, 'dynamic' => [ 'active' => true, ], 'default' => __( 'I am a tooltip for a hotspot', 'elementor-extras' ), ] ); $repeater->add_control( '_item_id', [ 'label' => __( 'CSS ID', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'dynamic' => [ 'active' => true ], 'label_block' => true, 'title' => __( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor-extras' ), ] ); $repeater->add_control( 'css_classes', [ 'label' => __( 'CSS Classes', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'prefix_class' => '', 'dynamic' => [ 'active' => true ], 'label_block' => true, 'title' => __( 'Add your custom class WITHOUT the dot. e.g: my-class', 'elementor-extras' ), ] ); $repeater->end_controls_tab(); $repeater->start_controls_tab( 'tab_style', [ 'label' => __( 'Style', 'elementor-extras' ) ] ); $repeater->add_control( 'default', [ 'label' => __( 'Default', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $repeater->add_control( 'color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-hotspot__wrapper' => 'color: {{VALUE}};', ], ] ); $repeater->add_control( 'background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-hotspot__wrapper' => 'background-color: {{VALUE}};', '{{WRAPPER}} {{CURRENT_ITEM}} .ee-hotspot__wrapper:before' => 'background-color: {{VALUE}};', ], ] ); $repeater->add_responsive_control( 'opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.1, ], ], 'separator' => 'after', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.ee-hotspot' => 'opacity: {{SIZE}};', ], ] ); $repeater->add_control( 'hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $repeater->add_control( 'color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}:hover .ee-hotspot__wrapper' => 'color: {{VALUE}};', ], ] ); $repeater->add_control( 'background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}:hover .ee-hotspot__wrapper' => 'background-color: {{VALUE}};', '{{WRAPPER}} {{CURRENT_ITEM}}:hover .ee-hotspot__wrapper:before' => 'background-color: {{VALUE}};', ], ] ); $repeater->add_responsive_control( 'opacity_hover', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.ee-hotspot:hover' => 'opacity: {{SIZE}};', ], ] ); $repeater->end_controls_tab(); $repeater->start_controls_tab( 'tab_position', [ 'label' => __( 'Position', 'elementor-extras' ) ] ); $repeater->add_control( '_position_horizontal', [ 'label' => __( 'Horizontal position (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 50, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => 'left: {{SIZE}}%;', ], ] ); $repeater->add_control( '_position_vertical', [ 'label' => __( 'Vertical position (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 50, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}' => 'top: {{SIZE}}%;', ], ] ); $repeater->add_control( 'tooltips_heading', [ 'label' => __( 'Tooltips', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $repeater->add_control( 'tooltip_position', [ 'label' => __( 'Show to', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Global', 'elementor-extras' ), 'bottom' => __( 'Bottom', 'elementor-extras' ), 'left' => __( 'Left', 'elementor-extras' ), 'top' => __( 'Top', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], ] ); $repeater->add_control( 'tooltip_arrow_position_h', [ 'label' => __( 'Show at', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Default', 'elementor-extras' ), 'center' => __( 'Center', 'elementor-extras' ), 'left' => __( 'Left', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'condition' => [ 'tooltip_position' => [ 'top', 'bottom' ], ], ] ); $repeater->add_control( 'tooltip_arrow_position_v', [ 'label' => __( 'Show at', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Default', 'elementor-extras' ), 'center' => __( 'Center', 'elementor-extras' ), 'bottom' => __( 'Bottom', 'elementor-extras' ), 'top' => __( 'Top', 'elementor-extras' ), ], 'condition' => [ 'tooltip_position' => [ 'left', 'right' ], ], ] ); $repeater->end_controls_tab(); $repeater->end_controls_tabs(); $this->add_control( 'hotspots', [ 'label' => __( 'Hotspots', 'elementor-extras' ), 'type' => Controls_Manager::REPEATER, 'default' => [ [ 'text' => '1', ], [ 'text' => '2', ], ], 'fields' => $repeater->get_controls(), 'title_field' => '{{{ text }}}', 'condition' => [ 'image[url]!' => '', ] ] ); $this->end_controls_section(); $this->start_controls_section( 'section_tooltips', [ 'label' => __( 'Tooltips', 'elementor-extras' ), 'condition' => [ 'image[url]!' => '', ] ] ); $this->add_responsive_control( 'trigger', [ 'label' => __( 'Trigger', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'mouseenter', 'tablet_default' => 'click_target', 'mobile_default' => 'click_target', 'options' => [ 'mouseenter' => __( 'Mouse Over', 'elementor-extras' ), 'click_target' => __( 'Click Target', 'elementor-extras' ), 'load' => __( 'Page Load', 'elementor-extras' ), ], 'condition' => [ 'image[url]!' => '', ], 'frontend_available' => true ] ); $this->add_responsive_control( '_hide', [ 'label' => __( 'Hide on', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'mouseleave', 'tablet_default' => 'click_out', 'mobile_default' => 'click_out', 'options' => [ 'mouseleave' => __( 'Mouse Leave', 'elementor-extras' ), 'click_out' => __( 'Click Outside', 'elementor-extras' ), 'click_target' => __( 'Click Target', 'elementor-extras' ), 'click_any' => __( 'Click Anywhere', 'elementor-extras' ), ], 'condition' => [ 'image[url]!' => '', ], 'frontend_available' => true ] ); $this->add_control( 'position', [ 'label' => __( 'Show to', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'bottom', 'options' => [ 'bottom' => __( 'Bottom', 'elementor-extras' ), 'left' => __( 'Left', 'elementor-extras' ), 'top' => __( 'Top', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'condition' => [ 'image[url]!' => '', ], 'frontend_available' => true ] ); $this->add_control( 'arrow_position_h', [ 'label' => __( 'Show at', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'center', 'options' => [ 'center' => __( 'Center', 'elementor-extras' ), 'left' => __( 'Left', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'condition' => [ 'image[url]!' => '', 'position' => [ 'top', 'bottom' ], ], 'frontend_available' => true ] ); $this->add_control( 'arrow_position_v', [ 'label' => __( 'Show at', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ 'center' => __( 'Center', 'elementor-extras' ), 'top' => __( 'Top', 'elementor-extras' ), 'bottom' => __( 'Bottom', 'elementor-extras' ), ], 'condition' => [ 'image[url]!' => '', 'position' => [ 'left', 'right' ], ], 'frontend_available' => true ] ); $this->add_control( 'css_position', [ 'label' => __( 'CSS Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => 'Absolute', 'fixed' => 'Fixed', ], 'frontend_available' => true, ] ); $this->add_control( 'disable', [ 'label' => __( 'Disable On', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'tablet' => __( 'Tablet & Mobile', 'elementor-extras' ), 'mobile' => __( 'Mobile', 'elementor-extras' ), ], 'frontend_available' => true ] ); $this->add_control( 'arrow', [ 'label' => __( 'Arrow', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '""', 'options' => [ '""' => __( 'Show', 'elementor-extras' ), 'none' => __( 'Hide', 'elementor-extras' ), ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}:after' => 'content: {{VALUE}};', ], 'condition' => [ 'image[url]!' => '', ] ] ); $this->add_control( 'delay_in', [ 'label' => __( 'Delay in (s)', 'elementor-extras' ), 'description' => __( 'Time until tooltips appear.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.1, ], ], 'condition' => [ 'image[url]!' => '', ], 'frontend_available' => true ] ); $this->add_control( 'delay_out', [ 'label' => __( 'Delay out (s)', 'elementor-extras' ), 'description' => __( 'Time until tooltips dissapear.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.1, ], ], 'condition' => [ 'image[url]!' => '', ], 'frontend_available' => true ] ); $this->add_control( 'duration', [ 'label' => __( 'Duration', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 2, 'step' => 0.1, ], ], 'frontend_available' => true ] ); $this->add_control( 'distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'description' => __( 'The distance between the tooltip and the hotspot. Defaults to 6px', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'condition' => [ 'image[url]!' => '', ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}.to--top' => 'transform: translateY(-{{SIZE}}{{UNIT}});', '.ee-tooltip.ee-tooltip-{{ID}}.to--bottom' => 'transform: translateY({{SIZE}}{{UNIT}});', '.ee-tooltip.ee-tooltip-{{ID}}.to--left' => 'transform: translateX(-{{SIZE}}{{UNIT}});', '.ee-tooltip.ee-tooltip-{{ID}}.to--right' => 'transform: translateX({{SIZE}}{{UNIT}});', ] ] ); $this->add_control( 'offset', [ 'label' => __( 'Offset', 'elementor-extras' ), 'description' => __( 'Adjust offset to align arrow with target.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => -100, 'max' => 100, ], ], 'condition' => [ 'image[url]!' => '', ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}.to--top, .ee-tooltip.ee-tooltip-{{ID}}.to--bottom' => 'margin-left: {{SIZE}}{{UNIT}};', '.ee-tooltip.ee-tooltip-{{ID}}.to--left, .ee-tooltip.ee-tooltip-{{ID}}.to--right' => 'margin-top: {{SIZE}}{{UNIT}};', ] ] ); $this->add_responsive_control( 'width', [ 'label' => __( 'Maximum Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 200, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, ], ], 'condition' => [ 'image[url]!' => '', ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'width: {{SIZE}}{{UNIT}};', ] ] ); $this->add_control( 'zindex', [ 'label' => __( 'zIndex', 'elementor-extras' ), 'description' => __( 'Adjust the z-index of the tooltips. Defaults to 999', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => '999', 'min' => -9999999, 'step' => 1, 'condition' => [ 'image[url]!' => '', ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'z-index: {{SIZE}};', ] ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_image', [ 'label' => __( 'Image', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.10, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-hotspots img' => 'opacity: {{SIZE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'image_border', 'label' => __( 'Image Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-hotspots img', ] ); $this->add_control( 'image_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-hotspots img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'image_box_shadow', 'selector' => '{{WRAPPER}} .ee-hotspots img', 'separator' => '', ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'image_css_filters', 'selector' => '{{WRAPPER}} .ee-hotspots img', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_hotspots', [ 'label' => __( 'Hotspots', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'hotspots_pulse', [ 'label' => __( 'Disable Pulse Effect', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'frontend_available' => 'true', ] ); $this->add_control( 'hotspots_padding', [ 'label' => __( 'Text Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-hotspot__wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->add_control( 'hotspots_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 100, ], 'range' => [ 'px' => [ 'max' => 100, 'min' => 0, ], ], 'selectors' => [ '{{WRAPPER}} .ee-hotspot__wrapper' => 'border-radius: {{SIZE}}px;', '{{WRAPPER}} .ee-hotspot__wrapper:before' => 'border-radius: {{SIZE}}px;', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'hotspots_typography', 'selector' => '{{WRAPPER}} .ee-hotspot__wrapper', 'exclude' => ['line_height'], 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'hotspots', 'selector' => '{{WRAPPER}} .ee-hotspot__wrapper, {{WRAPPER}} .ee-hotspot__wrapper:before', ] ); $this->start_controls_tabs( 'tabs_hotspots_style' ); $this->start_controls_tab( 'tab_hotspots_default', [ 'label' => __( 'Default', 'elementor-extras' ), ] ); $this->add_responsive_control( 'hotspots_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.10, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-hotspot' => 'opacity: {{SIZE}};', ], ] ); $this->add_responsive_control( 'hotspots_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 2, 'min' => 0.5, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-hotspot__wrapper' => 'transform: scale({{SIZE}})', ], ] ); $this->add_control( 'hotspots_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-hotspot__wrapper' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'hotspots_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-hotspot__wrapper' => 'background-color: {{VALUE}};', '{{WRAPPER}} .ee-hotspot__wrapper:before' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'hotspots_border', 'label' => __( 'Text Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-hotspot__wrapper', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'hotspots_box_shadow', 'selector' => '{{WRAPPER}} .ee-hotspot__wrapper', 'separator' => '' ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_hotspots_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), ] ); $this->add_responsive_control( 'hotspots_hover_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.10, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-hotspot:hover .ee-hotspot__wrapper' => 'opacity: {{SIZE}};', ], ] ); $this->add_responsive_control( 'hotspots_hover_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 2, 'min' => 0.5, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-hotspot:hover .ee-hotspot__wrapper' => 'transform: scale({{SIZE}})', ], ] ); $this->add_control( 'hotspots_hover_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-hotspot:hover .ee-hotspot__wrapper' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'hotspots_hover_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_SECONDARY, ], 'selectors' => [ '{{WRAPPER}} .ee-hotspot:hover .ee-hotspot__wrapper' => 'background-color: {{VALUE}};', '{{WRAPPER}} .ee-hotspot:hover .ee-hotspot__wrapper:before' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'hotspots_hover_border', 'label' => __( 'Text Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-hotspot:hover .ee-hotspot__wrapper', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'hotspot_shover_box_shadow', 'selector' => '{{WRAPPER}} .ee-hotspot:hover .ee-hotspot__wrapper', 'separator' => '' ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_tooltips_style', [ 'label' => __( 'Tooltips', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'tooltips_align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'tooltips_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'tooltips_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'tooltips_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => ExtrasUtils::get_tooltip_background_selectors(), ] ); $this->add_control( 'tooltips_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'tooltips_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-tooltip.ee-tooltip-{{ID}}', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'tooltips_typography', 'selector' => '.ee-tooltip.ee-tooltip-{{ID}}', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'separator' => '', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'tooltips_box_shadow', 'selector' => '.ee-tooltip.ee-tooltip-{{ID}}', 'separator' => '', ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 0.1.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); if ( empty( $settings['image']['url'] ) ) return; $this->add_render_attribute( 'container', 'class', 'ee-hotspots__container' ); $this->add_render_attribute( 'wrapper', 'class', 'ee-hotspots' ); if ( '' !== $settings['hotspots_pulse'] ) { $this->add_render_attribute( 'wrapper', 'class', 'ee-hotspots--no-pulse' ); } ?><div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>> <?php echo Group_Control_Image_Size::get_attachment_image_html( $settings ); ?> <?php if ( $settings['hotspots'] ) { ?> <div <?php echo $this->get_render_attribute_string( 'container' ); ?>> <?php foreach ( $settings['hotspots'] as $index => $item ) { $has_icon = false; $hotspot_tag = 'div'; $hotspot_key = $this->get_repeater_setting_key( 'hotspot', 'hotspots', $index ); $wrapper_key = $this->get_repeater_setting_key( 'wrapper', 'hotspots', $index ); $icon_key = $this->get_repeater_setting_key( 'icon', 'hotspots', $index ); $icon_wrapper_key = $this->get_repeater_setting_key( 'icon-wrapper', 'hotspots', $index ); $text_key = $this->get_repeater_setting_key( 'text', 'hotspots', $index ); $tooltip_key = $this->get_repeater_setting_key( 'content', 'hotspots', $index ); $content_id = $this->get_id() . '_' . $item['_id']; $this->add_render_attribute( [ $wrapper_key => [ 'class' => 'ee-hotspot__wrapper', ], $text_key => [ 'class' => 'ee-hotspot__text', ], $tooltip_key => [ 'class' => 'hotip-content', 'id' => 'hotip-content-' . $content_id, ], $hotspot_key => [ 'class' => [ 'elementor-repeater-item-' . $item['_id'], 'hotip', 'ee-hotspot', ], 'data-hotips-content' => '#hotip-content-' . $content_id, 'data-hotips-position' => $item['tooltip_position'], 'data-hotips-arrow-position-h' => $item['tooltip_arrow_position_h'], 'data-hotips-arrow-position-v' => $item['tooltip_arrow_position_v'], 'data-hotips-class' => [ 'ee-global', 'ee-tooltip', 'ee-tooltip-' . $this->get_id(), ] ], ] ); if ( 'icon' === $item['hotspot'] && ( ! empty( $item['icon'] ) || ! empty( $item['selected_icon']['value'] ) ) ) { $migrated = isset( $item['__fa4_migrated']['selected_icon'] ); $is_new = empty( $item['icon'] ) && Icons_Manager::is_migration_allowed(); $has_icon = true; $this->add_render_attribute( $icon_wrapper_key, 'class', [ 'ee-hotspot__icon', 'ee-icon', 'ee-icon-support--svg', ] ); if ( ! empty( $item['icon'] ) ) { $this->add_render_attribute( $icon_key, [ 'class' => esc_attr( $item['icon'] ), 'aria-hidden' => 'true', ] ); } } if ( $item['_item_id'] ) { $this->add_render_attribute( $hotspot_key, 'id', $item['_item_id'] ); } if ( $item['css_classes'] ) { $this->add_render_attribute( $hotspot_key, 'class', $item['css_classes'] ); } if ( ! empty( trim( $item['link']['url'] ) ) ) { $hotspot_tag = 'a'; $this->add_render_attribute( $hotspot_key, 'href', $item['link']['url'] ); if ( $item['link']['is_external'] ) { $this->add_render_attribute( $hotspot_key, 'target', '_blank' ); } if ( ! empty( $item['link']['nofollow'] ) ) { $this->add_render_attribute( $hotspot_key, 'rel', 'nofollow' ); } } ?><<?php echo $hotspot_tag; ?> <?php echo $this->get_render_attribute_string( $hotspot_key ); ?>> <span <?php echo $this->get_render_attribute_string( $wrapper_key ); ?>> <span <?php echo $this->get_render_attribute_string( $text_key ); ?>><?php if ( $has_icon ) { ?><span <?php echo $this->get_render_attribute_string( $icon_wrapper_key ); ?>><?php if ( $is_new || $migrated ) { Icons_Manager::render_icon( $item['selected_icon'], [ 'aria-hidden' => 'true' ] ); } else { ?><i <?php echo $this->get_render_attribute_string( $icon_key ); ?>></i><?php } ?></span><?php } else { echo $item['text']; } ?></span> </span> </<?php echo $hotspot_tag; ?>> <div <?php echo $this->get_render_attribute_string( $tooltip_key ); ?>> <?php echo $this->parse_text_editor( $item['content'] ); ?> </div> <?php } ?> </div> <?php } ?> </div> <?php } /** * Content Template * * Javascript content template for quick rendering * * @since 0.1.0 * @return void */ protected function content_template() { ?> <# if ( '' !== settings.image.url ) { var image = { id: settings.image.id, url: settings.image.url, size: settings.image_size, dimension: settings.image_custom_dimension, model: view.getEditModel(), }, widgetId = view.$el.data('id'); currentItem = ( editSettings.activeItemIndex > 0 ) ? editSettings.activeItemIndex : false; view.addRenderAttribute( { 'wrapper' : { 'class' : 'ee-hotspots', }, 'container' : { 'class' : 'ee-hotspots__container', }, 'image' : { 'src' : elementor.imagesManager.getImageUrl( image ), } } ); if ( '' !== settings.hotspots_pulse ) { view.addRenderAttribute( 'wrapper', 'class', 'ee-hotspots--no-pulse' ); } #><div {{{ view.getRenderAttributeString( 'wrapper' ) }}}> <img {{{ view.getRenderAttributeString( 'image' ) }}} /> <# if ( settings.hotspots ) { #> <div {{{ view.getRenderAttributeString( 'container' ) }}}> <# _.each( settings.hotspots, function( item, index ) { var has_icon = false, hotspotTag = 'div', hotspotKey = view.getRepeaterSettingKey( 'hotspot', 'hotspots', index ), wrapperKey = view.getRepeaterSettingKey( 'wrapper', 'hotspots', index ), iconWrapperKey = view.getRepeaterSettingKey( 'icon-wrapper', 'hotspots', index ), iconKey = view.getRepeaterSettingKey( 'icon', 'hotspots', index ), textKey = view.getRepeaterSettingKey( 'text', 'hotspots', index ), tooltipKey = view.getRepeaterSettingKey( 'content', 'hotspots', index ), contentId = widgetId + '_' + item._id; view.addRenderAttribute( wrapperKey, 'class', 'ee-hotspot__wrapper' ); view.addRenderAttribute( textKey, 'class', 'ee-hotspot__text' ); view.addRenderAttribute( tooltipKey, 'class', 'hotip-content' ); view.addRenderAttribute( tooltipKey, 'id', 'hotip-content-' + contentId ); view.addRenderAttribute( hotspotKey, { 'class' : [ 'elementor-repeater-item-' + item._id, 'hotip', 'ee-hotspot', ], 'data-hotips-content' : '#hotip-content-' + contentId, 'data-hotips-position' : item.tooltip_position, 'data-hotips-arrow-position-h' : item.tooltip_arrow_position_h, 'data-hotips-arrow-position-v' : item.tooltip_arrow_position_v, 'data-hotips-class' : [ 'ee-tooltip', 'ee-tooltip-' + widgetId, ], } ); if ( 'icon' === item.hotspot && ( item.icon || item.selected_icon ) ) { var iconHTML = elementor.helpers.renderIcon( view, item.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ), migrated = elementor.helpers.isIconMigrated( item, 'selected_icon' ); has_icon = true; view.addRenderAttribute( iconWrapperKey, { 'class' : [ 'ee-hotspot__icon', 'ee-icon', 'ee-icon-support--svg', ], } ); if ( item.icon ) { view.addRenderAttribute( iconKey, { 'class' : item.icon, 'aria-hidden' : 'true', } ); } } else { view.addInlineEditingAttributes( textKey, 'none' ); } if ( item._item_id ) { view.addRenderAttribute( hotspotKey, 'id', item._item_id ); } if ( item.css_classes ) { view.addRenderAttribute( hotspotKey, 'class', item.css_classes ); } if ( '' !== item.link.url ) { hotspotTag = 'a'; view.addRenderAttribute( hotspotKey, 'href', item.link.url ); } #><{{ hotspotTag }} {{{ view.getRenderAttributeString( hotspotKey ) }}}> <span {{{ view.getRenderAttributeString( wrapperKey ) }}}> <span {{{ view.getRenderAttributeString( textKey ) }}}><# if ( has_icon ) { #><span {{{ view.getRenderAttributeString( iconWrapperKey ) }}}><# if ( ( migrated || ! item.icon ) && iconHTML.rendered ) { #>{{{ iconHTML.value }}}<# } else { #><i {{{ view.getRenderAttributeString( iconKey ) }}}></i><# } #></span><# } else { #>{{{ item.text }}}<# } #></span> </span> </{{ hotspotTag }}> <div {{{ view.getRenderAttributeString( tooltipKey ) }}}> {{{ item.content }}} </div> <# }); #> </div> <# } #> </div> <# } #><?php } } hotspots/module.php 0000644 00000001134 15112147616 0010430 0 ustar 00 <?php namespace ElementorExtras\Modules\Hotspots; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Hotspots\Module * * @since 1.6.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.6.0 * @return string */ public function get_name() { return 'hotspots'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.6.0 * @return array */ public function get_widgets() { return [ 'Hotspots', ]; } } image/widgets/image-comparison.php 0000644 00000057115 15112147616 0013254 0 ustar 00 <?php namespace ElementorExtras\Modules\Image\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Control_Media; use Elementor\Utils; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Border; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Background; use Elementor\Group_Control_Css_Filter; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Image_Comparison * * @since 0.1.0 */ class Image_Comparison extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 0.1.0 * @return string */ public function get_name() { return 'image-comparison'; } /** * Get Title * * Get the title of the widget * * @since 0.1.0 * @return string */ public function get_title() { return __( 'Image Comparison', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 0.1.0 * @return string */ public function get_icon() { return 'nicon nicon-image-comparison'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 0.1.0 * @return array */ public function get_script_depends() { return [ 'image-comparison', 'jquery-mobile', 'gsap-js', ]; } /** * Register Widget Controls * * @since 0.1.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_buttons', [ 'label' => __( 'Images & Labels', 'elementor-extras' ), ] ); $this->add_control( 'original_image', [ 'label' => __( 'Choose Original Image', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true ], 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'original_image', // Actually its `original_image_size`. 'label' => __( 'Image Size', 'elementor-extras' ), 'default' => 'full', ] ); $this->add_control( 'modified_image', [ 'label' => __( 'Choose Modified Image', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true ], 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], 'condition' => [ 'original_image[url]!' => '', ] ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'modified_image', // Actually its `modified_image_size`. 'label' => __( 'Image Size', 'elementor-extras' ), 'default' => 'full', ] ); $this->add_control( 'original_label', [ 'label' => __( 'Original Label', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Original', 'elementor-extras' ), 'placeholder' => __( 'Original', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'condition' => [ 'original_image[url]!' => '', ] ] ); $this->add_control( 'modified_label', [ 'label' => __( 'Modified Label', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Modified', 'elementor-extras' ), 'placeholder' => __( 'Modified', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'condition' => [ 'modified_image[url]!' => '', ] ] ); $this->end_controls_section(); $this->start_controls_section( 'section_settings', [ 'label' => __( 'Settings', 'elementor-extras' ), ] ); $this->add_control( 'entrance_animation', [ 'label' => __( 'Animate on entrance', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true ] ); $this->add_control( 'click_to_move', [ 'label' => __( 'Enable click', 'elementor-extras' ), 'description' => __( 'Click to move separator to a particular position.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true ] ); $this->add_control( 'click_labels', [ 'label' => __( 'Click Labels', 'elementor-extras' ), 'description' => __( 'Click on a label to uncover the corresponding image.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'click_to_move!' => '' ], 'frontend_available' => true ] ); $this->add_control( 'click_animate', [ 'label' => __( 'Animate Move', 'elementor-extras' ), 'description' => __( 'Animate separator position on click or change position instantly.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'click_to_move!' => '' ], 'frontend_available' => true ] ); $this->end_controls_section(); $this->start_controls_section( 'section_images_style', [ 'label' => __( 'Images', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'tabs_images_style' ); $this->start_controls_tab( 'tab_image_original', [ 'label' => __( 'Original', 'elementor-extras' ) ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'image_original_css_filters', 'selector' => '{{WRAPPER}} .ee-image-comparison > img', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_image_modified', [ 'label' => __( 'Modified', 'elementor-extras' ) ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'image_modified_css_filters', 'selector' => '{{WRAPPER}} .ee-image-comparison__image img', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_labels_style', [ 'label' => __( 'Labels', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'labels_spacing', [ 'label' => __( 'Distance (em)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 10, 'step' => 0.1 ], ], 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__label' => 'margin: 0 {{SIZE}}em {{SIZE}}em 0;', '{{WRAPPER}} .ee-image-comparison__image .ee-image-comparison__label' => 'margin: 0 0 {{SIZE}}em {{SIZE}}em', '{{WRAPPER}}.ee-image-comparison--middle .ee-image-comparison__label' => 'margin: 0 {{SIZE}}em 0 0;', '{{WRAPPER}}.ee-image-comparison--middle .ee-image-comparison__image .ee-image-comparison__label' => 'margin: 0 0 0 {{SIZE}}em', '{{WRAPPER}}.ee-image-comparison--top .ee-image-comparison__label' => 'margin: {{SIZE}}em {{SIZE}}em 0 0;', '{{WRAPPER}}.ee-image-comparison--top .ee-image-comparison__image .ee-image-comparison__label' => 'margin: {{SIZE}}em 0 0 {{SIZE}}em', ], ] ); $this->add_control( 'labels_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__label' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'labels_vertical_align', [ 'label' => __( 'Vertical Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], ], 'prefix_class' => 'ee-image-comparison--' ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'labels_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-image-comparison .ee-image-comparison__label', ] ); $this->add_control( 'labels_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-image-comparison .ee-image-comparison__label' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'labels_shadow', 'selector' => '{{WRAPPER}} .ee-image-comparison .ee-image-comparison__label', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'labels_box_shadow', 'selector' => '{{WRAPPER}} .ee-image-comparison .ee-image-comparison__label', 'separator' => '', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'labels_typography', 'selector' => '{{WRAPPER}} .ee-image-comparison .ee-image-comparison__label', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->start_controls_tabs( 'tabs_label_style' ); $this->start_controls_tab( 'tab_label_original', [ 'label' => __( 'Original', 'elementor-extras' ) ] ); $this->add_control( 'label_original_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__label--original' => 'color: {{VALUE}};', ], 'default' => '#FFFFFF', ] ); $this->add_control( 'label_original_background', [ 'label' => __( 'Background color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__label--original' => 'background-color: {{VALUE}};', ], 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_label_modified', [ 'label' => __( 'Modified', 'elementor-extras' ) ] ); $this->add_control( 'label_modified_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__label--modified' => 'color: {{VALUE}};', ], 'default' => '#FFFFFF', ] ); $this->add_control( 'label_modified_background', [ 'label' => __( 'Background color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__label--modified' => 'background-color: {{VALUE}};', ], 'default' => '', 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_separator_style', [ 'label' => __( 'Separator', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'separator_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 50, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'frontend_available' => true, 'selectors' => [ '{{WRAPPER}} .is--visible .ee-image-comparison__image' => 'width: {{SIZE}}%;', '{{WRAPPER}} .is--visible .ee-image-comparison__handle' => 'left: {{SIZE}}%;', ], ] ); $this->add_control( 'separator_size', [ 'label' => __( 'Size (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 100, 'unit' => '%', ], 'size_units' => [ '%' ], 'range' => [ '%' => [ 'min' => 1, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__separator' => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'separator_background_color', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .ee-image-comparison__separator', 'default' => 'classic', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_handle_style', [ 'label' => __( 'Handle', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'tabs_handle_style' ); $this->start_controls_tab( 'tab_handle_normal', [ 'label' => __( 'Normal', 'elementor-extras' ), ] ); $this->add_control( 'handle_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__handle' => 'background-color: {{VALUE}};', ], 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], ] ); $this->add_control( 'handle_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__handle' => 'color: {{VALUE}};', ], 'default' => '#FFFFFF', ] ); $this->add_control( 'handle_size', [ 'label' => __( 'Size (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 44, ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 100, ], ], 'separator' => 'none', 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__handle' => 'font-size: {{SIZE}}px; width: {{SIZE}}px; height: {{SIZE}}px; margin-left: calc(-{{SIZE}}px/2); margin-top: calc(-{{SIZE}}px/2);', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_handle_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), ] ); $this->add_control( 'handle_hover_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__handle:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'handle_hover_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__handle:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'handle_size_hover', [ 'label' => __( 'Size (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 44, ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 100, ], ], 'separator' => 'none', 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__handle:hover' => 'font-size: {{SIZE}}px; width: {{SIZE}}px; height: {{SIZE}}px; margin-left: calc(-{{SIZE}}px/2); margin-top: calc(-{{SIZE}}px/2);', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_handle_dragged', [ 'label' => __( 'Dragged', 'elementor-extras' ), ] ); $this->add_control( 'handle_dragged_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__handle.draggable' => 'background-color: {{VALUE}};', ], 'global' => [ 'default' => Global_Colors::COLOR_SECONDARY, ], ] ); $this->add_control( 'handle_dragged_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__handle.draggable' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'handle_size_dragged', [ 'label' => __( 'Size (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 44, ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 100, ], ], 'separator' => 'none', 'selectors' => [ '{{WRAPPER}} .ee-image-comparison__handle.draggable' => 'font-size: {{SIZE}}px; width: {{SIZE}}px; height: {{SIZE}}px; margin-left: calc(-{{SIZE}}px/2); margin-top: calc(-{{SIZE}}px/2);', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 0.1.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'wrapper' => [ 'class' => 'ee-image-comparison', ], 'modified-image-wrapper' => [ 'class' => 'ee-image-comparison__image', ], 'original-label' => [ 'class' => [ 'ee-image-comparison__label', 'ee-image-comparison__label--original', ], 'data-type' => 'original', ], 'modified-label' => [ 'class' => [ 'ee-image-comparison__label', 'ee-image-comparison__label--modified', ], 'data-type' => 'modified', ], 'separator' => [ 'class' => [ 'ee-image-comparison__separator', 'ee-center-vertical', ], ], 'handle' => [ 'class' => [ 'ee-image-comparison__handle', 'nicon', 'nicon-resize-horizontal-filled', ], ], ] ); if ( '' === $settings['original_label'] ) { $this->add_render_attribute( 'original-label', 'class', 'ee-image-comparison__label--empty' ); } if ( 'yes' === $settings['click_labels'] ) { $this->add_render_attribute( 'original-label', 'class', 'ee-image-comparison__label--clickable' ); } if ( '' === $settings['modified_label'] ) { $this->add_render_attribute( 'modified-label', 'class', 'ee-image-comparison__label--empty' ); } if ( 'yes' === $settings['click_labels'] ) { $this->add_render_attribute( 'modified-label', 'class', 'ee-image-comparison__label--clickable' ); } ?><figure <?php echo $this->get_render_attribute_string( 'wrapper' ) ?>> <?php if ( ! empty( $settings['original_image']['url'] ) ) { echo Group_Control_Image_Size::get_attachment_image_html( $settings, 'original_image' ); } ?> <span <?php echo $this->get_render_attribute_string( 'original-label' ) ?>> <?php if ( '' !== $settings['original_label'] ) { echo $settings['original_label']; } ?> </span> <div <?php echo $this->get_render_attribute_string( 'modified-image-wrapper' ) ?>> <?php if ( ! empty( $settings['modified_image']['url'] ) ) { echo Group_Control_Image_Size::get_attachment_image_html( $settings, 'modified_image' ); } ?> <span <?php echo $this->get_render_attribute_string( 'modified-label' ) ?>> <?php if ( '' !== $settings['modified_label'] ) { echo $settings['modified_label']; } ?> </span> <span <?php echo $this->get_render_attribute_string( 'separator' ) ?>></span> </div> <span <?php echo $this->get_render_attribute_string( 'handle' ) ?>></span> </figure><?php } /** * Content Template * * Javascript content template for quick rendering * * @since 0.1.0 * @return void */ protected function content_template() { ?><# var original_image = { id: settings.original_image.id, url: settings.original_image.url, size: settings.original_image_size, dimension: settings.original_image_custom_dimension, model: view.getEditModel() }, modified_image = { id: settings.modified_image.id, url: settings.modified_image.url, size: settings.modified_image_size, dimension: settings.modified_image_custom_dimension, model: view.getEditModel() }; view.addRenderAttribute( { 'wrapper' : { 'class' : [ 'ee-image-comparison', ], }, 'modified-image-wrapper' : { 'class' : [ 'ee-image-comparison__image', ], }, 'original-label' : { 'class' : [ 'ee-image-comparison__label', 'ee-image-comparison__label--original', ], 'data-type' : 'original', }, 'modified-label' : { 'class' : [ 'ee-image-comparison__label', 'ee-image-comparison__label--modified', ], 'data-type' : 'modified', }, 'separator' : { 'class' : [ 'ee-image-comparison__separator', 'ee-center-vertical', ], }, 'handle' : { 'class' : [ 'ee-image-comparison__handle', 'nicon', 'nicon-resize-horizontal-filled', ], }, 'original-image' : { 'src' : elementor.imagesManager.getImageUrl( original_image ), }, 'modified-image' : { 'src' : elementor.imagesManager.getImageUrl( modified_image ), }, } ); if ( '' === settings.original_label ) { view.addRenderAttribute( 'original-label', 'class', 'ee-image-comparison__label--empty' ); } if ( 'yes' === settings.click_labels ) { view.addRenderAttribute( 'original-label', 'class', 'ee-image-comparison__label--clickable' ); } if ( '' === settings.modified_label ) { view.addRenderAttribute( 'modified-label', 'class', 'ee-image-comparison__label--empty' ); } if ( 'yes' === settings.click_labels ) { view.addRenderAttribute( 'modified-label', 'class', 'ee-image-comparison__label--clickable' ); } #><figure {{{ view.getRenderAttributeString( 'wrapper' ) }}}> <# if ( settings.original_image.url ) { #> <img {{{ view.getRenderAttributeString( 'original-image' ) }}}> <span {{{ view.getRenderAttributeString( 'original-label' ) }}}><# if ( '' !== settings.original_label ) { #>{{{ settings.original_label }}}<# } #></span> <# } #> <# if ( settings.modified_image.url ) { #> <div {{{ view.getRenderAttributeString( 'modified-image-wrapper' ) }}}> <img {{{ view.getRenderAttributeString( 'modified-image' ) }}}> <span {{{ view.getRenderAttributeString( 'modified-label' ) }}}><# if ( '' !== settings.modified_label ) { #>{{{ settings.modified_label }}}<# } #></span> <span {{{ view.getRenderAttributeString( 'separator' ) }}}></span> </div> <# } #> <span {{{ view.getRenderAttributeString( 'handle' ) }}}></span> </figure><?php } } image/widgets/random-image.php 0000644 00000035266 15112147616 0012365 0 ustar 00 <?php namespace ElementorExtras\Modules\Image\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\Image\Module; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Control_Media; use Elementor\Utils; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Border; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Background; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Random_Image * * @since 2.0.0 */ class Random_Image extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 2.0.0 * @return string */ public function get_name() { return 'ee-random-image'; } /** * Get Title * * Get the title of the widget * * @since 2.0.0 * @return string */ public function get_title() { return __( 'Random Image', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 2.0.0 * @return string */ public function get_icon() { return 'nicon nicon-random'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 2.0.0 * @return array */ public function get_script_depends() { return [ 'magnific-popup', ]; } /** * Register Widget Controls * * @since 2.0.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_images', [ 'label' => __( 'Images', 'elementor-extras' ), ] ); $this->add_control( 'wp_gallery', [ 'label' => __( 'Add Images', 'elementor-extras' ), 'type' => Controls_Manager::GALLERY, 'frontend_available' => true, 'dynamic' => [ 'active' => true, ], ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'image', // Actually its `image_size`. 'label' => __( 'Image Size', 'elementor-extras' ), 'default' => 'full', ] ); $this->add_responsive_control( 'align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'caption', [ 'label' => __( 'Caption', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Show', 'elementor-extras' ), 'label_off' => __( 'Hide', 'elementor-extras' ), 'return_value' => 'yes', ] ); $this->add_control( 'link_to', [ 'label' => __( 'Link to', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'none', 'options' => [ 'none' => __( 'None', 'elementor-extras' ), 'file' => __( 'Media File', 'elementor-extras' ), 'custom' => __( 'Custom URL', 'elementor-extras' ), ], ] ); $this->add_control( 'link', [ 'label' => __( 'Link to', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'dynamic' => [ 'active' => true, ], 'placeholder' => __( 'https://your-link.com', 'elementor-extras' ), 'condition' => [ 'link_to' => 'custom', ], 'show_label' => false, ] ); $this->add_control( 'open_lightbox', [ 'label' => __( 'Lightbox', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), 'yes' => __( 'Yes', 'elementor-extras' ), 'no' => __( 'No', 'elementor-extras' ), ], 'condition' => [ 'link_to' => 'file', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_image', [ 'label' => __( 'Image', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'unit' => '%', ], 'tablet_default' => [ 'unit' => '%', ], 'mobile_default' => [ 'unit' => '%', ], 'size_units' => [ '%', 'px', 'vw' ], 'range' => [ '%' => [ 'min' => 1, 'max' => 100, ], 'px' => [ 'min' => 1, 'max' => 1000, ], 'vw' => [ 'min' => 1, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-random-image__image' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'space', [ 'label' => __( 'Max Width', 'elementor-extras' ) . ' (%)', 'type' => Controls_Manager::SLIDER, 'default' => [ 'unit' => '%', ], 'tablet_default' => [ 'unit' => '%', ], 'mobile_default' => [ 'unit' => '%', ], 'size_units' => [ '%' ], 'range' => [ '%' => [ 'min' => 1, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-random-image__image' => 'max-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'opacity', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.10, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-random-image__image' => 'opacity: {{SIZE}};', ], ] ); $this->add_control( 'hover_animation', [ 'label' => __( 'Hover Animation', 'elementor-extras' ), 'type' => Controls_Manager::HOVER_ANIMATION, ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'image_border', 'selector' => '{{WRAPPER}} .ee-random-image__image', 'separator' => 'before', ] ); $this->add_responsive_control( 'image_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-random-image__image' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'image_box_shadow', 'exclude' => [ 'box_shadow_position', ], 'selector' => '{{WRAPPER}} .ee-random-image__image', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_caption', [ 'label' => __( 'Caption', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'caption!' => '', ], ] ); $this->add_control( 'caption_align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], 'justify' => [ 'title' => __( 'Justified', 'elementor-extras' ), 'icon' => 'fa fa-align-justify', ], ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .widget-image-caption' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'text_color', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .widget-image-caption' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'caption_typography', 'selector' => '{{WRAPPER}} .widget-image-caption', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->add_responsive_control( 'caption_space', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .widget-image-caption' => 'margin-top: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 2.0.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); if ( ! $settings['wp_gallery'] ) { echo $this->render_placeholder( [ 'body' => __( 'No images selected.', 'elementor-extras' ), ] ); return; } $count = count( $settings['wp_gallery'] ); $index = ( $count > 1 ) ? rand( 0, $count - 1 ) : 0; $id = $settings['wp_gallery'][ $index ]['id']; $has_caption = 'yes' === $settings['caption']; $link = $this->get_link_url( $settings, $index ); $attachment = get_post( $id ); $this->add_render_attribute( [ 'wrapper' => [ 'class' => 'ee-random-image', ], 'figure' => [ 'class' => [ 'wp-caption', 'ee-random-image__figure' ], ], 'image' => [ 'class' => 'elementor-image ee-random-image__image', 'src' => Group_Control_Image_Size::get_attachment_image_src( $id, 'image', $settings ), 'alt' => esc_attr( Control_Media::get_image_alt( $id ) ), ], 'caption' => [ 'class' => [ 'widget-image-caption', 'wp-caption-text', 'ee-random-image__caption', ], ], ] ); if ( '' !== $settings['hover_animation'] ) { $this->add_render_attribute( 'image', 'class', 'elementor-animation-' . $settings['hover_animation'] ); } if ( $link ) { if ( ! empty( $link['url'] ) ) { $this->add_render_attribute( 'link', 'href', $link['url'] ); } if ( ! empty( $link['is_external'] ) ) { $this->add_render_attribute( 'link', 'target', '_blank' ); } if ( ! empty( $link['nofollow'] ) ) { $this->add_render_attribute( 'link', 'rel', 'nofollow' ); } $this->add_lightbox_data_attributes( 'link', $id, $settings['open_lightbox'], $this->get_id_for_loop() ); if ( $this->_is_edit_mode ) { $this->add_render_attribute( 'link', 'class', 'elementor-clickable' ); } } ?><div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>> <?php if ( $has_caption ) { ?> <figure <?php echo $this->get_render_attribute_string( 'figure' ); ?>> <?php } ?> <?php if ( $link ) { ?> <a <?php echo $this->get_render_attribute_string( 'link' ); ?>> <?php } ?> <img <?php echo $this->get_render_attribute_string( 'image' ); ?> /> <?php if ( $link ) { ?> </a> <?php } ?> <?php if ( $has_caption ) { ?> <figcaption <?php echo $this->get_render_attribute_string( 'caption' ); ?>> <?php echo Module::get_image_caption( $attachment ); ?> </figcaption> </figure> <?php } ?> </div><?php } /** * Content Template * * Javascript content template for quick rendering * * @since 2.0.0 * @return void */ protected function content_template() { ?><# if ( ! settings.wp_gallery.length ) { #><div class="ee-editor-placeholder"> <h4 class="ee-editor-placeholder__title">{{{ view.model.getTitle() }}}</h4> <div class="ee-editor-placeholder__body">No images selected</div> </div><# } else { var count = settings.wp_gallery.length, index = ( count > 1 ) ? Math.floor( ( Math.random() * count ) ) : 0, has_caption = 'yes' === settings.caption, link_url = false, image = settings.wp_gallery[index]; var _image = { id : image.id, url : image.url, size : settings.image_size, dimension : settings.image_custom_dimension, model : view.getEditModel(), }; var ensureAttachmentData = function( id ) { if ( 'undefined' === typeof wp.media.attachment( id ).get( 'caption' ) ) { wp.media.attachment( id ).fetch().then( function( data ) { view.render(); } ); } } var getAttachmentCaption = function( id ) { if ( ! id ) { return ''; } ensureAttachmentData( id ); return wp.media.attachment( id ).get( 'caption' ); } var caption = getAttachmentCaption( image.id ); if ( 'custom' === settings.link_to ) { link_url = settings.link.url; } if ( 'file' === settings.link_to ) { link_url = settings.wp_gallery[index].url; } view.addRenderAttribute( { 'wrapper' : { 'class' : 'ee-random-image', }, 'figure' : { 'class' : 'wp-caption ee-random-image__figure', }, 'image' : { 'src' : elementor.imagesManager.getImageUrl( _image ), 'class' : 'ee-random-image__image', }, 'caption' : { 'class' : [ 'widget-image-caption', 'wp-caption-text', 'ee-random-image__caption', ], }, } ); if ( '' !== settings.hover_animation ) { view.addRenderAttribute( 'image', 'src', 'elementor-animation-' + settings.hover_animation ); } #><div {{{ view.getRenderAttributeString( 'wrapper' ) }}}> <# if ( has_caption ) { #> <figure {{{ view.getRenderAttributeString( 'figure' ) }}}> <# } if ( link_url ) { #><a class="elementor-clickable" data-elementor-open-lightbox="{{ settings.open_lightbox }}" href="{{ link_url }}"><# } #><img {{{ view.getRenderAttributeString( 'image' ) }}} /><# if ( link_url ) { #></a><# } if ( has_caption ) { #> <figcaption {{{ view.getRenderAttributeString( 'caption' ) }}}> {{{ caption }}} </figcaption> </figure> <# } #> </div><# } #><?php } /** * Retrieve image widget link URL. * * @since 2.0.0 * @access private * @param array $settings * @return array|string|false An array/string containing the link URL, or false if no link. */ private function get_link_url( $settings, $index ) { if ( 'none' === $settings['link_to'] ) { return false; } if ( 'custom' === $settings['link_to'] ) { if ( empty( $settings['link']['url'] ) ) { return false; } return $settings['link']; } return [ 'url' => $settings['wp_gallery'][ $index ]['url'], ]; } } image/module.php 0000644 00000004450 15112147616 0007633 0 ustar 00 <?php namespace ElementorExtras\Modules\Image; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Image\Module * * @since 1.6.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.6.0 * @return string */ public function get_name() { return 'image'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.6.0 * @return array */ public function get_widgets() { return [ 'Random_Image', 'Image_Comparison', ]; } /** * Get Image Caption * * Get the attachment caption * * @since 2.1.0 * @return string */ public static function get_image_caption( $attachment, $types = 'caption' ) { if ( ! $attachment ) { return; } if ( ! is_a( $attachment, 'WP_Post' ) ) { if ( is_numeric( $attachment ) ) { $attachment = get_post( $attachment ); if ( ! $attachment ) return ''; } } if ( empty( $types ) ) { return $attachment->post_excerpt; } $data = []; if ( $attachment->post_title ) { if ( is_array( $types ) ) { if ( in_array( 'title', $types ) ) { $data['title'] = $attachment->post_title; } } elseif ( 'title' === $types ) { return $attachment->post_title; } } if ( $attachment->post_excerpt ) { if ( is_array( $types ) ) { if ( in_array( 'caption', $types ) ) { $data['caption'] = $attachment->post_excerpt; } } elseif ( 'caption' === $types ) { return $attachment->post_excerpt; } } if ( $attachment->post_content ) { if ( is_array( $types ) ) { if ( in_array( 'description', $types ) ) { $data['description'] = $attachment->post_content; } } elseif ( 'description' === $types ) { return $attachment->post_content; } } if ( ! $data ) { return ''; } return $data; } public static function render_image_title( $title ) { ?><div class="ee-caption__title"><?php echo $title; ?></div><?php } public static function render_image_caption( $caption ) { ?><div class="ee-caption__caption"><?php echo $caption; ?></div><?php } public static function render_image_description( $description ) { ?><div class="ee-caption__description"><?php echo $description; ?></div><?php } } map/widgets/google-map.php 0000644 00000132140 15112147616 0011534 0 ustar 00 <?php namespace ElementorExtras\Modules\Map\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Icons_Manager; use Elementor\Controls_Manager; use Elementor\Control_Media; use Elementor\Repeater; use Elementor\Utils; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Border; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Background; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Google_Map * * @since 2.0.0 */ class Google_Map extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 2.0.0 * @return string */ public function get_name() { return 'ee-google-map'; } /** * Get Title * * Get the title of the widget * * @since 2.0.0 * @return string */ public function get_title() { return __( 'Google Map', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 2.0.0 * @return string */ public function get_icon() { return 'nicon nicon-map'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 2.0.0 * @return array */ public function get_script_depends() { return [ 'gmap3', 'google-maps-api', 'jquery-resize-ee', ]; } /** * Register Widget Controls * * @since 2.0.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_pins', [ 'label' => __( 'Locations', 'elementor-extras' ), ] ); $repeater = new Repeater(); $repeater->start_controls_tabs( 'pins_repeater' ); $repeater->start_controls_tab( 'pins_pin', [ 'label' => __( 'Pin', 'elementor-extras' ) ] ); $repeater->add_control( 'lat', [ 'label' => __( 'Latitude', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'type' => Controls_Manager::TEXT, 'default' => '', ] ); $repeater->add_control( 'lng', [ 'label' => __( 'Longitude', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'type' => Controls_Manager::TEXT, 'default' => '', ] ); $repeater->add_control( 'icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'description' => __( 'IMPORTANT: Your icon image needs to be a square to avoid distortion of the artwork.', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, ] ); $repeater->end_controls_tab(); $repeater->start_controls_tab( 'pins_info', [ 'label' => __( 'Popup', 'elementor-extras' ) ] ); $repeater->add_control( 'name', [ 'label' => __( 'Title', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'type' => Controls_Manager::TEXT, 'label_block' => true, 'default' => __( 'Pin', 'elementor-extras' ), ] ); $repeater->add_control( 'description', [ 'label' => __( 'Description', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'type' => Controls_Manager::WYSIWYG, ] ); $repeater->add_control( 'trigger', [ 'label' => __( 'Trigger', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'click', 'label_block' => true, 'options' => [ 'click' => __( 'Click', 'elementor-extras' ), 'auto' => __( 'Auto', 'elementor-extras' ), 'mouseover' => __( 'Mouse Over', 'elementor-extras' ), ], ] ); $repeater->end_controls_tab(); $repeater->end_controls_tabs(); $this->add_control( 'pins', [ 'type' => Controls_Manager::REPEATER, 'default' => [ [ 'name' => __( 'Tour Eiffel', 'elementor-extras' ), 'lat' => '48.8583736', 'lng' => '2.2922873', ], [ 'name' => __( 'Arc de Triomphe', 'elementor-extras' ), 'lat' => '48.8737952', 'lng' => '2.2928335', ], [ 'name' => __( 'Louvre Museum', 'elementor-extras' ), 'lat' => '48.8606146', 'lng' => '2.33545', ], ], 'fields' => $repeater->get_controls(), 'title_field' => '{{{ name }}}', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_popups', [ 'label' => __( 'Popups', 'elementor-extras' ), ] ); $this->add_control( 'popups', [ 'label' => __( 'Enable Popups', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'title_tag', [ 'label' => __( 'Title Tag', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => __( 'H1', 'elementor-extras' ), 'h2' => __( 'H2', 'elementor-extras' ), 'h3' => __( 'H3', 'elementor-extras' ), 'h4' => __( 'H4', 'elementor-extras' ), 'h5' => __( 'H5', 'elementor-extras' ), 'h6' => __( 'H6', 'elementor-extras' ), 'div' => __( 'div', 'elementor-extras' ), 'span' => __( 'span', 'elementor-extras' ), ], 'default' => 'h5', 'condition' => [ 'popups' => 'yes', ], ] ); $this->add_control( 'description_tag', [ 'label' => __( 'Description Tag', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'p', 'options' => [ 'p' => __( 'p', 'elementor-extras' ), 'div' => __( 'div', 'elementor-extras' ), 'span' => __( 'span', 'elementor-extras' ), ], 'condition' => [ 'popups' => 'yes', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_map', [ 'label' => __( 'Map', 'elementor-extras' ), ] ); $this->add_control( 'heading_center', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Center Map', 'elementor-extras' ), 'condition' => [ 'route' => '', ], ] ); $this->add_control( 'fit', [ 'label' => __( 'Fit to Locations', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'route' => '', ], ] ); $this->add_control( 'lat', [ 'label' => __( 'Latitude', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '48.8583736', 'condition' => [ 'fit' => '', 'route' => '', ], ] ); $this->add_control( 'lng', [ 'label' => __( 'Longitude', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '2.2922873', 'condition' => [ 'fit' => '', 'route' => '', ], ] ); $this->add_control( 'zoom', [ 'label' => __( 'Zoom', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 10, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 18, 'step' => 1, ], ], 'condition' => [ 'fit' => '', 'route' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'heading_settings', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Settings', 'elementor-extras' ), 'separator' => 'before', ] ); $this->add_control( 'map_type', [ 'label' => __( 'Map Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'ROADMAP', 'options' => [ 'ROADMAP' => __( 'Roadmap', 'elementor-extras' ), 'SATELLITE' => __( 'Satellite', 'elementor-extras' ), 'TERRAIN' => __( 'Terrain', 'elementor-extras' ), 'HYBRID' => __( 'Hybrid', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_control( 'scrollwheel', [ 'label' => __( 'Scrollwheel', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'clickable_icons', [ 'label' => __( 'Clickable Icons', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'doubleclick_zoom', [ 'label' => __( 'Double Click to Zoom', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'draggable', [ 'label' => __( 'Draggable', 'elementor-extras' ), 'description' => __( 'Note: Map is not draggable in edit mode.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'keyboard_shortcuts', [ 'label' => __( 'Keyboard Shortcuts', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'heading_controls', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Interface', 'elementor-extras' ), 'separator' => 'before', ] ); $this->add_control( 'fullscreen_control', [ 'label' => __( 'Fullscreen Control', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'map_type_control', [ 'label' => __( 'Map Type Control', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'rotate_control', [ 'label' => __( 'Rotate Control', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'scale_control', [ 'label' => __( 'Scale Control', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'streetview_control', [ 'label' => __( 'Street View Control', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'zoom_control', [ 'label' => __( 'Zoom Control', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_polygon', [ 'label' => __( 'Polygon', 'elementor-extras' ), ] ); $this->add_control( 'polygon', [ 'label' => __( 'Enable', 'elementor-extras' ), 'description' => __( 'Draws a polygon on the map by connecting the locations.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_route', [ 'label' => __( 'Route', 'elementor-extras' ), ] ); $this->add_control( 'route', [ 'label' => __( 'Enable', 'elementor-extras' ), 'description' => __( 'Draws a route on the map between the locations.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'route_mode', [ 'label' => __( 'Mode', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'DRIVING', 'options' => [ 'DRIVING' => __( 'Driving', 'elementor-extras' ), 'WALKING' => __( 'Walking', 'elementor-extras' ), 'BICYCLING' => __( 'Bicycling', 'elementor-extras' ), 'TRANSIT' => __( 'Transit', 'elementor-extras' ), ], 'condition' => [ 'route!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'route_markers', [ 'label' => __( 'Markers', 'elementor-extras' ), 'description' => __( 'Enables direction markers to be shown on your route.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'condition' => [ 'route!' => '', ], 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_navigation', [ 'label' => __( 'Navigation', 'elementor-extras' ), ] ); $this->add_responsive_control( 'navigation', [ 'label' => __( 'Enable', 'elementor-extras' ), 'description' => __( 'Adds a list which visitors can use to navigate through your locations.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'navigation_zoom', [ 'label' => __( 'Zoom Level', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 18, ], 'range' => [ 'px' => [ 'max' => 18, ], ], 'condition' => [ 'navigation!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'navigation_hide_on', [ 'label' => __( 'Hide On', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'mobile', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'tablet' => __( 'Mobile & Tablet', 'elementor-extras' ), 'mobile' => __( 'Mobile Only', 'elementor-extras' ), ], 'condition' => [ 'navigation!' => '', ], 'prefix_class' => 'ee-google-map-navigation--hide-', ] ); $this->add_control( 'all_text', [ 'label' => __( 'All label', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'All locations', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'navigation!' => '', ], ] ); $this->add_control( 'selected_navigation_icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'navigation_icon', 'default' => [ 'value' => 'fas fa-map-marker-alt', 'library' => 'fa-solid', ], 'label_block' => false, 'skin' => 'inline', 'condition' => [ 'navigation!' => '', ], ] ); $this->add_control( 'navigation_icon_align', [ 'label' => __( 'Icon Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'left', 'options' => [ 'left' => __( 'Before', 'elementor-extras' ), 'right' => __( 'After', 'elementor-extras' ), ], 'condition' => [ 'navigation!' => '', 'selected_navigation_icon[value]!' => '', ], ] ); $this->add_control( 'navigation_icon_indent', [ 'label' => __( 'Icon Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 50, ], ], 'condition' => [ 'navigation!' => '', 'selected_navigation_icon[value]!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-icon--right' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-icon--left' => 'margin-right: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_pins', [ 'label' => __( 'Pins', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'pin_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'description' => __( 'Note: This setting only applies to custom pins.', 'elementor-extras' ), 'default' => [ 'size' => 50, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], ], 'frontend_available' => true, ] ); $this->add_control( 'pin_position_horizontal', [ 'label' => __( 'Horizontal Position', 'elementor-extras' ), 'description' => __( 'Note: This setting only applies to custom pins.', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'frontend_available' => true, ] ); $this->add_control( 'pin_position_vertical', [ 'label' => __( 'Vertical Position', 'elementor-extras' ), 'description' => __( 'Note: This setting only applies to custom pins.', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'top', 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], ], 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_map', [ 'label' => __( 'Map', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'map_style_type', [ 'label' => __( 'Add style from', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'api', 'options' => [ 'api' => __( 'Snazzy Maps API', 'elementor-extras' ), 'json' => __( 'Custom JSON', 'elementor-extras' ), ], 'label_block' => true, 'frontend_available' => true, ] ); $sm_endpoint_option = \ElementorExtras\ElementorExtrasPlugin::$instance->settings->get_option( 'snazzy_maps_endpoint', 'elementor_extras_apis', false ); $this->add_control( 'map_style_api', [ 'label' => __( 'Search Snazzy Maps', 'elementor-extras' ), 'type' => 'ee-snazzy', 'placeholder' => __( 'Search styles', 'elementor-extras' ), 'snazzy_options' => [ 'endpoint' => $sm_endpoint_option ? $sm_endpoint_option : 'explore', ], 'default' => '', 'frontend_available' => true, 'condition' => [ 'map_style_type' => 'api', ], ] ); $this->add_control( 'map_style_json', [ 'label' => __( 'Custom JSON', 'elementor-extras' ), 'description' => sprintf( __( 'Paste the JSON code for styling the map. You can get it from %1$sSnazzyMaps%2$s or similar services. Note: If you enter an invalid JSON string you\'ll be alerted.', 'elementor-extras' ), '<a target="_blank" href="https://snazzymaps.com/explore">', '</a>' ), 'type' => Controls_Manager::TEXTAREA, 'default' => '', 'frontend_available' => true, 'condition' => [ 'map_style_type' => 'json', ], ] ); $this->add_responsive_control( 'map_height', [ 'label' => __( 'Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'vh', '%' ], 'default' => [ 'size' => 400, ], 'range' => [ 'vh' => [ 'min' => 0, 'max' => 100, ], '%' => [ 'min' => 10, 'max' => 100, 'step' => 1, ], 'px' => [ 'min' => 100, 'max' => 1000, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-google-map' => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_polygon', [ 'label' => __( 'Polygon', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'polygon!' => '', ], ] ); $this->start_controls_tabs( 'polygon_tabs' ); $this->start_controls_tab( 'polygon_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'heading_polygon_stroke', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Stroke', 'elementor-extras' ), 'condition' => [ 'polygon!' => '', ], ] ); $this->add_control( 'polygon_stroke_weight', [ 'label' => __( 'Weight', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 2, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 10, 'step' => 1, ], ], 'condition' => [ 'polygon!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'polygon_stroke_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'polygon!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'polygon_stroke_opacity', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.8, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.01, ], ], 'condition' => [ 'polygon!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'heading_polygon_fill', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Fill', 'elementor-extras' ), 'separator' => 'before', 'condition' => [ 'polygon!' => '', ], ] ); $this->add_control( 'polygon_fill_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'polygon!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'polygon_fill_opacity', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.35, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.01, ], ], 'condition' => [ 'polygon!' => '', ], 'frontend_available' => true, ] ); $this->end_controls_tab(); $this->start_controls_tab( 'polygon_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'heading_polygon_stroke_hover', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Stroke', 'elementor-extras' ), 'condition' => [ 'polygon!' => '', ], ] ); $this->add_control( 'polygon_stroke_weight_hover', [ 'label' => __( 'Weight', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 2, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 10, 'step' => 1, ], ], 'condition' => [ 'polygon!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'polygon_stroke_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'polygon!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'polygon_stroke_opacity_hover', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.8, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.01, ], ], 'condition' => [ 'polygon!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'heading_polygon_fill_hover', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Fill', 'elementor-extras' ), 'separator' => 'before', 'condition' => [ 'polygon!' => '', ], ] ); $this->add_control( 'polygon_fill_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'polygon!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'polygon_fill_opacity_hover', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.35, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.01, ], ], 'condition' => [ 'polygon!' => '', ], 'frontend_available' => true, ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_style_navigation', [ 'label' => __( 'Navigation', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'navigation!' => '', ], ] ); $this->add_responsive_control( 'navigation_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'top-left', 'options' => [ 'top-left' => __( 'Top Left', 'elementor-extras' ), 'top-right' => __( 'Top Right', 'elementor-extras' ), 'bottom-right' => __( 'Bottom Right', 'elementor-extras' ), 'bottom-left' => __( 'Bottom Left', 'elementor-extras' ), ], 'frontend_available' => true, 'prefix_class' => 'ee-google-map-navigation%s--', 'condition' => [ 'navigation!' => '', ], ] ); $this->add_responsive_control( 'navigation_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ '%' => [ 'min' => 0, 'max' => 100, ], 'px' => [ 'min' => 100, 'max' => 1000, ], ], 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation' => 'width: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'navigation!' => '', ], ] ); $this->add_responsive_control( 'navigation_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation' => 'margin: {{SIZE}}{{UNIT}}; max-height: calc( 100% - {{SIZE}}px * 2 );', ], 'condition' => [ 'navigation!' => '', ], ] ); $this->add_control( 'navigation_background', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation' => 'background-color: {{VALUE}};', ], 'condition' => [ 'navigation!' => '', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'navigation_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-google-map__navigation', 'condition' => [ 'navigation!' => '', ], ] ); $this->add_control( 'navigation_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} .ee-google-map__navigation__item:first-child a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} 0 0;', '{{WRAPPER}} .ee-google-map__navigation__item:last-child a' => 'border-radius: 0 0 {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'navigation!' => '', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'navigation_box_shadow', 'selector' => '{{WRAPPER}} .ee-google-map__navigation', 'separator' => '', 'condition' => [ 'navigation!' => '', ], ] ); $this->add_control( 'heading_navigation_separator', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Separator', 'elementor-extras' ), 'separator' => 'before', 'condition' => [ 'navigation!' => '', ], ] ); $this->add_responsive_control( 'navigation_links_separator_thickness', [ 'label' => __( 'Thickness', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation__item:not(:last-child) a' => 'border-bottom: {{SIZE}}px solid;', ], 'condition' => [ 'navigation!' => '', ], ] ); $this->add_control( 'heading_navigation_links', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Links', 'elementor-extras' ), 'separator' => 'before', 'condition' => [ 'navigation!' => '', ], ] ); $this->add_responsive_control( 'navigation_links_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation__item:not(:last-child)' => 'margin-bottom: {{SIZE}}px;', ], 'condition' => [ 'navigation!' => '', ], ] ); $this->add_control( 'navigation_links_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation__link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'navigation!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'navigation_links_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-google-map__navigation', 'condition' => [ 'navigation!' => '', ], ] ); $this->add_control( 'navigation_links_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'left', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'condition' => [ 'navigation!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation__link' => 'text-align: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'image', 'selector' => '{{WRAPPER}} .ee-google-map__navigation__link', 'separator' => '', ] ); $this->start_controls_tabs( 'navigation_tabs' ); $this->start_controls_tab( 'navigation_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'navigation_links_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'navigation!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation__link' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'navigation_links_separator_color', [ 'label' => __( 'Separator Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'navigation!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation__item:not(:last-child) a' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'navigation_links_background', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation__link' => 'background-color: {{VALUE}};', ], 'condition' => [ 'navigation!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'navigation_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'navigation_links_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'navigation!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation__link:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'navigation_links_separator_color_hover', [ 'label' => __( 'Separator Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'navigation!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation__item:not(:last-child) .ee-google-map__navigation__link:hover' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'navigation_links_background_hover', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation__link:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ 'navigation!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'navigation_current', [ 'label' => __( 'Current', 'elementor-extras' ) ] ); $this->add_control( 'navigation_links_color_current', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'navigation!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation__item.ee--is-active .ee-google-map__navigation__link, {{WRAPPER}} .ee-google-map__navigation__item.ee--is-active .ee-google-map__navigation__link:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'navigation_links_separator_color_current', [ 'label' => __( 'Separator Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'navigation!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation__item.ee--is-active .ee-google-map__navigation__item:not(:last-child) .ee-google-map__navigation__link, {{WRAPPER}} .ee-google-map__navigation__item.ee--is-active .ee-google-map__navigation__item:not(:last-child) .ee-google-map__navigation__link:hover' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'navigation_links_background_current', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-google-map__navigation__item.ee--is-active .ee-google-map__navigation__link, {{WRAPPER}} .ee-google-map__navigation__item.ee--is-active .ee-google-map__navigation__link:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ 'navigation!' => '', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 2.0.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); $plugin = \ElementorExtras\ElementorExtrasPlugin::$instance; if ( '' === $plugin->settings->get_option( 'google_maps_api_key', 'elementor_extras_apis', false ) ) { echo $this->render_placeholder( [ 'body' => __( 'You have not set your Google Maps API key.', 'elementor-extras' ), ] ); return; } $this->add_render_attribute( [ 'wrapper' => [ 'class' => [ 'ee-google-map-wrapper', ], ], 'map' => [ 'class' => [ 'ee-google-map', ], 'data-lat' => $settings['lat'], 'data-lng' => $settings['lng'], ], 'title' => [ 'class' => 'ee-google-map__pin__title', ], 'description' => [ 'class' => 'ee-google-map__pin__description', ], ] ); if ( ! empty( $settings['pins'] ) ) { ?><div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>><?php if ( '' !== $settings['navigation'] ) { $this->render_navigation(); } ?><div <?php echo $this->get_render_attribute_string( 'map' ); ?>> <?php foreach ( $settings['pins'] as $index => $item ) { $key = $this->get_repeater_setting_key( 'pin', 'pins', $index ); $title_key = $this->get_repeater_setting_key( 'title', 'pins', $index ); $description_key = $this->get_repeater_setting_key( 'description', 'pins', $index ); $this->add_render_attribute( [ $key => [ 'class' => [ 'ee-google-map__pin', ], 'data-trigger' => $item['trigger'], 'data-lat' => $item['lat'], 'data-lng' => $item['lng'], 'data-id' => $item['_id'], ], ] ); if ( ! empty( $item['icon']['url'] ) ) { $this->add_render_attribute( $key, [ 'data-icon' => esc_url( $item['icon']['url'] ), ] ); } ?><div <?php echo $this->get_render_attribute_string( $key ); ?>> <?php if ( '' !== $settings['popups'] ) { $title_tag = $settings['title_tag']; $description_tag = $settings['description_tag']; ?><<?php echo $title_tag; ?> <?php echo $this->get_render_attribute_string( 'title' ); ?>> <?php echo $item['name']; ?> </<?php echo $title_tag; ?>> <<?php echo $description_tag; ?> <?php echo $this->get_render_attribute_string( 'description' ); ?>> <?php echo $item['description']; ?> </<?php echo $description_tag; ?>> <?php } ?> </div><?php } ?></div><?php ?></div><?php } } /** * Render Navigation * * Render widget navigation on frontend * * @since 2.0.0 * @return void */ protected function render_navigation() { $settings = $this->get_settings_for_display(); $has_icon = false; $this->add_render_attribute( [ 'navigation-wrapper' => [ 'class' => [ 'ee-google-map__navigation', ], ], 'navigation' => [ 'class' => [ 'ee-nav', 'ee-nav--stacked', 'ee-google-map__navigation__items', ], ], 'text' => [ 'class' => [ 'ee-google-map__navigation__text' ], ], ] ); if ( ! empty( $settings['navigation_icon'] ) || ! empty( $settings['selected_navigation_icon']['value'] ) ) { $this->add_render_attribute( 'icon', 'class', [ 'ee-button-icon', 'ee-icon', 'ee-icon-support--svg', 'ee-icon--' . $settings['navigation_icon_align'], ] ); $has_icon = true; } ?><div <?php echo $this->get_render_attribute_string( 'navigation-wrapper' ); ?>> <ul <?php echo $this->get_render_attribute_string( 'navigation' ); ?>><?php $this->render_all_link( $has_icon ); foreach ( $settings['pins'] as $index => $item ) { $item_key = $this->get_repeater_setting_key( 'item', 'pins', $index ); $link_key = $this->get_repeater_setting_key( 'link', 'pins', $index ); $this->add_render_attribute( [ $item_key => [ 'class' => [ 'ee-google-map__navigation__item', 'elementor-repeater-item-' . $item['_id'], ], 'data-id' => $item['_id'], ], $link_key => [ 'class' => [ 'ee-google-map__navigation__link', 'ee-button', 'ee-button-link', ], ], ] ); ?><li <?php echo $this->get_render_attribute_string( $item_key ); ?>> <a <?php echo $this->get_render_attribute_string( $link_key ); ?>><?php if ( $has_icon ) { $this->render_navigation_icon(); } ?><span <?php echo $this->get_render_attribute_string( 'text' ); ?>> <?php echo $item['name']; ?> </span> </a> </li><?php } ?> </ul> </div><?php } /** * Render Navigation Icon * * @since 2.1.5 * @return void */ protected function render_navigation_icon() { $settings = $this->get_settings(); $migrated = isset( $settings['__fa4_migrated']['selected_navigation_icon'] ); $is_new = empty( $settings['navigation_icon'] ) && Icons_Manager::is_migration_allowed(); ?><span <?php echo $this->get_render_attribute_string( 'icon' ); ?>><?php if ( $is_new || $migrated ) { Icons_Manager::render_icon( $settings['selected_navigation_icon'], [ 'aria-hidden' => 'true' ] ); } else { ?><i class="<?php echo esc_attr( $settings['navigation_icon'] ); ?>" aria-hidden="true"></i><?php } ?></span><?php } /** * Render All Link * * Render widget navigations' "all" link * * @since 2.0.0 * @return void */ protected function render_all_link( $icon = false ) { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'all' => [ 'class' => [ 'ee-google-map__navigation__item', 'ee-google-map__navigation__item--all', ], ], 'link' => [ 'class' => [ 'ee-google-map__navigation__link', 'ee-button', 'ee-button-link', ], ], ] ); ?><li <?php echo $this->get_render_attribute_string( 'all' ); ?>> <a <?php echo $this->get_render_attribute_string( 'link' ); ?>><?php if ( $icon ) { $this->render_navigation_icon(); } ?><span <?php echo $this->get_render_attribute_string( 'text' ); ?>> <?php echo $settings['all_text']; ?> </span> </a> </li><?php } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 2.0.0 * @return void */ protected function content_template() {} } map/module.php 0000644 00000001117 15112147616 0007323 0 ustar 00 <?php namespace ElementorExtras\Modules\Map; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Map\Module * * @since 2.0.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 2.0.0 * @return string */ public function get_name() { return 'map'; } /** * Get Widgets * * Get the modules' widgets * * @since 2.0.0 * @return array */ public function get_widgets() { return [ 'Google_Map', ]; } } media-player/skins/skin-base.php 0000644 00000002353 15112147616 0012640 0 ustar 00 <?php namespace ElementorExtras\Modules\MediaPlayer\Skins; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Skin_Base as Elementor_Skin_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\MediaPlayer\Skins * * @since 1.6.0 */ abstract class Skin_Base extends Elementor_Skin_Base { /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 1.6.0 * @return void */ protected function _register_controls_actions() { add_action( 'elementor/element/ee-popup/section_items/before_section_end', [ $this, 'register_controls' ] ); } /** * Register Controls * * @since 1.6.0 * @return void * @param $widget Extras_Widget */ public function register_controls( Extras_Widget $widget ) { $this->parent = $widget; $this->register_content_controls(); } /** * Register Content Controls * * @since 1.6.0 * @return void */ public function register_content_controls() {} /** * Render * * Render widget contents on frontend * * @since 1.6.0 * @return void */ public function render() { $this->parent->render(); } } media-player/skins/skin-classic.php 0000644 00000002221 15112147616 0013341 0 ustar 00 <?php namespace ElementorExtras\Modules\MediaPlayer\Skins; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\MediaPlayer\Skins * * @since 1.6.0 */ class Skin_Classic extends Skin_Base { /** * Get ID * * Gets the current skin ID * * @since 1.6.0 * @return string */ public function get_id() { return 'classic'; } /** * Get Title * * Gets the current skin title * * @since 1.6.0 * @return string */ public function get_title() { return __( 'Classic', 'elementor-extras' ); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 1.6.0 * @return void */ protected function _register_controls_actions() { parent::_register_controls_actions(); // add_action( 'elementor/element/posts-extra/section_query/after_section_end', [ $this, 'register_parallax_controls' ] ); } /** * Register Layout Content Controls * * @since 1.6.0 * @return void */ public function register_layout_content_controls() { parent::register_layout_content_controls(); } } media-player/widgets/audio-player.php 0000644 00000155740 15112147616 0013707 0 ustar 00 <?php namespace ElementorExtras\Modules\MediaPlayer\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\MediaPlayer\Skins; use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Repeater; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Border; use Elementor\Group_Control_Background; use Elementor\Modules\DynamicTags\Module as TagsModule; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Audio_Player * * @since 2.0.0 */ class Audio_Player extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 2.0.0 * @return string */ public function get_name() { return 'ee-audio-player'; } /** * Get Title * * Get the title of the widget * * @since 2.0.0 * @return string */ public function get_title() { return __( 'Audio Player', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 2.0.0 * @return string */ public function get_icon() { return 'nicon nicon-audio'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 2.0.0 * @return array */ public function get_script_depends() { return [ 'audio-player', 'jquery-appear', ]; } /** * Register Skins * * @since 2.0.0 * @return void */ protected function register_skins() { // Comment until future development // $this->add_skin( new Skins\Skin_Classic( $this ) ); } /** * Register Widget Controls * * @since 2.0.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_playlist', [ 'label' => __( 'Playlist', 'elementor-extras' ), ] ); $repeater = new Repeater(); $repeater->add_control( 'title', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'label_block' => true, 'default' => __( 'No title', 'elementor-extras' ), ] ); $repeater->start_controls_tabs( 'tabs_sources' ); $repeater->start_controls_tab( 'tab_source_mpeg', [ 'label' => __( 'MP3', 'elementor-extras' ), ] ); $repeater->add_control( 'audio_source', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'file', 'options' => [ 'file' => __( 'File', 'elementor-extras' ), 'url' => __( 'External', 'elementor-extras' ), ], ] ); $repeater->add_control( 'source_mpeg', [ 'label' => __( 'File', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::MEDIA_CATEGORY, ], ], 'condition' => [ 'audio_source' => 'file', ], 'media_type' => 'audio', ] ); $repeater->add_control( 'source_mpeg_url', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'description' => __( 'Insert URL to an .mp3 audio file', 'elementor-extras' ), 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::URL_CATEGORY, ], ], 'condition' => [ 'audio_source' => 'url', ], ] ); $repeater->end_controls_tab(); $repeater->start_controls_tab( 'tab_source_m4a', [ 'label' => __( 'M4A', 'elementor-extras' ), ] ); $repeater->add_control( 'audio_source_m4a', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'file', 'options' => [ 'file' => __( 'File', 'elementor-extras' ), 'url' => __( 'External', 'elementor-extras' ), ], ] ); $repeater->add_control( 'source_m4a', [ 'label' => __( 'File', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::MEDIA_CATEGORY, ], ], 'condition' => [ 'audio_source_m4a' => 'file', ], 'media_type' => 'audio', ] ); $repeater->add_control( 'source_m4a_url', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'description' => __( 'Insert URL to an .m4a audio file', 'elementor-extras' ), 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::URL_CATEGORY, ], ], 'condition' => [ 'audio_source_m4a' => 'url', ], ] ); $repeater->end_controls_tab(); $repeater->start_controls_tab( 'tab_source_wav', [ 'label' => __( 'WAV', 'elementor-extras' ), ] ); $repeater->add_control( 'audio_source_wav', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'file', 'options' => [ 'file' => __( 'File', 'elementor-extras' ), 'url' => __( 'External', 'elementor-extras' ), ], ] ); $repeater->add_control( 'source_wav', [ 'label' => __( 'File', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::MEDIA_CATEGORY, ], ], 'condition' => [ 'audio_source_wav' => 'file', ], 'media_type' => 'audio', ] ); $repeater->add_control( 'source_wav_url', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'description' => __( 'Insert URL to an .wav audio file', 'elementor-extras' ), 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::URL_CATEGORY, ], ], 'condition' => [ 'audio_source_wav' => 'url', ], ] ); $repeater->end_controls_tab(); $repeater->start_controls_tab( 'tab_source_ogg', [ 'label' => __( 'OGG', 'elementor-extras' ), ] ); $repeater->add_control( 'audio_source_ogg', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'file', 'options' => [ 'file' => __( 'File', 'elementor-extras' ), 'url' => __( 'External', 'elementor-extras' ), ], ] ); $repeater->add_control( 'source_ogg', [ 'label' => __( 'File', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::MEDIA_CATEGORY, ], ], 'condition' => [ 'audio_source_ogg' => 'file', ], 'media_type' => 'audio', ] ); $repeater->add_control( 'source_ogg_url', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'description' => __( 'Insert URL to an .ogg audio file', 'elementor-extras' ), 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::URL_CATEGORY, ], ], 'condition' => [ 'audio_source_ogg' => 'url', ], ] ); $repeater->end_controls_tab(); $repeater->end_controls_tabs(); $this->add_control( 'playlist', [ 'type' => Controls_Manager::REPEATER, 'default' => [ [ ] ], 'fields' => $repeater->get_controls(), 'title_field' => '{{{ title }}}', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_settings', [ 'label' => __( 'Settings', 'elementor-extras' ), ] ); $this->add_control( 'behaviour_heading', [ 'label' => __( 'Behaviour', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'preload', [ 'label' => __( 'Preload', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'auto', 'options' => [ 'auto' => __( 'Auto', 'elementor-extras' ), 'metadata' => __( 'Metadata', 'elementor-extras' ), 'none' => __( 'None', 'elementor-extras' ), ], ] ); $this->add_control( 'autoplay', [ 'label' => __( 'Auto Play', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'autoplay_notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Many browsers don\'t allow sound to autoplay without user interaction.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'condition' => [ 'autoplay!' => '' ], ] ); $this->add_control( 'loop', [ 'label' => __( 'Loop Track', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), ] ); $this->add_control( 'loop_playlist', [ 'label' => __( 'Loop Playlist', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'loop!' => 'yes', ], ] ); $this->add_control( 'display_heading', [ 'label' => __( 'Display', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'show_restart', [ 'label' => __( 'Show Restart', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', ] ); $this->add_control( 'show_time', [ 'label' => __( 'Show Time', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', ] ); $this->add_control( 'show_progress', [ 'label' => __( 'Show Progress', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', ] ); $this->add_control( 'show_duration', [ 'label' => __( 'Show Duration', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', ] ); $this->add_control( 'show_playlist', [ 'label' => __( 'Enable Playlist', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', ] ); $this->add_control( 'show_playlist_start', [ 'label' => __( 'Show Playlist', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'show_playlist!' => '', ], ] ); $this->add_control( 'show_playlist_control', [ 'label' => __( 'Show Playlist Button', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'show_playlist!' => '', ], ] ); $this->add_control( 'volume_heading', [ 'label' => __( 'Volume', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'show_volume', [ 'label' => __( 'Show Volume', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', ] ); $this->add_control( 'show_volume_icon', [ 'label' => __( 'Show Volume Icon', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'show_volume!' => '', ] ] ); $this->add_control( 'show_volume_bar', [ 'label' => __( 'Show Volume Bar', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'show_volume!' => '', ] ] ); $this->add_responsive_control( 'volume', [ 'label' => __( 'Initial Volume', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.8, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_player_style', [ 'label' => __( 'Player', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ '%' => [ 'min' => 0, 'max' => 100, ], 'px' => [ 'min' => 0, 'max' => 600, ], ], 'size_units' => [ '%', 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-audio-player' => 'max-width: {{SIZE}}{{UNIT}};', ] ] ); $this->add_responsive_control( 'padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'max' => 72, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-audio-player__controls .ee-player__controls__bar' => 'padding: {{SIZE}}px', ], ] ); $this->add_responsive_control( 'align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'player_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-audio-player__controls', ] ); $this->add_control( 'player_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-audio-player__controls' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'player_box_shadow', 'selector' => '{{WRAPPER}} .ee-audio-player__controls', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_controls_style', [ 'label' => __( 'Controls', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'zoom', [ 'label' => __( 'Zoom', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'max' => 36, 'min' => 6, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-audio-player__controls .ee-player__controls__bar' => 'font-size: {{SIZE}}px', '{{WRAPPER}} .ee-audio-player__controls .ee-player__controls__bar .ee-player__control--progress' => 'height: {{SIZE}}px', ], ] ); $this->add_responsive_control( 'controls_spacing', [ 'label' => __( 'Controls Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'max' => 24, 'min' => 3, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-audio-player__controls .ee-player__control--indicator, {{WRAPPER}} .ee-audio-player__controls .ee-player__control--icon' => 'padding: 0 {{SIZE}}px', '{{WRAPPER}} .ee-audio-player__controls .ee-player__control--progress' => 'margin: 0 {{SIZE}}px', ], ] ); $this->add_control( 'controls_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'default' => [ 'top' => 100, 'right' => 100, 'bottom' => 100, 'left' => 100, 'unit' => 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-audio-player__controls .ee-player__controls__bar .ee-player__control--progress' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} .ee-audio-player__controls .ee-player__controls__bar .ee-player__control--progress__inner' => 'border-radius: 0 {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} 0;' ], ] ); $this->add_control( 'controls_progress_heading', [ 'label' => __( 'Progress', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'show_progress!' => '', ], ] ); $this->add_responsive_control( 'progress_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 90, 'min' => 10, 'step' => 1, ], ], 'condition' => [ 'show_progress!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-player__controls__progress' => 'flex-basis: {{SIZE}}%', ], ] ); $this->add_control( 'controls_play_heading', [ 'label' => __( 'Play Icon', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_responsive_control( 'play_icon_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 10, 'min' => 0.1, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-player__controls__play' => 'font-size: {{SIZE}}em', ], ] ); $this->add_control( 'controls_volume_heading', [ 'label' => __( 'Volume', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'show_volume_bar!' => '', 'show_volume!' => '', ], ] ); $this->add_responsive_control( 'volume_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 90, 'min' => 10, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-player__controls__volume' => 'flex-basis: {{SIZE}}%', ], 'condition' => [ 'show_volume_bar!' => '', 'show_volume!' => '', ], ] ); $this->add_control( 'controls_style_heading', [ 'label' => __( 'All Controls', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->start_controls_tabs( 'tabs_controls_style' ); $this->start_controls_tab( 'controls_default', [ 'label' => __( 'Default', 'elementor-extras' ), ] ); $this->add_control( 'controls_foreground', [ 'label' => __( 'Foreground', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '#FFFFFF', 'selectors' => [ '{{WRAPPER}} .ee-audio-player__controls .ee-player__controls__bar' => 'color: {{VALUE}}', '{{WRAPPER}} .ee-audio-player__controls .ee-player__control--progress__inner' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'controls_background', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-audio-player__controls .ee-player__controls__bar' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'controls_opacity', [ 'label' => __( 'Controls Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.9, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-audio-player__controls .ee-player__control' => 'opacity: {{SIZE}}', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'controls_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), ] ); $this->add_control( 'controls_foreground_hover', [ 'label' => __( 'Foreground', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-audio-player__controls .ee-player__controls__bar:hover .ee-player__control' => 'color: {{VALUE}}', '(desktop+){{WRAPPER}} .ee-audio-player__controls .ee-player__controls__bar:hover .ee-player__control--progress__inner' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'controls_background_hover', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-audio-player__controls .ee-player__controls__bar:hover' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'controls_opacity_hover', [ 'label' => __( 'Controls Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-audio-player__controls .ee-player__controls__bar:hover .ee-player__control' => 'opacity: {{SIZE}}', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'controls', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-player__control--indicator', 'separator' => 'before', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_playlist_style', [ 'label' => __( 'Playlist', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'show_playlist!' => '', ], ] ); $this->add_responsive_control( 'playlist_height', [ 'label' => __( 'Max. Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 500, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-audio-player__controls__playlist-wrapper' => 'max-height: {{SIZE}}px', ], 'condition' => [ 'show_playlist!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'playlist', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-player__playlist__item', 'condition' => [ 'show_playlist!' => '', ], ] ); $this->add_control( 'playlist_background', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_SECONDARY, ], 'selectors' => [ '{{WRAPPER}} .ee-player__controls__playlist-wrapper' => 'background-color: {{VALUE}};', ], 'condition' => [ 'show_playlist!' => '', ], ] ); $this->add_control( 'heading_playlist_separator', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Separator', 'elementor-extras' ), 'separator' => 'before', 'condition' => [ 'show_playlist!' => '', ], ] ); $this->add_responsive_control( 'playlist_links_separator_thickness', [ 'label' => __( 'Thickness', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-player__playlist__item' => 'border-top: {{SIZE}}px solid;', ], 'condition' => [ 'show_playlist!' => '', ], ] ); $this->add_control( 'heading_playlist_links', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Links', 'elementor-extras' ), 'separator' => 'before', 'condition' => [ 'show_playlist!' => '', ], ] ); $this->add_responsive_control( 'playlist_links_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-player__playlist__item:not(:last-child)' => 'margin-bottom: {{SIZE}}px;', ], 'condition' => [ 'show_playlist!' => '', ], ] ); $this->add_control( 'playlist_links_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .ee-player__playlist__item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'show_playlist!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'playlist_links_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-player__playlist__item', 'condition' => [ 'show_playlist!' => '', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'image', 'selector' => '{{WRAPPER}} .ee-player__playlist__item', 'separator' => '', 'condition' => [ 'show_playlist!' => '', ], ] ); $this->start_controls_tabs( 'playlist_tabs' ); $this->start_controls_tab( 'playlist_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'playlist_links_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'show_playlist!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-player__playlist__item' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'playlist_links_separator_color', [ 'label' => __( 'Separator Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'show_playlist!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-player__playlist__item:not(:last-child)' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'playlist_links_background', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-player__playlist__item' => 'background-color: {{VALUE}};', ], 'condition' => [ 'show_playlist!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'playlist_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'playlist_links_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'show_playlist!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-player__playlist__item:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'playlist_links_separator_color_hover', [ 'label' => __( 'Separator Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'show_playlist!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-player__playlist__item:not(:last-child):hover' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'playlist_links_background_hover', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_ACCENT, ], 'selectors' => [ '{{WRAPPER}} .ee-player__playlist__item:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ 'show_playlist!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'playlist_current', [ 'label' => __( 'Current', 'elementor-extras' ) ] ); $this->add_control( 'playlist_links_color_current', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'show_playlist!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-player__playlist__item.ee--is-active, {{WRAPPER}} .ee-player__playlist__item.ee--is-active:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'playlist_links_separator_color_current', [ 'label' => __( 'Separator Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'condition' => [ 'show_playlist!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-player__playlist__item.ee--is-active:not(:last-child), {{WRAPPER}} .ee-player__playlist__item.ee--is-active:not(:last-child):hover' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'playlist_links_background_current', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-player__playlist__item.ee--is-active, {{WRAPPER}} .ee-player__playlist__item.ee--is-active:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ 'show_playlist!' => '', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 2.0.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'audio-wrapper' => [ 'class' => [ 'ee-audio-player', 'ee-player' ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'audio-wrapper' ); ?>> <?php $this->render_controls(); ?> </div><!-- .ee-audio-player --> <?php } /** * Render Controls * * @since 2.0.0 * @return void */ protected function render_controls() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'controls' => [ 'class' => [ 'ee-audio-player__controls', 'ee-player__controls', ], ], 'bar-wrapper' => [ 'class' => [ 'ee-player__controls__bar-wrapper', 'ee-audio-player__controls__bar-wrapper', ], ], 'bar' => [ 'class' => [ 'ee-player__controls__bar', ], ], 'control-previous' => [ 'class' => [ 'ee-player__control', 'ee-player__controls__previous', 'ee-player__control--icon', 'nicon', 'nicon-play-previous', ], ], 'control-play' => [ 'class' => [ 'ee-player__control', 'ee-player__controls__play', 'ee-player__control--icon', 'nicon', 'nicon-play', ], ], 'control-next' => [ 'class' => [ 'ee-player__control', 'ee-player__controls__next', 'ee-player__control--icon', 'nicon', 'nicon-play-next', ], ], ] ); ?> <div <?php echo $this->get_render_attribute_string( 'controls' ); ?>> <div <?php echo $this->get_render_attribute_string( 'bar-wrapper' ); ?>> <div <?php echo $this->get_render_attribute_string( 'bar' ); ?>> <?php if ( $settings['show_restart'] ) { $this->add_render_attribute( 'control-rewind', [ 'class' => [ 'ee-player__control', 'ee-player__controls__rewind', 'ee-player__control--icon', 'nicon', 'nicon-rewind', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-rewind' ); ?>></div><?php } ?> <?php if ( count( $settings[ 'playlist' ] ) > 1 ) { ?><div <?php echo $this->get_render_attribute_string( 'control-previous' ); ?>></div> <?php } ?> <div <?php echo $this->get_render_attribute_string( 'control-play' ); ?>></div> <?php if ( count( $settings[ 'playlist' ] ) > 1 ) { ?><div <?php echo $this->get_render_attribute_string( 'control-next' ); ?>></div> <?php } ?> <?php if ( $settings['show_time'] ) { $this->add_render_attribute( 'control-time', [ 'class' => [ 'ee-player__control', 'ee-player__control--indicator', 'ee-player__controls__time', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-time' ); ?>>00:00</div><?php } ?> <?php if ( $settings['show_progress'] ) { $this->add_render_attribute( [ 'control-progress' => [ 'class' => [ 'ee-player__control', 'ee-player__controls__progress', 'ee-player__control--progress', ], ], 'control-progress-time' => [ 'class' => [ 'ee-player__controls__progress-time', 'ee-player__control--progress__inner', ], ], 'control-progress-track' => [ 'class' => [ 'ee-player__control--progress__inner', 'ee-player__control--progress__track', ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-progress' ); ?>> <div <?php echo $this->get_render_attribute_string( 'control-progress-time' ); ?>></div> <div <?php echo $this->get_render_attribute_string( 'control-progress-track' ); ?>></div> </div><?php } ?> <?php if ( $settings['show_duration'] ) { $this->add_render_attribute( 'control-duration', [ 'class' => [ 'ee-player__control', 'ee-player__controls__duration', 'ee-player__control--indicator', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-duration' ); ?>>00:00</div><?php } ?> <?php if ( $settings['show_volume'] ) { $this->add_render_attribute( 'control-volume', [ 'class' => [ 'ee-player__control', 'ee-player__controls__volume', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-volume' ); ?>> <?php if ( $settings['show_volume_icon'] ) { $this->add_render_attribute( 'control-volume-icon', [ 'class' => [ 'ee-player__controls__volume-icon', 'ee-player__control--icon', 'nicon', 'nicon-volume', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-volume-icon' ); ?>></div><?php } ?> <?php if ( $settings['show_volume_bar'] ) { $this->add_render_attribute( [ 'control-volume-bar' => [ 'class' => [ 'ee-player__control', 'ee-player__controls__volume-bar', 'ee-player__control--progress', ], ], 'control-volume-bar-amount' => [ 'class' => [ 'ee-player__controls__volume-bar__amount', 'ee-player__control--progress__inner', ], ], 'control-volume-bar-track' => [ 'class' => [ 'ee-player__controls__volume-bar__track', 'ee-player__control--progress__inner', 'ee-player__control--progress__track', ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-volume-bar' ); ?>> <div <?php echo $this->get_render_attribute_string( 'control-volume-bar-amount' ); ?>></div> <div <?php echo $this->get_render_attribute_string( 'control-volume-bar-track' ); ?>></div> </div><?php } ?> </div><?php } ?> <?php if ( $settings['show_playlist'] && $settings['show_playlist_control'] ) { $this->add_render_attribute( 'control-browse', [ 'class' => [ 'ee-player__control', 'ee-player__control--icon', 'ee-player__controls__browse', 'fa', 'fa-list-ul', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-browse' ); ?>></div><?php } ?> </div><!-- .ee-player__controls__bar --> </div><!-- .ee-player__controls__bar-wrapper --> <?php $this->render_playlist(); ?> </div><!-- .ee-player__controls --> <?php } /** * Render Playlist * * @since 2.0.0 * @return void */ protected function render_playlist() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'playlist-wrapper' => [ 'class' => [ 'ee-player__controls__playlist-wrapper', 'ee-audio-player__controls__playlist-wrapper', ], ], 'playlist' => [ 'class' => [ 'ee-player__controls__playlist', 'ee-audio-player__playlist', 'ee-player__playlist', ], ], 'playlist-item-title' => [ 'class' => [ 'ee-player__playlist__item__title', 'ee-audio-player__playlist__item__title', ], ], 'playlist-item-duration' => [ 'class' => [ 'ee-player__playlist__item__duration', 'ee-audio-player__playlist__item__duration', ], ], ] ); if ( '' === $settings['show_playlist'] || '' === $settings['show_playlist_start'] ) { $this->add_render_attribute( 'playlist', 'class', 'ee-player__playlist--hidden' ); } ?> <div <?php echo $this->get_render_attribute_string( 'playlist-wrapper' ); ?>> <ul <?php echo $this->get_render_attribute_string( 'playlist' ); ?>> <?php foreach ( $settings['playlist'] as $index => $item ) { $sources = []; $sources['mpeg'] = $this->get_audio_source_url( $item, 'source_mpeg', 'audio_source' ); $sources['m4a'] = $this->get_audio_source_url( $item, 'source_m4a', 'audio_source_m4a' ); $sources['wav'] = $this->get_audio_source_url( $item, 'source_wav', 'audio_source_wav' ); $sources['ogg'] = $this->get_audio_source_url( $item, 'source_ogg', 'audio_source_ogg' ); $item['sources'] = $sources; if ( empty( $sources['mpeg'] ) && empty( $sources['m4a'] ) && empty( $sources['wav'] ) && empty( $sources['ogg'] ) ) continue; $playlist_item_key = $this->get_repeater_setting_key( 'item', 'playlist', $index ); $this->add_render_attribute( $playlist_item_key, [ 'class' => [ 'ee-player__playlist__item', 'ee-audio-player__playlist__item', ], 'id' => 'elementor-repeater-item-' . $item['_id'], ] ); ?><li <?php echo $this->get_render_attribute_string( $playlist_item_key ); ?>> <span <?php echo $this->get_render_attribute_string( 'playlist-item-title' ); ?>> <?php echo $item['title']; ?> </span> <span <?php echo $this->get_render_attribute_string( 'playlist-item-duration' ); ?>>00:00</span> <?php $this->render_audio( $item, $index ); ?> </li><!-- .ee-player__playlist__item --> <?php } ?> </ul><!-- .ee-player__controls__playlist --> </div><!-- .ee-player__controls__playlist-wrapper --> <?php } /* * Get Audio Source URL * * @since 2.1.0 * @return void */ protected function get_audio_source_url( $item, $format, $source_type ) { if ( 'file' === $item[ $source_type ] ) { if ( is_array( $item[ $format ] ) && array_key_exists( 'url', $item[ $format ] ) ) { return $item[ $format ]['url']; } else if ( filter_var( $item[ $format ], FILTER_VALIDATE_URL) ) { return $item[ $format ]; } } else { return $item[ $format . '_url']; } return ''; } /** * Render Audio * * Render html5 audio markup * * @since 2.0.0 * @return void */ protected function render_audio( $item, $index ) { $settings = $this->get_settings_for_display(); $audio_key = $this->get_repeater_setting_key( 'audio', 'playlist', $index ); $mp3_key = $this->get_repeater_setting_key( 'mp3', 'playlist', $index ); $m4a_key = $this->get_repeater_setting_key( 'm4a', 'playlist', $index ); $wav_key = $this->get_repeater_setting_key( 'wav', 'playlist', $index ); $ogg_key = $this->get_repeater_setting_key( 'ogg', 'playlist', $index ); $this->add_render_attribute( [ $audio_key => [ 'class' => [ 'ee-audio-player__source', 'ee-player__source' ], 'playsinline' => 'true', 'preload' => $settings['preload'], 'width' => '100%', 'height' => '100%', 'id' => 'audio-' . $this->get_id() . '-' . $item['_id'], ], ] ); if ( 'yes' === $settings['loop'] ) { $this->add_render_attribute( $audio_key, 'loop', 'true' ); } ?><audio <?php echo $this->get_render_attribute_string( $audio_key ); ?>> <?php if ( ! empty( $item['sources']['mpeg'] ) ) { $this->add_render_attribute( $mp3_key, [ 'src' => $item['sources']['mpeg'], 'type' => 'audio/mp3', ] ); ?><source <?php echo $this->get_render_attribute_string( $mp3_key ); ?>><?php } ?> <?php if ( ! empty( $item['sources']['m4a'] ) ) { $this->add_render_attribute( $m4a_key, [ 'src' => $item['sources']['m4a'], 'type' => 'audio/x-m4a', ] ); ?><source <?php echo $this->get_render_attribute_string( $m4a_key ); ?>><?php } ?> <?php if ( ! empty( $item['sources']['wav'] ) ) { $this->add_render_attribute( $wav_key, [ 'src' => $item['sources']['wav'], 'type' => 'audio/wav', ] ); ?><source <?php echo $this->get_render_attribute_string( $wav_key ); ?>><?php } ?> <?php if ( ! empty( $item['sources']['ogg'] ) ) { $this->add_render_attribute( $ogg_key, [ 'src' => $item['sources']['ogg'], 'type' => 'audio/ogg', ] ); ?><source <?php echo $this->get_render_attribute_string( $ogg_key ); ?>><?php } ?> </audio><?php } /** * Content Template * * Javascript content template for quick rendering * * @since 2.0.0 * @return void */ protected function content_template() { ?><# view.addRenderAttribute( { 'audio-wrapper' : { 'class' : [ 'ee-audio-player', 'ee-player', ], }, } ); #><div {{{ view.getRenderAttributeString( 'audio-wrapper' ) }}}> <?php echo $this->_controls_template(); ?> </div><!-- .ee-audio-player --><?php } /** * Controls Template * * Javascript controls template * * @since 2.0.0 * @return void */ protected function _controls_template() { ?><# view.addRenderAttribute({ 'controls' : { 'class' : [ 'ee-audio-player__controls', 'ee-player__controls', ], }, 'bar-wrapper' : { 'class' : [ 'ee-player__controls__bar-wrapper', 'ee-audio-player__controls__bar-wrapper', ], }, 'bar' : { 'class' : [ 'ee-player__controls__bar', ], }, 'control-previous' : { 'class' : [ 'ee-player__control', 'ee-player__controls__previous', 'ee-player__control--icon', 'nicon', 'nicon-play-previous', ], }, 'control-play' : { 'class' : [ 'ee-player__control', 'ee-player__controls__play', 'ee-player__control--icon', 'nicon', 'nicon-play', ], }, 'control-next' : { 'class' : [ 'ee-player__control', 'ee-player__controls__next', 'ee-player__control--icon', 'nicon', 'nicon-play-next', ], }, }); #><div {{{ view.getRenderAttributeString( 'controls' ) }}}> <div {{{ view.getRenderAttributeString( 'bar-wrapper' ) }}}> <div {{{ view.getRenderAttributeString( 'bar' ) }}}><# if ( settings.show_restart ) { view.addRenderAttribute( 'control-rewind', { 'class' : [ 'ee-player__control', 'ee-player__controls__rewind', 'ee-player__control--icon', 'nicon', 'nicon-rewind', ], } ); #><div {{{ view.getRenderAttributeString( 'control-rewind' ) }}}></div><# } #> <# if ( settings.playlist.length > 1 ) { #><div {{{ view.getRenderAttributeString( 'control-previous' ) }}}></div><# } #> <div {{{ view.getRenderAttributeString( 'control-play' ) }}}></div> <# if ( settings.playlist.length > 1 ) { #><div {{{ view.getRenderAttributeString( 'control-next' ) }}}></div><# } #> <# if ( settings.show_time ) { view.addRenderAttribute( 'control-time', { 'class' : [ 'ee-player__control', 'ee-player__control--indicator', 'ee-player__controls__time', ], } ); #><div {{{ view.getRenderAttributeString( 'control-time' ) }}}>00:00</div><# } #> <# if ( settings.show_progress ) { view.addRenderAttribute( { 'control-progress' : { 'class' : [ 'ee-player__control', 'ee-player__controls__progress', 'ee-player__control--progress', ], }, 'control-progress-time' : { 'class' : [ 'ee-player__controls__progress-time', 'ee-player__control--progress__inner', ], }, 'control-progress-track' : { 'class' : [ 'ee-player__control--progress__inner', 'ee-player__control--progress__track', ], }, } ); #><div {{{ view.getRenderAttributeString( 'control-progress' ) }}}> <div {{{ view.getRenderAttributeString( 'control-progress-time' ) }}}></div> <div {{{ view.getRenderAttributeString( 'control-progress-track' ) }}}></div> </div><# } #> <# if ( settings.show_duration ) { view.addRenderAttribute( 'control-duration', { 'class' : [ 'ee-player__control', 'ee-player__controls__duration', 'ee-player__control--indicator', ], } ); #><div {{{ view.getRenderAttributeString( 'control-duration' ) }}}>00:00</div><# } #> <# if ( settings.show_volume ) { view.addRenderAttribute( 'control-volume', { 'class' : [ 'ee-player__control', 'ee-player__controls__volume', ], } ); #><div {{{ view.getRenderAttributeString( 'control-volume' ) }}}> <# if ( settings.show_volume_icon ) { view.addRenderAttribute( 'control-volume-icon', { 'class' : [ 'ee-player__controls__volume-icon', 'ee-player__control--icon', 'nicon', 'nicon-volume', ], } ); #><div {{{ view.getRenderAttributeString( 'control-volume-icon' ) }}}></div><# } #> <# if ( settings.show_volume_bar ) { view.addRenderAttribute( { 'control-volume-bar' : { 'class' : [ 'ee-player__control', 'ee-player__controls__volume-bar', 'ee-player__control--progress', ], }, 'control-volume-bar-amount' : { 'class' : [ 'ee-player__controls__volume-bar__amount', 'ee-player__control--progress__inner', ], }, 'control-volume-bar-track' : { 'class' : [ 'ee-player__controls__volume-bar__track', 'ee-player__control--progress__inner', 'ee-player__control--progress__track', ], }, } ); #><div {{{ view.getRenderAttributeString( 'control-volume-bar' ) }}}> <div {{{ view.getRenderAttributeString( 'control-volume-bar-amount' ) }}}></div> <div {{{ view.getRenderAttributeString( 'control-volume-bar-track' ) }}}></div> </div><# } #> </div><# } #> <# if ( settings.show_playlist && settings.show_playlist_control ) { view.addRenderAttribute( 'control-browse', { 'class' : [ 'ee-player__control', 'ee-player__controls__browse', 'ee-player__control--icon', 'fa', 'fa-list-ul', ], } ); #><div {{{ view.getRenderAttributeString( 'control-browse' ) }}}></div><# } #> </div><!-- .ee-player__controls__bar --> </div><!-- .ee-player__controls__bar-wrapper --> <?php $this->_playlist_template(); ?> </div><!-- .ee-player__controls --> <?php } /** * Playlist Template * * Javascript playlist template * * @since 2.0.0 * @return void */ protected function _playlist_template() { ?><# view.addRenderAttribute( { 'playlist-wrapper' : { 'class' : [ 'ee-player__controls__playlist-wrapper', 'ee-audio-player__controls__playlist-wrapper', ], }, 'playlist' : { 'class' : [ 'ee-player__controls__playlist', 'ee-audio-player__playlist', 'ee-player__playlist', ], }, 'playlist-item-title' : { 'class' : [ 'ee-player__playlist__item__title', 'ee-audio-player__playlist__item__title', ], }, 'playlist-item-duration' : { 'class' : [ 'ee-player__playlist__item__duration', 'ee-audio-player__playlist__item__duration', ], }, } ); if ( '' === settings.show_playlist || '' === settings.show_playlist_start ) { view.addRenderAttribute( 'playlist', 'class', 'ee-player__playlist--hidden' ); } #><div {{{ view.getRenderAttributeString( 'playlist-wrapper' ) }}}> <ul {{{ view.getRenderAttributeString( 'playlist' ) }}}><# _.each( settings.playlist, function( item, index ) { var source_mpeg = ( 'file' === item.audio_source ) ? item.source_mpeg.url : item.source_mpeg_url, source_m4a = ( 'file' === item.audio_source_m4a ) ? item.source_m4a.url : item.source_m4a_url, source_wav = ( 'file' === item.audio_source_wav ) ? item.source_wav.url : item.source_wav_url, source_ogg = ( 'file' === item.audio_source_ogg ) ? item.source_ogg.url : item.source_ogg_url; if ( source_mpeg || source_m4a || source_wav || source_ogg ) { var playlistItemKey = view.getRepeaterSettingKey( 'item', 'playlist', index ); view.addRenderAttribute( playlistItemKey, { 'class' : [ 'ee-player__playlist__item', 'ee-audio-player__playlist__item', ], 'id' : 'elementor-repeater-item-' + item._id, } ); #><li {{{ view.getRenderAttributeString( playlistItemKey ) }}}> <span {{{ view.getRenderAttributeString( 'playlist-item-title' ) }}}> {{{ item.title }}} </span> <span {{{ view.getRenderAttributeString( 'playlist-item-duration' ) }}}>00:00</span><# var audioKey = view.getRepeaterSettingKey( 'audio', 'playlist', index ), mpegKey = view.getRepeaterSettingKey( 'mp3', 'playlist', index ), m4aKey = view.getRepeaterSettingKey( 'm4a', 'playlist', index ), wavKey = view.getRepeaterSettingKey( 'wav', 'playlist', index ), oggKey = view.getRepeaterSettingKey( 'ogg', 'playlist', index ); view.addRenderAttribute( audioKey, { 'class' : [ 'ee-audio-player__source', 'ee-player__source' ], 'playsinline' : 'true', 'width' : '100%', 'height' : '100%', 'id' : 'audio-' + view.$el.data('id') + '-' + item._id, } ); if ( 'yes' === settings.loop ) { view.addRenderAttribute( audioKey, 'loop', 'true' ); } #><audio {{{ view.getRenderAttributeString( audioKey ) }}}><# if ( source_mpeg ) { view.addRenderAttribute( mpegKey, { 'src' : source_mpeg, 'type' : 'audio/mp3', } ); #><source {{{ view.getRenderAttributeString( mpegKey ) }}}><# } #> <# if ( source_m4a ) { view.addRenderAttribute( m4aKey, { 'src' : source_m4a, 'type' : 'audio/x-m4a', } ); #><source {{{ view.getRenderAttributeString( wavKey ) }}}><# } #> <# if ( source_wav ) { view.addRenderAttribute( wavKey, { 'src' : source_wav, 'type' : 'audio/wav', } ); #><source {{{ view.getRenderAttributeString( wavKey ) }}}><# } #> <# if ( source_ogg ) { view.addRenderAttribute( oggKey, { 'src' : source_ogg, 'type' : 'audio/ogg', } ); #><source {{{ view.getRenderAttributeString( oggKey ) }}}><# } #> </audio> </li><!-- .ee-player__playlist__item --> <# } }); #> </ul><!-- .ee-player__controls__playlist --> </div><!-- .ee-player__controls__playlist-wrapper --><?php } } media-player/widgets/html5-video.php 0000644 00000155321 15112147616 0013444 0 ustar 00 <?php namespace ElementorExtras\Modules\MediaPlayer\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\MediaPlayer\Skins; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Control_Media; use Elementor\Utils; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Border; use Elementor\Group_Control_Background; use Elementor\Modules\DynamicTags\Module as TagsModule; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * HTML5_Video * * @since 1.3.0 */ class HTML5_Video extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 1.3.0 * @return string */ public function get_name() { return 'html5-video'; } /** * Get Title * * Get the title of the widget * * @since 1.3.0 * @return string */ public function get_title() { return __( 'Video Player', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 1.3.0 * @return string */ public function get_icon() { return 'nicon nicon-video'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 1.3.0 * @return array */ public function get_script_depends() { return [ 'video-player', 'jquery-appear', 'iphone-inline-video', ]; } /** * Register Skins * * @since 1.3.0 * @return void */ protected function register_skins() { // Comment until future development // $this->add_skin( new Skins\Skin_Classic( $this ) ); } /** * Register Widget Controls * * @since 1.3.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_content', [ 'label' => __( 'Content', 'elementor-extras' ), ] ); $this->start_controls_tabs( 'tabs_sources' ); $this->start_controls_tab( 'tab_source_mp4', [ 'label' => __( 'MP4', 'elementor-extras' ), ] ); $this->add_control( 'video_source', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'url', 'options' => [ 'url' => __( 'URL', 'elementor-extras' ), 'file' => __( 'File', 'elementor-extras' ), ], ] ); $this->add_control( 'video_url', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'description' => __( 'Insert URL to an .mp4 video file', 'elementor-extras' ), 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::URL_CATEGORY, ], ], 'condition' => [ 'video_source' => 'url', ], ] ); $this->add_control( 'video_file', [ 'label' => __( 'File', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::MEDIA_CATEGORY, ], ], 'media_type' => 'video', 'condition' => [ 'video_source' => 'file', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_source_m4v', [ 'label' => __( 'M4V', 'elementor-extras' ), ] ); $this->add_control( 'video_source_m4v', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'url', 'options' => [ 'url' => __( 'URL', 'elementor-extras' ), 'file' => __( 'File', 'elementor-extras' ), ], ] ); $this->add_control( 'video_url_m4v', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'description' => __( 'Insert URL to a .m4v video file', 'elementor-extras' ), 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::URL_CATEGORY, ], ], 'condition' => [ 'video_source_m4v' => 'url', ], ] ); $this->add_control( 'video_file_m4v', [ 'label' => __( 'File', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::MEDIA_CATEGORY, ], ], 'media_type' => 'video', 'condition' => [ 'video_source_m4v' => 'file', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_source_ogg', [ 'label' => __( 'OGG', 'elementor-extras' ), ] ); $this->add_control( 'video_source_ogg', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'url', 'options' => [ 'url' => __( 'URL', 'elementor-extras' ), 'file' => __( 'File', 'elementor-extras' ), ], ] ); $this->add_control( 'video_url_ogg', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'description' => __( 'Insert URL to an .ogg video file', 'elementor-extras' ), 'dynamic' => [ 'active' => true, ], 'condition' => [ 'video_source_ogg' => 'url', 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::URL_CATEGORY, ], ], ] ); $this->add_control( 'video_file_ogg', [ 'label' => __( 'File', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::MEDIA_CATEGORY, ], ], 'media_type' => 'video', 'condition' => [ 'video_source_ogg' => 'file', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_source_webm', [ 'label' => __( 'WEBM', 'elementor-extras' ), ] ); $this->add_control( 'video_source_webm', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'url', 'options' => [ 'url' => __( 'URL', 'elementor-extras' ), 'file' => __( 'File', 'elementor-extras' ), ], ] ); $this->add_control( 'video_url_webm', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'description' => __( 'Insert URL to a .webm video file', 'elementor-extras' ), 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::URL_CATEGORY, ], ], 'condition' => [ 'video_source_webm' => 'url', ], ] ); $this->add_control( 'video_file_webm', [ 'label' => __( 'File', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, TagsModule::MEDIA_CATEGORY, ], ], 'media_type' => 'video', 'condition' => [ 'video_source_webm' => 'file', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'video_cover', [ 'label' => __( 'Choose Cover', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true ], 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'video_cover', 'label' => __( 'Cover Size', 'elementor-extras' ), 'default' => 'large', 'condition' => [ 'video_cover[url]!' => '', ] ] ); $this->end_controls_section(); $this->start_controls_section( 'section_settings', [ 'label' => __( 'Settings', 'elementor-extras' ), ] ); $this->add_control( 'video_behaviour_heading', [ 'label' => __( 'Behaviour', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'video_autoplay', [ 'label' => __( 'Auto Play', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'autoplay', ] ); $this->add_control( 'video_autoplay_notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Many browsers don\'t allow videos with sound to autoplay without user interaction. To avoid this, enable the "Start Muted" control to disable sound so that the video autoplays correctly.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'condition' => [ 'video_autoplay!' => '' ], ] ); $this->add_control( 'video_stop_others', [ 'label' => __( 'Stop Others', 'elementor-extras' ), 'description' => __( 'Stop all other videos on page when this video is played.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'video_play_viewport', [ 'label' => __( 'Play in Viewport', 'elementor-extras' ), 'description' => __( 'Autoplay video when the player is in viewport', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'video_autoplay' => 'autoplay', ], 'frontend_available' => true, ] ); $this->add_control( 'video_stop_viewport', [ 'label' => __( 'Stop on leave', 'elementor-extras' ), 'description' => __( 'Stop video when the player has left the viewport', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'video_autoplay' => 'autoplay', 'video_play_viewport' => 'yes', ], 'frontend_available' => true, ] ); $this->add_control( 'video_restart_on_pause', [ 'label' => __( 'Restart on pause', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'video_loop', [ 'label' => __( 'Loop', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'loop', ] ); $this->add_control( 'video_end_at_last_frame', [ 'label' => __( 'End at last frame', 'elementor-extras' ), 'description' => __( 'End the video at the last frame instead of showing the first one.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'video_loop' => '', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'video_speed', [ 'label' => __( 'Playback Speed', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 5, 'min' => 0.1, 'step' => 0.01, ], ], 'frontend_available' => true, ] ); $this->add_control( 'video_display_heading', [ 'label' => __( 'Display', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'video_show_buttons', [ 'label' => __( 'Show Buttons', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', ] ); $this->add_control( 'video_show_bar', [ 'label' => __( 'Show Bar', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', ] ); $this->add_control( 'video_bar_hide', [ 'label' => __( 'Hide Bar When Playing', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'hide', 'prefix_class' => 'ee-video-player-bar--', 'return_value' => 'hide', 'condition' => [ 'video_show_bar' => 'show', ], ] ); $this->add_control( 'video_show_rewind', [ 'label' => __( 'Show Rewind', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'video_restart_on_pause!' => 'yes', ], ] ); $this->add_control( 'video_show_time', [ 'label' => __( 'Show Time', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'video_show_bar!' => '', ] ] ); $this->add_control( 'video_show_progress', [ 'label' => __( 'Show Progress', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'video_show_bar!' => '', ] ] ); $this->add_control( 'video_show_duration', [ 'label' => __( 'Show Duration', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'video_show_bar!' => '', ] ] ); $this->add_control( 'video_show_fs', [ 'label' => __( 'Show Fullscreen', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'video_show_bar!' => '', ] ] ); $this->add_control( 'video_fs_hide_download', [ 'label' => __( 'Hide Fullscreen Download', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'condition' => [ 'video_show_fs!' => '', ], ] ); $this->add_control( 'video_fs_no_rightclick', [ 'label' => __( 'Disable Fullscreen Right Click', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'video_show_fs!' => '', ], ] ); $this->add_control( 'video_volume_heading', [ 'label' => __( 'Volume', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'video_show_volume', [ 'label' => __( 'Show Volume', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'video_show_bar!' => '', ] ] ); $this->add_control( 'video_show_volume_icon', [ 'label' => __( 'Show Volume Icon', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'video_show_bar!' => '', 'video_show_volume!' => '', ] ] ); $this->add_control( 'video_show_volume_bar', [ 'label' => __( 'Show Volume Bar', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'show', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'show', 'condition' => [ 'video_show_bar!' => '', 'video_show_volume!' => '', ] ] ); $this->add_control( 'video_start_muted', [ 'label' => __( 'Start Muted', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'condition' => [ 'video_autoplay!' => '', ] ] ); $this->add_responsive_control( 'video_volume', [ 'label' => __( 'Initial Volume', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.8, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'frontend_available' => true, 'condition' => [ 'video_start_muted!' => 'yes', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_video_style', [ 'label' => __( 'Player', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'video_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ '%' => [ 'min' => 0, 'max' => 100, ], 'px' => [ 'min' => 0, 'max' => 600, ], ], 'size_units' => [ '%', 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-video-player' => 'max-width: {{SIZE}}{{UNIT}};', ] ] ); $this->add_responsive_control( 'video_align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'video_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-video-player', ] ); $this->add_control( 'video_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-video-player' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'video_box_shadow', 'selector' => '{{WRAPPER}} .ee-video-player', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_video_overlay', [ 'label' => __( 'Overlay', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'video_overlay_background', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '#000000', 'selectors' => [ '{{WRAPPER}} .ee-video-player__cover::after' => 'background-color: {{VALUE}}', ], ] ); $this->add_responsive_control( 'video_overlay_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.8, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__cover::after' => 'opacity: {{SIZE}}', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style', [ 'label' => __( 'Interface', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'video_show_buttons', 'operator' => '==', 'value' => 'show', ], [ 'name' => 'video_show_bar', 'operator' => '==', 'value' => 'show', ], ], ], ] ); $this->add_control( 'video_controls_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'default' => [ 'top' => 100, 'right' => 100, 'bottom' => 100, 'left' => 100, 'unit' => 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar .ee-player__control--progress' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar .ee-player__control--progress__inner' => 'border-radius: 0 {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} 0;' ], ] ); $this->start_controls_tabs( 'tabs_controls_style' ); $this->start_controls_tab( 'video_controls', [ 'label' => __( 'Default', 'elementor-extras' ), ] ); $this->add_control( 'video_controls_foreground', [ 'label' => __( 'Controls Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar' => 'color: {{VALUE}}', '{{WRAPPER}} .ee-video-player__controls .ee-player__control--progress__inner' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'video_controls_background', [ 'label' => __( 'Controls Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'video_controls_opacity', [ 'label' => __( 'Controls Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.9, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar' => 'opacity: {{SIZE}}', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'video_controls_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'video_controls_shadow', 'selector' => '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'video_controls_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), ] ); $this->add_control( 'video_controls_foreground_hover', [ 'label' => __( 'Controls Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '(desktop+){{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control:hover, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar:hover' => 'color: {{VALUE}}', '(desktop+){{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar:hover .ee-player__control--progress__inner' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'video_controls_background_hover', [ 'label' => __( 'Controls Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '(desktop+){{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control:hover, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar:hover' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'video_controls_opacity_hover', [ 'label' => __( 'Controls Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '(desktop+){{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control:hover, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar:hover' => 'opacity: {{SIZE}}', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'video_controls_border_hover', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '(desktop+){{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control:hover, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar:hover', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'video_controls_shadow_hover', 'selector' => '(desktop+){{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control:hover, {{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar:hover', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_buttons_style', [ 'label' => __( 'Buttons', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'video_show_buttons!' => '', ], ] ); $this->add_responsive_control( 'video_buttons_size', [ 'label' => __( 'Size (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 60, ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__control' => 'font-size: {{SIZE}}px; width: {{SIZE}}px; height: {{SIZE}}px;', ], 'condition' => [ 'video_show_buttons!' => '', ], ] ); $this->add_responsive_control( 'video_buttons_spacing', [ 'label' => __( 'Controls Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__overlay .ee-player__controls__rewind' => 'margin-right: {{SIZE}}px;', ], 'condition' => [ 'video_show_buttons!' => '', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_bar_style', [ 'label' => __( 'Bar', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'video_show_bar!' => '', ], ] ); $this->add_responsive_control( 'video_bar_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'max' => 72, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar' => 'padding: {{SIZE}}px', ], 'condition' => [ 'video_show_bar!' => '', ], ] ); $this->add_responsive_control( 'video_bar_margin', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'max' => 72, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar-wrapper' => 'padding: 0 {{SIZE}}px {{SIZE}}px {{SIZE}}px', ], 'condition' => [ 'video_show_bar!' => '', ], ] ); $this->add_control( 'video_bar_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'video_show_bar!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'bar', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-player__control--indicator', ] ); $this->add_control( 'controls_heading', [ 'label' => __( 'Controls', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'video_show_bar!' => '', ], ] ); $this->add_responsive_control( 'video_bar_zoom', [ 'label' => __( 'Zoom', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'max' => 36, 'min' => 6, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar' => 'font-size: {{SIZE}}px', '{{WRAPPER}} .ee-video-player__controls .ee-player__controls__bar .ee-player__control--progress' => 'height: {{SIZE}}px', ], 'condition' => [ 'video_show_bar!' => '', ], ] ); $this->add_responsive_control( 'video_bar_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'max' => 24, 'min' => 3, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-video-player__controls .ee-player__control--indicator, {{WRAPPER}} .ee-video-player__controls .ee-player__control--icon' => 'padding: 0 {{SIZE}}px', '{{WRAPPER}} .ee-video-player__controls .ee-player__control--progress' => 'margin: 0 {{SIZE}}px', ], 'condition' => [ 'video_show_bar!' => '', ], ] ); $this->add_control( 'controls_progress_heading', [ 'label' => __( 'Progress', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'video_show_bar!' => '', 'video_show_progress!' => '', ], ] ); $this->add_responsive_control( 'progress_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 90, 'min' => 10, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-player__controls__progress' => 'flex-basis: {{SIZE}}%', ], 'condition' => [ 'video_show_bar!' => '', 'video_show_progress!' => '', ], ] ); $this->add_control( 'controls_volume_heading', [ 'label' => __( 'Volume', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'video_show_bar!' => '', 'video_show_volume_bar!' => '', 'video_show_volume!' => '', ], ] ); $this->add_responsive_control( 'volume_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 90, 'min' => 10, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-player__controls__volume' => 'flex-basis: {{SIZE}}%', ], 'separator' => 'after', 'condition' => [ 'video_show_bar!' => '', 'video_show_volume_bar!' => '', 'video_show_volume!' => '', ], ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 1.3.0 * @return void */ public function render() { $settings = $this->get_settings_for_display(); if ( empty( $settings['video_file']['url'] ) && empty( $settings['video_file_ogg']['url'] ) && empty( $settings['video_file_webm']['url'] ) && empty( $settings['video_file_m4v']['url'] ) && empty( $settings['video_url'] ) && empty( $settings['video_url_ogg'] ) && empty( $settings['video_url_webm'] ) && empty( $settings['video_url_m4v'] ) ) return; $this->add_render_attribute( [ 'video-wrapper' => [ 'class' => [ 'ee-video-player', 'ee-player' ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'video-wrapper' ); ?>> <?php $this->render_video(); ?> <?php $this->render_cover(); ?> <?php $this->render_controls(); ?> </div><!-- .ee-video-player --> <?php } /** * Render Video * * Render html5 video markup * * @since 1.3.0 * @return void */ protected function render_video() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( 'video', [ 'class' => [ 'ee-video-player__source', 'ee-player__source' ], 'playsinline' => 'true', 'width' => '100%', 'height' => '100%', ] ); if ( 'yes' === $settings['video_fs_hide_download'] ) { $this->add_render_attribute( 'video', 'controlsList', 'nodownload' ); } if ( 'autoplay' === $settings['video_autoplay'] && 'yes' !== $settings['video_play_viewport'] ) { $this->add_render_attribute( 'video', 'autoplay', 'true' ); } if ( 'yes' === $settings['video_start_muted'] ) { $this->add_render_attribute( 'video', 'muted', 'true' ); } if ( 'loop' === $settings['video_loop'] ) { $this->add_render_attribute( 'video', 'loop', 'true' ); } if ( ! empty( $settings['video_cover']['url'] ) ) { $url = Group_Control_Image_Size::get_attachment_image_src( $settings['video_cover']['id'], 'video_cover', $settings ); $this->add_render_attribute( 'video', 'poster', $url ); } ?><video <?php echo $this->get_render_attribute_string( 'video' ); ?>><?php $video_url = ( 'file' === $settings['video_source'] ) ? $settings['video_file']['url'] : $settings['video_url']; $video_url_m4v = ( 'file' === $settings['video_source_m4v'] ) ? $settings['video_file_m4v']['url'] : $settings['video_url_m4v']; $video_url_ogg = ( 'file' === $settings['video_source_ogg'] ) ? $settings['video_file_ogg']['url'] : $settings['video_url_ogg']; $video_url_webm = ( 'file' === $settings['video_source_webm'] ) ? $settings['video_file_webm']['url'] : $settings['video_url_webm']; if ( $video_url ) { $this->add_render_attribute( 'source-mp4', [ 'src' => $video_url, 'type' => 'video/mp4', ] ); ?><source <?php echo $this->get_render_attribute_string( 'source-mp4' ); ?>><?php } ?> <?php if ( $video_url_m4v ) { $this->add_render_attribute( 'source-m4v', [ 'src' => $video_url_m4v, 'type' => 'video/m4v', ] ); ?><source <?php echo $this->get_render_attribute_string( 'source-m4v' ); ?>><?php } ?> <?php if ( $video_url_ogg ) { $this->add_render_attribute( 'source-ogg', [ 'src' => $video_url_ogg, 'type' => 'video/ogg', ] ); ?><source <?php echo $this->get_render_attribute_string( 'source-wav' ); ?>><?php } ?> <?php if ( $video_url_webm ) { $this->add_render_attribute( 'source-webm', [ 'src' => $video_url_webm, 'type' => 'video/webm', ] ); ?><source <?php echo $this->get_render_attribute_string( 'source-webm' ); ?>><?php } ?> </video><?php } /** * Render Cover * * @since 1.3.0 * @return void */ protected function render_cover() { $this->add_render_attribute( 'video-cover', [ 'class' => [ 'ee-video-player__cover', 'ee-player__cover', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'video-cover' ); ?>></div><?php } /** * Render Controls * * @since 1.3.0 * @return void */ protected function render_controls() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'controls' => [ 'class' => [ 'ee-video-player__controls', 'ee-player__controls', ], ], 'bar-wrapper' => [ 'class' => [ 'ee-player__controls__bar-wrapper', 'ee-video-player__controls__bar-wrapper', ], ], 'bar' => [ 'class' => [ 'ee-player__controls__bar', ], ], 'control-play' => [ 'class' => [ 'ee-player__control', 'ee-player__controls__play', 'ee-player__control--icon', 'nicon', 'nicon-play', ], ], ] ); ?> <div <?php echo $this->get_render_attribute_string( 'controls' ); ?>><?php $this->render_overlay(); if ( 'show' === $settings['video_show_bar'] ) { ?><div <?php echo $this->get_render_attribute_string( 'bar-wrapper' ); ?>> <div <?php echo $this->get_render_attribute_string( 'bar' ); ?>> <?php if ( 'yes' !== $settings['video_restart_on_pause'] && 'show' === $settings['video_show_rewind'] ) { $this->add_render_attribute( 'control-rewind', [ 'class' => [ 'ee-player__control', 'ee-player__controls__rewind', 'ee-player__control--icon', 'nicon', 'nicon-rewind', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-rewind' ); ?>></div><?php } ?> <div <?php echo $this->get_render_attribute_string( 'control-play' ); ?>></div> <?php if ( $settings['video_show_time'] ) { $this->add_render_attribute( 'control-time', [ 'class' => [ 'ee-player__control', 'ee-player__control--indicator', 'ee-player__controls__time', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-time' ); ?>>00:00</div><?php } ?> <?php if ( $settings['video_show_progress'] ) { $this->add_render_attribute( [ 'control-progress' => [ 'class' => [ 'ee-player__control', 'ee-player__controls__progress', 'ee-player__control--progress', ], ], 'control-progress-time' => [ 'class' => [ 'ee-player__controls__progress-time', 'ee-player__control--progress__inner', ], ], 'control-progress-track' => [ 'class' => [ 'ee-player__control--progress__inner', 'ee-player__control--progress__track', ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-progress' ); ?>> <div <?php echo $this->get_render_attribute_string( 'control-progress-time' ); ?>></div> <div <?php echo $this->get_render_attribute_string( 'control-progress-track' ); ?>></div> </div><?php } ?> <?php if ( $settings['video_show_duration'] ) { $this->add_render_attribute( 'control-duration', [ 'class' => [ 'ee-player__control', 'ee-player__controls__duration', 'ee-player__control--indicator', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-duration' ); ?>>00:00</div><?php } ?> <?php if ( $settings['video_show_volume'] ) { $this->add_render_attribute( 'control-volume', [ 'class' => [ 'ee-player__control', 'ee-player__controls__volume', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-volume' ); ?>> <?php if ( $settings['video_show_volume_icon'] ) { $this->add_render_attribute( 'control-volume-icon', [ 'class' => [ 'ee-player__controls__volume-icon', 'ee-player__control--icon', 'nicon', 'nicon-volume', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-volume-icon' ); ?>></div><?php } ?> <?php if ( $settings['video_show_volume_bar'] ) { $this->add_render_attribute( [ 'control-volume-bar' => [ 'class' => [ 'ee-player__control', 'ee-player__controls__volume-bar', 'ee-player__control--progress', ], ], 'control-volume-bar-amount' => [ 'class' => [ 'ee-player__controls__volume-bar__amount', 'ee-player__control--progress__inner', ], ], 'control-volume-bar-track' => [ 'class' => [ 'ee-player__controls__volume-bar__track', 'ee-player__control--progress__inner', 'ee-player__control--progress__track', ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-volume-bar' ); ?>> <div <?php echo $this->get_render_attribute_string( 'control-volume-bar-amount' ); ?>></div> <div <?php echo $this->get_render_attribute_string( 'control-volume-bar-track' ); ?>></div> </div><?php } ?> </div><?php } ?> <?php if ( $settings['video_show_fs'] ) { $this->add_render_attribute( 'control-fullscreen', [ 'class' => [ 'ee-player__control', 'ee-player__controls__fs', 'ee-player__control--icon', 'nicon', 'nicon-expand' ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'control-fullscreen' ); ?>></div><?php } ?> </div><!-- .ee-player__controls__bar --> </div><!-- .ee-player__controls__bar-wrapper --> <?php } ?> </div><!-- .ee-video-player__controls --> <?php } /** * Render Overlay * * @since 1.3.0 * @return void */ protected function render_overlay() { $settings = $this->get_settings_for_display(); if ( 'show' === $settings['video_show_buttons'] ) { $this->add_render_attribute( [ 'overlay' => [ 'class' => [ 'ee-player__controls__overlay', 'ee-video-player__overlay', ], ], 'overlay-play' => [ 'class' => [ 'ee-player__control', 'ee-player__controls__play', 'nicon', 'nicon-play', ], ], ] ); ?><ul <?php echo $this->get_render_attribute_string( 'overlay' ); ?>><?php if ( 'yes' !== $settings['video_restart_on_pause'] && 'show' === $settings['video_show_rewind'] ) { $this->add_render_attribute( 'overlay-rewind', [ 'class' => [ 'ee-player__control', 'ee-player__controls__rewind', 'nicon', 'nicon-rewind', ], ] ) ?><li <?php echo $this->get_render_attribute_string( 'overlay-rewind' ); ?>></li><?php } ?><li <?php echo $this->get_render_attribute_string( 'overlay-play' ); ?>></li> </ul> <?php } } /** * Content Template * * Javascript content template for quick rendering * * @since 1.3.0 * @return void */ protected function content_template() { ?><# if ( '' !== settings.video_file.url || '' !== settings.video_file_ogg.url || '' !== settings.video_file_webm.url || '' !== settings.video_file_m4v.url || '' !== settings.video_url || '' !== settings.video_url_ogg || '' !== settings.video_url_webm || '' !== settings.video_url_m4v ) { view.addRenderAttribute( { 'video-wrapper' : { 'class' : [ 'ee-video-player', 'ee-player', ], }, } ); #><div {{{ view.getRenderAttributeString( 'video-wrapper' ) }}}> <?php echo $this->_video_template(); ?> <?php echo $this->_cover_template(); ?> <?php echo $this->_controls_template(); ?> </div><!-- .ee-player --> <# } #><?php } /** * Video Template * * Javascript video template * * @since 1.3.0 * @return void */ protected function _video_template() { ?><# view.addRenderAttribute( 'video', { 'class' : [ 'ee-video-player__source', 'ee-player__source' ], 'playsinline' : 'true', 'width' : '100%', 'height' : '100%', } ); if( 'autoplay' === settings.video_autoplay && 'yes' !== settings.video_play_viewport ) { view.addRenderAttribute( 'video', 'autoplay', 'true' ); } if( 'yes' === settings.video_start_muted ) { view.addRenderAttribute( 'video', 'muted', 'true' ); } if ( 'loop' === settings.video_loop ) { view.addRenderAttribute( 'video', 'loop', 'true' ); } if ( settings.video_cover.id ) { var image = { id : settings.video_cover.id, url : settings.video_cover.url, size : settings.image_size, dimension : settings.image_custom_dimension, model : view.getEditModel(), }; view.addRenderAttribute( 'video', 'poster', elementor.imagesManager.getImageUrl( image ) ); } #><video {{{ view.getRenderAttributeString( 'video' ) }}}><# var video_url = ( 'file' === settings.video_source ) ? settings.video_file.url : settings.video_url, video_url_m4v = ( 'file' === settings.video_source_m4v ) ? settings.video_file_m4v.url : settings.video_url_m4v, video_url_ogg = ( 'file' === settings.video_source_ogg ) ? settings.video_file_ogg.url : settings.video_url_ogg, video_url_webm = ( 'file' === settings.video_source_webm ) ? settings.video_file_webm.url : settings.video_url_webm; if ( video_url ) { view.addRenderAttribute( 'source-mp4', { 'src' : video_url, 'type' : 'video/mp4', } ); #><source {{{ view.getRenderAttributeString( 'source-mp4' ) }}}><# } #> <# if ( video_url_m4v ) { view.addRenderAttribute( 'source-m4v', { 'src' : video_url_m4v, 'type' : 'video/m4v', } ); #><source {{{ view.getRenderAttributeString( 'source-m4v' ) }}}><# } #> <# if ( video_url_ogg ) { view.addRenderAttribute( 'source-ogg', { 'src' : video_url_ogg, 'type' : 'video/ogg', } ); #><source {{{ view.getRenderAttributeString( 'source-ogg' ) }}}><# } #> <# if ( video_url_webm ) { view.addRenderAttribute( 'source-webm', { 'src' : video_url_webm, 'type' : 'video/webm', } ); #><source {{{ view.getRenderAttributeString( 'source-webm' ) }}}><# } #> </video> <?php } /** * Controls Template * * Javascript controls template * * @since 1.3.0 * @return void */ protected function _controls_template() { ?><# view.addRenderAttribute({ 'controls' : { 'class' : [ 'ee-video-player__controls', 'ee-player__controls', ], }, 'bar-wrapper' : { 'class' : [ 'ee-player__controls__bar-wrapper', 'ee-video-player__controls__bar-wrapper', ], }, 'bar' : { 'class' : [ 'ee-player__controls__bar', ], }, 'control-play' : { 'class' : [ 'ee-player__control', 'ee-player__controls__play', 'ee-player__control--icon', 'nicon', 'nicon-play', ], }, }); #><div {{{ view.getRenderAttributeString( 'controls' ) }}}> <?php $this->_overlay_template(); ?> <# if ( 'show' === settings.video_show_bar ) { #> <div {{{ view.getRenderAttributeString( 'bar-wrapper' ) }}}> <div {{{ view.getRenderAttributeString( 'bar' ) }}}> <# if ( 'yes' !== settings.video_restart_on_pause && 'show' === settings.video_show_rewind ) { view.addRenderAttribute( 'control-rewind', { 'class' : [ 'ee-player__control', 'ee-player__controls__rewind', 'ee-player__control--icon', 'nicon', 'nicon-rewind', ], } ); #><div {{{ view.getRenderAttributeString( 'control-rewind' ) }}}></div><# } #> <div {{{ view.getRenderAttributeString( 'control-play' ) }}}></div> <# if ( settings.video_show_time ) { view.addRenderAttribute( 'control-time', { 'class' : [ 'ee-player__control', 'ee-player__control--indicator', 'ee-player__controls__time', ], } ); #><div {{{ view.getRenderAttributeString( 'control-time' ) }}}>00:00</div><# } #> <# if ( settings.video_show_progress ) { view.addRenderAttribute( { 'control-progress' : { 'class' : [ 'ee-player__control', 'ee-player__controls__progress', 'ee-player__control--progress', ], }, 'control-progress-time' : { 'class' : [ 'ee-player__controls__progress-time', 'ee-player__control--progress__inner', ], }, 'control-progress-track' : { 'class' : [ 'ee-player__control--progress__inner', 'ee-player__control--progress__track', ], }, } ); #><div {{{ view.getRenderAttributeString( 'control-progress' ) }}}> <div {{{ view.getRenderAttributeString( 'control-progress-time' ) }}}></div> <div {{{ view.getRenderAttributeString( 'control-progress-track' ) }}}></div> </div><# } #> <# if ( settings.video_show_duration ) { view.addRenderAttribute( 'control-duration', { 'class' : [ 'ee-player__control', 'ee-player__controls__duration', 'ee-player__control--indicator', ], } ); #><div {{{ view.getRenderAttributeString( 'control-duration' ) }}}>00:00</div><# } #> <# if ( settings.video_show_volume ) { view.addRenderAttribute( 'control-volume', { 'class' : [ 'ee-player__control', 'ee-player__controls__volume', ], } ); #><div {{{ view.getRenderAttributeString( 'control-volume' ) }}}> <# if ( settings.video_show_volume_icon ) { view.addRenderAttribute( 'control-volume-icon', { 'class' : [ 'ee-player__controls__volume-icon', 'ee-player__control--icon', 'nicon', 'nicon-volume', ], } ); #><div {{{ view.getRenderAttributeString( 'control-volume-icon' ) }}}></div><# } #> <# if ( settings.video_show_volume_bar ) { view.addRenderAttribute( { 'control-volume-bar' : { 'class' : [ 'ee-player__control', 'ee-player__controls__volume-bar', 'ee-player__control--progress', ], }, 'control-volume-bar-amount' : { 'class' : [ 'ee-player__controls__volume-bar__amount', 'ee-player__control--progress__inner', ], }, 'control-volume-bar-track' : { 'class' : [ 'ee-player__controls__volume-bar__track', 'ee-player__control--progress__inner', 'ee-player__control--progress__track', ], }, } ); #><div {{{ view.getRenderAttributeString( 'control-volume-bar' ) }}}> <div {{{ view.getRenderAttributeString( 'control-volume-bar-amount' ) }}}></div> <div {{{ view.getRenderAttributeString( 'control-volume-bar-track' ) }}}></div> </div><# } #> </div><# } #> </div><!-- .ee-player__controls__bar --> </div><!-- .ee-player__controls__bar-wrapper --> <# } #> </div><!-- .ee-player__controls --> <?php } /** * Cover Template * * Javascript cover template * * @since 1.3.0 * @return void */ protected function _cover_template() { ?><# view.addRenderAttribute( 'video-cover', { 'class' : [ 'ee-video-player__cover', 'ee-player__cover', ], } ); #><div {{{ view.getRenderAttributeString( 'video-cover' ) }}}></div><?php } /** * Overlay Template * * Javascript overlay template * * @since 1.3.0 * @return void */ protected function _overlay_template() { ?><# if ( 'show' === settings.video_show_buttons ) { view.addRenderAttribute( { 'overlay' : { 'class' : [ 'ee-player__controls__overlay', 'ee-video-player__overlay', ], }, 'overlay-play' : { 'class' : [ 'ee-player__control', 'ee-player__controls__play', 'nicon', 'nicon-play', ], }, } ); #><ul {{{ view.getRenderAttributeString( 'overlay' ) }}}><# if ( 'yes' !== settings.video_restart_on_pause && 'show' === settings.video_show_rewind ) { view.addRenderAttribute( 'overlay-rewind', { 'class' : [ 'ee-player__control', 'ee-player__controls__rewind', 'nicon', 'nicon-rewind', ], } ) #><li {{{ view.getRenderAttributeString( 'overlay-rewind' ) }}}></li><# } #><li {{{ view.getRenderAttributeString( 'overlay-play' ) }}}></li> </ul> <# } #><?php } } media-player/module.php 0000644 00000001174 15112147616 0011122 0 ustar 00 <?php namespace ElementorExtras\Modules\MediaPlayer; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\MediaPlayer\Module * * @since 1.6.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.6.0 * @return string */ public function get_name() { return 'media-player'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.6.0 * @return array */ public function get_widgets() { return [ 'HTML5_Video', 'Audio_Player', ]; } } navigation/skins/skin-base.php 0000644 00000002351 15112147616 0012424 0 ustar 00 <?php namespace ElementorExtras\Modules\Navigation\Skins; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Skin_Base as Elementor_Skin_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Navigation\Skins * * @since 2.0.0 */ abstract class Skin_Base extends Elementor_Skin_Base { /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.0.0 * @return void */ protected function _register_controls_actions() { add_action( 'elementor/element/ee-popup/section_items/before_section_end', [ $this, 'register_controls' ] ); } /** * Register Controls * * @since 2.0.0 * @return void * @param $widget Extras_Widget */ public function register_controls( Extras_Widget $widget ) { $this->parent = $widget; $this->register_content_controls(); } /** * Register Content Controls * * @since 2.0.0 * @return void */ public function register_content_controls() {} /** * Render * * Render widget contents on frontend * * @since 2.0.0 * @return void */ public function render() { $this->parent->render(); } } navigation/skins/skin-classic.php 0000644 00000002131 15112147616 0013127 0 ustar 00 <?php namespace ElementorExtras\Modules\Navigation\Skins; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Navigation\Skins * * @since 2.0.0 */ class Skin_Classic extends Skin_Base { /** * Get ID * * Gets the current skin ID * * @since 2.0.0 * @return string */ public function get_id() { return 'classic'; } /** * Get Title * * Gets the current skin title * * @since 2.0.0 * @return string */ public function get_title() { return __( 'Classic', 'elementor-extras' ); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.0.0 * @return void */ protected function _register_controls_actions() { parent::_register_controls_actions(); // add_action( 'elementor/element/posts-extra/section_query/after_section_end', [ $this, 'register_parallax_controls' ] ); } /** * Register Layout Content Controls * * @since 2.0.0 * @return void */ public function register_layout_content_controls() { parent::register_layout_content_controls(); } } navigation/widgets/offcanvas.php 0000644 00000145416 15112147616 0013047 0 ustar 00 <?php namespace ElementorExtras\Modules\Navigation\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\Navigation\Skins; use ElementorExtras\Modules\Navigation\Module as Module; use ElementorExtras\Modules\TemplatesControl\Module as TemplatesControl; use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Utils; use Elementor\Repeater; use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Css_Filter; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Offcanvas * * @since 2.0.0 */ class Offcanvas extends Extras_Widget { /** * Has template content * * @since 2.0.0 * @var bool */ protected $_has_template_content = false; /** * Sidebar Options * * @since 2.0.0 * @var array */ protected $_sidebars_options = []; /** * Sidebars Default Key * * @since 2.0.0 * @var array */ protected $_sidebars_default_key; /** * Set Sidebar Vars * * @since 2.0.0 * @return void */ protected function set_sidebars_vars() { global $wp_registered_sidebars; if ( ! $wp_registered_sidebars ) { $this->_sidebars_options[''] = __( 'No sidebars were found', 'elementor-extras' ); } else { $this->_sidebars_options[''] = __( 'Choose Sidebar', 'elementor-extras' ); foreach ( $wp_registered_sidebars as $sidebar_id => $sidebar ) { $this->_sidebars_options[ $sidebar_id ] = $sidebar['name']; } } $this->_sidebars_default_key = array_keys( $this->_sidebars_options ); $this->_sidebars_default_key = array_shift( $this->_sidebars_default_key ); } /** * Get Name * * Get the name of the widget * * @since 2.0.0 * @return string */ public function get_name() { return 'ee-offcanvas'; } /** * Get Title * * Get the title of the widget * * @since 2.0.0 * @return string */ public function get_title() { return __( 'Offcanvas', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 2.0.0 * @return string */ public function get_icon() { return 'nicon nicon-offcanvas'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 2.0.0 * @return array */ public function get_script_depends() { return [ 'slidebars', 'jquery-resize-ee', ]; } /** * Whether the reload preview is required or not. * * Used to determine whether the reload preview is required. * * @since 2.0.0 * @return bool */ public function is_reload_preview_required() { return true; } /** * Register Skins * * @since 2.0.0 * @return void */ protected function register_skins() { $this->add_skin( new Skins\Skin_Classic( $this ) ); } /** * Register Widget Controls * * @since 2.0.0 * @return void */ protected function _register_controls() { // Content tab $this->register_settings_controls(); $this->register_trigger_content_controls(); $this->register_title_content_controls(); $this->register_close_content_controls(); $this->register_content_boxes_content_controls(); // Style tab $this->register_offcanvas_style_controls(); $this->register_page_style_controls(); $this->register_trigger_style_controls(); $this->register_title_style_controls(); $this->register_close_style_controls(); $this->register_content_boxes_style_controls(); } /** * Register Settings Controls * * @since 2.0.0 * @return void */ protected function register_settings_controls() { $this->start_controls_section( 'section_settings', [ 'label' => __( 'Settings', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'open', [ 'label' => __( 'Toggle Offcanvas', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::BUTTON, 'button_type' => 'default', 'text' => __( 'Toggle', 'elementor-extras' ), 'event' => 'ee:editor:offcanvas:open', ] ); $this->add_control( 'container_scroll', [ 'label' => __( 'Allow Page Scroll', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'left', 'options' => [ 'left' => __( 'Left', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), 'top' => __( 'Top', 'elementor-extras' ), 'bottom' => __( 'Bottom', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_control( 'animation', [ 'label' => __( 'Animation', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'reveal', 'options' => [ 'reveal' => __( 'Reveal', 'elementor-extras' ), 'push' => __( 'Push', 'elementor-extras' ), 'overlay' => __( 'Overlay', 'elementor-extras' ), 'shift' => __( 'Shift', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'duration', [ 'label' => __( 'Animation Duration', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'step'=> 0.1, 'max' => 5, ], ], 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}}' => 'transition-duration: {{SIZE}}s;', 'body.ee-offcanvas--id-{{ID}} .ee-offcanvas__overlay' => 'transition-duration: {{SIZE}}s;', ], ] ); $this->add_control( 'anchor_navigation', [ 'label' => __( 'Anchor Navigation', 'elementor-extras' ), 'description' => __( 'Allow navigation to anchors on page', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'separator' => 'before', 'frontend_available' => true, 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), ] ); $this->add_control( 'anchor_navigation_speed', [ 'label' => __( 'Anchor Navigation Speed', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 500, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 10000, ], ], 'frontend_available' => true, 'condition' => [ 'anchor_navigation!' => '', ], ] ); $this->add_control( 'anchor_navigation_close', [ 'label' => __( 'Close After Scroll', 'elementor-extras' ), 'description' => __( 'Close offcanvas after animating to anchor', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'frontend_available' => true, 'condition' => [ 'anchor_navigation!' => '', ], ] ); $this->add_control( 'scroll_fix', [ 'label' => __( 'Page Jump Fix', 'elementor-extras' ), 'description' => sprintf( __( 'Read more about this issue %1$shere%2$s', 'elementor-extras' ), '<a href="https://shop.namogo.com/docs/elementor-extras/offcanvas/#scroll-fix">', '</a>' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'margin' => __( 'Margin Hack', 'elementor-extras' ), 'overflow' => __( 'Overflow Fix', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_control( 'refresh_widgets', [ 'label' => __( 'Refresh Panel Widgets', 'elementor-extras' ), 'description' => __( 'If you are using templates as content for the offcanvas panel, this option will refresh any frontend functionality for all elements inside the panel when opened. Turn this off if you notice strange behaviour or broken elements inside the panel.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'frontend_available' => true, ] ); $this->end_controls_section(); } /** * Register Trigger Content Controls * * @since 2.0.0 * @return void */ protected function register_trigger_content_controls() { $this->start_controls_section( 'section_trigger', [ 'label' => __( 'Trigger', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'trigger_source', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'burger', 'options' => [ 'burger' => __( 'Burger', 'elementor-extras' ), 'id' => __( 'Element ID', 'elementor-extras' ), 'class' => __( 'Element Class', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_control( 'trigger_id', [ 'label' => __( 'Trigger CSS ID', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '', 'label_block' => false, 'frontend_available' => true, 'title' => __( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor-extras' ), 'condition' => [ 'trigger_source' => 'id', ], ] ); $this->add_control( 'trigger_class', [ 'label' => __( 'Trigger CSS Class', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '', 'label_block' => false, 'frontend_available' => true, 'title' => __( 'Add your custom class WITHOUT the DOT key. e.g: my-class', 'elementor-extras' ), 'condition' => [ 'trigger_source' => 'class', ], 'frontend_available' => true, ] ); $this->add_control( 'trigger_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'separator' => 'before', 'default' => 'inline', 'options' => [ 'inline' => __( 'Inline', 'elementor-extras' ), 'floating' => __( 'Floating', 'elementor-extras' ), ], 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_placement', [ 'label' => __( 'Placement', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'top-left', 'options' => [ 'top-left' => __( 'Top Left', 'elementor-extras' ), 'top-center' => __( 'Top Center', 'elementor-extras' ), 'top-right' => __( 'Top Right', 'elementor-extras' ), 'middle-right' => __( 'Middle Right', 'elementor-extras' ), 'bottom-right' => __( 'Bottom Right', 'elementor-extras' ), 'bottom-center' => __( 'Bottom Center', 'elementor-extras' ), 'bottom-left' => __( 'Bottom Left', 'elementor-extras' ), 'middle-left' => __( 'Middle Left', 'elementor-extras' ), ], 'prefix_class' => 'ee-offcanvas-placement--', 'condition' => [ 'trigger_source' => 'burger', 'trigger_position' => 'floating', ], ] ); $this->add_responsive_control( 'trigger_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-button-wrapper' => 'justify-content: {{VALUE}};', ], 'condition' => [ 'trigger_source' => 'burger', 'trigger_position' => 'inline', ], ] ); $this->add_control( 'trigger_zindex', [ 'label' => __( 'zIndex', 'elementor-extras' ), 'description' => __( 'Adjust the z-index of the floating trigger. Defaults to 999', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => '999', 'min' => 0, 'step' => 1, 'condition' => [ 'trigger_source' => 'burger', 'trigger_position' => 'floating', ], 'selectors' => [ '{{WRAPPER}} .ee-offcanvas__trigger' => 'z-index: {{SIZE}};', ] ] ); $this->add_control( 'trigger_label_heading', [ 'label' => __( 'Label', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_label', [ 'label' => __( 'Show', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_text', [ 'label' => __( 'Text', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'type' => Controls_Manager::TEXT, 'default' => __( 'Menu', 'elementor-extras' ), 'condition' => [ 'trigger_source' => 'burger', 'trigger_label!' => '', ], ] ); $this->add_control( 'trigger_icon_heading', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_icon_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'left', 'options' => [ '' => __( 'Hide', 'elementor-extras' ), 'left' => __( 'Before Label', 'elementor-extras' ), 'right' => __( 'After Label', 'elementor-extras' ), ], 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_effect', [ 'label' => __( 'Animation', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'arrow', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'arrow' => __( 'Arrow Left', 'elementor-extras' ), 'arrow-r' => __( 'Arrow Right', 'elementor-extras' ), 'arrowalt' => __( 'Arrow Alt Left', 'elementor-extras' ), 'arrowalt-r' => __( 'Arrow Alt Right', 'elementor-extras' ), 'arrowturn' => __( 'Arrow Turn Left', 'elementor-extras' ), 'arrowturn-r' => __( 'Arrow Turn Right', 'elementor-extras' ), 'collapse' => __( 'Collapse Left', 'elementor-extras' ), 'collapse-r' => __( 'Collapse Right', 'elementor-extras' ), 'elastic' => __( 'Elastic Left', 'elementor-extras' ), 'elastic-r' => __( 'Elastic Right', 'elementor-extras' ), 'emphatic' => __( 'Emphatic Left', 'elementor-extras' ), 'emphatic-r' => __( 'Emphatic Right', 'elementor-extras' ), 'slider' => __( 'Slider Left', 'elementor-extras' ), 'slider-r' => __( 'Slider Right', 'elementor-extras' ), 'spin' => __( 'Spin Left', 'elementor-extras' ), 'spin-r' => __( 'Spin Right', 'elementor-extras' ), 'spring' => __( 'Spring Left', 'elementor-extras' ), 'spring-r' => __( 'Spring Right', 'elementor-extras' ), 'stand' => __( 'Stand Left', 'elementor-extras' ), 'stand-r' => __( 'Stand Right', 'elementor-extras' ), 'vortex' => __( 'Vortex Left', 'elementor-extras' ), 'vortex-r' => __( 'Vortex Right', 'elementor-extras' ), 'minus' => __( 'Minus', 'elementor-extras' ), 'squeeze' => __( 'Squeeze', 'elementor-extras' ), ], 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_icon_indent', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-icon--right' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-icon--left' => 'margin-right: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'trigger_source' => 'burger', 'trigger_label!' => '', ], ] ); $this->end_controls_section(); } /** * Register Header Content Controls * * @since 2.0.0 * @return void */ protected function register_title_content_controls() { $this->start_controls_section( 'section_title', [ 'label' => __( 'Title', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'header_title', [ 'label' => __( 'Show', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), ] ); $this->add_control( 'header_title_text', [ 'label' => __( 'Title', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'type' => Controls_Manager::TEXT, 'default' => __( 'Menu', 'elementor-extras' ), 'condition' => [ 'header_title!' => '', ], ] ); $this->add_control( 'header_title_tag', [ 'label' => __( 'Title HTML Tag', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => __( 'H1', 'elementor-extras' ), 'h2' => __( 'H2', 'elementor-extras' ), 'h3' => __( 'H3', 'elementor-extras' ), 'h4' => __( 'H4', 'elementor-extras' ), 'h5' => __( 'H5', 'elementor-extras' ), 'h6' => __( 'H6', 'elementor-extras' ), 'div' => __( 'div', 'elementor-extras' ), 'span' => __( 'span', 'elementor-extras' ), 'p' => __( 'p', 'elementor-extras' ), ], 'default' => 'h3', 'condition' => [ 'header_title!' => '', ], ] ); $this->end_controls_section(); } /** * Register Close Content Controls * * @since 2.1.4 * @return void */ protected function register_close_content_controls() { $this->start_controls_section( 'section_close', [ 'label' => __( 'Close', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'header_close_source', [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Default', 'elementor-extras' ), 'id' => __( 'Element ID', 'elementor-extras' ), 'class' => __( 'Element Class', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_control( 'header_close_id', [ 'label' => __( 'Close CSS ID', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '', 'label_block' => false, 'frontend_available' => true, 'title' => __( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor-extras' ), 'condition' => [ 'header_close_source' => 'id', ], ] ); $this->add_control( 'header_close_class', [ 'label' => __( 'Close CSS Class', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '', 'label_block' => false, 'frontend_available' => true, 'title' => __( 'Add your custom class WITHOUT the DOT key. e.g: my-class', 'elementor-extras' ), 'condition' => [ 'header_close_source' => 'class', ], 'frontend_available' => true, ] ); $this->add_control( 'header_close_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'after', 'options' => [ '' => __( 'Hide', 'elementor-extras' ), 'left' => __( 'Left', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), 'custom' => __( 'Custom', 'elementor-extras' ), ], 'condition' => [ 'header_close_source' => '', ], ] ); $this->end_controls_section(); } /** * Register Content Boxes Controls * * @since 2.0.0 * @return void */ protected function register_content_boxes_content_controls() { $this->start_controls_section( 'section_content', [ 'label' => __( 'Content Boxes', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->set_sidebars_vars(); $repeater = new Repeater(); $repeater->add_control( 'content_type', [ 'label' => __( 'Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'text', 'options' => [ 'text' => __( 'Text', 'elementor-extras' ), 'template' => __( 'Template', 'elementor-extras' ), 'sidebar' => __( 'WordPress Sidebar', 'elementor-extras' ), ], ] ); $repeater->add_control( 'content', [ 'label' => __( 'Content', 'elementor-extras' ), 'type' => Controls_Manager::WYSIWYG, 'dynamic' => [ 'active' => true ], 'default' => __( 'I am a content box for offcanvas navigation', 'elementor-extras' ), 'condition' => [ 'content_type' => 'text', ], ] ); TemplatesControl::add_controls( $repeater, [ 'condition' => [ 'content_type' => 'template', ], 'prefix' => 'content_', ] ); $repeater->add_control( 'sidebar', [ 'label' => __( 'Choose Sidebar', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => $this->_sidebars_default_key, 'options' => $this->_sidebars_options, 'condition' => [ 'content_type' => 'sidebar', ], ] ); $this->add_control( 'content_boxes', [ 'label' => '', 'type' => Controls_Manager::REPEATER, 'default' => [ [ 'content_type' => 'text', 'content' => __( 'I am a content box for offcanvas navigation', 'elementor-extras' ), ], [ 'content_type' => 'text', 'content' => __( 'I am a content box for offcanvas navigation', 'elementor-extras' ), ], ], 'fields' => $repeater->get_controls(), 'title_field' => 'Box: {{{ content_type }}}', ] ); $this->end_controls_section(); } /** * Register Offcanvas Style Controls * * @since 2.0.0 * @return void */ protected function register_offcanvas_style_controls() { $this->start_controls_section( 'section_offcanvas_style', [ 'label' => __( 'Offcanvas', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'offcanvas_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ '%' => [ 'min' => 0, 'max' => 100, ], 'px' => [ 'min' => 100, 'max' => 1000, ], ], 'selectors' => [ '.ee-offcanvas__slidebar.ee-offcanvas__slidebar--{{ID}}' => 'width: {{SIZE}}{{UNIT}};', ], 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'position', 'operator' => '==', 'value' => 'left', ], [ 'name' => 'position', 'operator' => '==', 'value' => 'right', ], ], ], ] ); $this->add_responsive_control( 'offcanvas_height', [ 'label' => __( 'Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ '%' => [ 'min' => 0, 'max' => 100, ], 'px' => [ 'min' => 100, 'max' => 1000, ], ], 'selectors' => [ '.ee-offcanvas__slidebar.ee-offcanvas__slidebar--{{ID}}' => 'height: {{SIZE}}{{UNIT}};', ], 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'position', 'operator' => '==', 'value' => 'top', ], [ 'name' => 'position', 'operator' => '==', 'value' => 'bottom', ], ], ], ] ); $this->add_responsive_control( 'offcanvas_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'offcanvas_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-offcanvas__slidebar.ee-offcanvas__slidebar--{{ID}}' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'offcanvas', 'selector' => '.ee-offcanvas__slidebar--{{ID}}', 'separator' => '', 'condition' => [ 'animation' => 'overlay', ], ] ); $this->end_controls_section(); } /** * Register Offcanvas Style Controls * * @since 2.2.11 * @return void */ protected function register_page_style_controls() { $this->start_controls_section( 'section_page_style', [ 'label' => __( 'Page', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'page_style_notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'The settings below apply to the page when the offcanvas panel is opened.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', ] ); $this->add_control( 'page_background_color', [ 'type' => Controls_Manager::COLOR, 'label' => __( 'Container Background', 'elementor-extras' ), 'description' => __( 'When the offcanvas opens, the page is wrapped in an element that needs a background colour which is the same as the page.', 'elementor-extras' ), 'default' => 'rgba(255,255,255,1)', 'selectors' => [ 'body.ee-offcanvas--id-{{ID}} .ee-offcanvas__container' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'overlay_background', [ 'label' => __( 'Overlay Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ 'body.ee-offcanvas--id-{{ID}} .ee-offcanvas__overlay' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'overlay_opacity', [ 'label' => __( 'Overlay Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.8, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ 'body.ee-offcanvas--id-{{ID}}.ee-offcanvas--opening .ee-offcanvas__overlay, body.ee-offcanvas--id-{{ID}}.ee-offcanvas--open .ee-offcanvas__overlay' => 'opacity: {{SIZE}};', ], ] ); $this->end_controls_section(); } /** * Register Trigger Style Controls * * @since 2.0.0 * @return void */ protected function register_trigger_style_controls() { $this->start_controls_section( 'section_trigger_style', [ 'label' => __( 'Trigger', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'trigger_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-button', 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_responsive_control( 'trigger_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-button-content-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_responsive_control( 'trigger_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-button-content-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'trigger', 'label' => __( 'Typography', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-button-wrapper', 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'trigger', 'selector' => '{{WRAPPER}} .ee-hamburger-inner, {{WRAPPER}} .ee-hamburger-inner:before, {{WRAPPER}} .ee-hamburger-inner:after, {{WRAPPER}} .ee-button', 'separator' => '', 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->start_controls_tabs( 'trigger_tabs_hover' ); $this->start_controls_tab( 'trigger_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-hamburger-inner, {{WRAPPER}} .ee-hamburger-inner:before, {{WRAPPER}} .ee-hamburger-inner:after' => 'background-color: {{VALUE}};', '{{WRAPPER}} .ee-button' => 'color: {{VALUE}};', ], 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-button' => 'background-color: {{VALUE}};', ], 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'trigger_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-button:hover .ee-hamburger-inner, {{WRAPPER}} .ee-button:hover .ee-hamburger-inner:before, {{WRAPPER}} .ee-button:hover .ee-hamburger-inner:after' => 'background-color: {{VALUE}};', '{{WRAPPER}} .ee-button:hover' => 'color: {{VALUE}};', ], 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_background_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-button:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'trigger_tab_open', [ 'label' => __( 'Open', 'elementor-extras' ), 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_color_open', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-button.ee--is-active .ee-hamburger-inner, {{WRAPPER}} .ee-button.ee--is-active .ee-hamburger-inner:before, {{WRAPPER}} .ee-button.ee--is-active .ee-hamburger-inner:after' => 'background-color: {{VALUE}};', '{{WRAPPER}} .ee-button.ee--is-active' => 'color: {{VALUE}};', ], 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_background_open', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-button.ee--is-active' => 'background-color: {{VALUE}};', ], 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'trigger_icon_style_heading', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_responsive_control( 'trigger_icon_size', [ 'label' => __( 'Icon Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'max' => 3, 'min' => 0.1, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-hamburger-box' => 'font-size: {{SIZE}}em;', ], 'condition' => [ 'trigger_source' => 'burger', ], ] ); $this->add_control( 'trigger_label_style_heading', [ 'label' => __( 'Label', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'trigger_source' => 'burger', 'trigger_label!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'trigger_label', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-button-text', 'condition' => [ 'trigger_source' => 'burger', 'trigger_label!' => '', ], ] ); $this->end_controls_section(); } /** * Register Title Style Controls * * @since 2.0.0 * @return void */ protected function register_title_style_controls() { $this->start_controls_section( 'section_title_style', [ 'label' => __( 'Title', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'header_title!' => '', ], ] ); $this->add_responsive_control( 'title_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__header__title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'header_title!' => '', ], ] ); $this->add_responsive_control( 'title_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__header__title' => 'text-align: {{VALUE}};', ], 'condition' => [ 'header_title!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_SECONDARY, ], 'selector' => '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__header__title', 'condition' => [ 'header_title!' => '', ], ] ); $this->add_control( 'title_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__header__title' => 'color: {{VALUE}};', ], 'condition' => [ 'header_title!' => '', ], ] ); $this->end_controls_section(); } /** * Register Close Style Controls * * @since 2.1.4 * @return void */ protected function register_close_style_controls() { $this->start_controls_section( 'section_close_style', [ 'label' => __( 'Close', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'header_close_source' => '', 'header_close_position!' => '', ], ] ); $this->add_responsive_control( 'close_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 30, ], 'range' => [ 'px' => [ 'max' => 50, 'min' => 10, 'step' => 1, ], ], 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__header__close' => 'font-size: {{SIZE}}px;', ], 'condition' => [ 'header_close_position!' => '', ], ] ); $this->add_responsive_control( 'close_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__header__close' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'header_close_position!' => '', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'close_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__header__close', 'condition' => [ 'header_close_position!' => '', ], ] ); $this->add_control( 'close_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__header__close' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'header_close_position!' => '', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'close', 'selector' => '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__header__close', 'separator' => '', 'condition' => [ 'header_close_position!' => '', ], ] ); $this->start_controls_tabs( 'close_tabs_hover' ); $this->start_controls_tab( 'close_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ 'header_close_position!' => '', ], ] ); $this->add_control( 'close_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__header__close' => 'color: {{VALUE}};', ], 'condition' => [ 'header_close_position!' => '', ], ] ); $this->add_control( 'close_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__header__close' => 'background-color: {{VALUE}};', ], 'condition' => [ 'header_close_position!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'close_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ 'header_close_position!' => '', ], ] ); $this->add_control( 'close_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__header__close:hover' => 'color: {{VALUE}};', ], 'condition' => [ 'header_close_position!' => '', ], ] ); $this->add_control( 'close_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__header__close:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ 'header_close_position!' => '', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Register Content Boxes Style Controls * * @since 2.0.0 * @return void */ protected function register_content_boxes_style_controls() { $this->start_controls_section( 'section_content_style', [ 'label' => __( 'Content Boxes', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'boxes_spacing', [ 'label' => __( 'Boxes Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'default' => [ 'size' => 24, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__content__item:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'boxes_padding', [ 'label' => __( 'Boxes Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__content__item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'boxes', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__content__item', ] ); $this->add_control( 'boxes_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__content__item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'boxes', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__content__item', ] ); $this->add_control( 'boxes_foreground_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__content__item' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'boxes_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-offcanvas__slidebar--{{ID}} .ee-offcanvas__content__item' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 2.0.0 * @return void */ public function render() { $settings = $this->get_settings_for_display(); $has_placeholder = true; $placeholder = ''; if ( 'burger' === $settings['trigger_source'] ) { if ( 'floating' === $settings['trigger_position'] ) { $placeholder .= __( 'Your menu trigger is floating. ', 'elementor-extras' ); $has_placeholder = true; } else { $has_placeholder = false; } $this->render_trigger(); } else { $placeholder .= __( 'You selected to trigger offcanvas using another element on the page. ', 'elementor-extras' ); $has_placeholder = true; } if ( $has_placeholder ) { $placeholder .= __( ' This placeholder will not be shown on the live page.', 'elementor-extras' ); echo $this->render_placeholder( [ 'body' => $placeholder, ] ); } if ( ! empty( $settings['content_boxes'] ) ) { $this->render_content_boxes(); } } /** * Render Trigger * * @since 2.0.0 * @return void */ public function render_trigger() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'button-wrapper' => [ 'class' => [ 'ee-button-wrapper', 'ee-offcanvas-position--' . $settings['trigger_position'], ], ], 'button' => [ 'class' => [ 'ee-button', 'ee-hamburger', 'ee-hamburger--' . $settings['trigger_effect'], 'ee-offcanvas__trigger', 'ee-offcanvas__trigger--' . $settings['trigger_position'], ], 'id' => 'slidebar-trigger_' . $this->get_id(), 'data-slidebar-id' => $this->get_id(), 'aria-label' => 'Menu', 'aria-controls' => 'navigation', ], 'button-content-wrapper' => [ 'class' => [ 'ee-button-icon', 'ee-icon--' . $settings['trigger_icon_position'], 'ee-hamburger-box', ], ], 'button-content' => [ 'class' => [ 'ee-button-content-wrapper', ], ], 'button-text' => [ 'class' => [ 'ee-button-text', ], ], 'button-inner' => [ 'class' => [ 'ee-hamburger-inner', ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'button-wrapper' ); ?>> <div <?php echo $this->get_render_attribute_string( 'button' ); ?>> <span <?php echo $this->get_render_attribute_string( 'button-content' ); ?>> <?php if ( '' !== $settings['trigger_icon_position'] ) { ?> <span <?php echo $this->get_render_attribute_string( 'button-content-wrapper' ); ?>> <span <?php echo $this->get_render_attribute_string( 'button-inner' ); ?>></span> </span> <?php } ?> <?php if ( '' !== $settings['trigger_label'] ) : ?> <span <?php echo $this->get_render_attribute_string( 'button-text' ); ?>> <?php echo $settings['trigger_text']; ?> </span> <?php endif; ?> </span> </div> </div><?php } /** * Render Content Boxes * * @since 2.0.0 * @return void */ public function render_content_boxes() { $settings = $this->get_settings_for_display(); $has_title = '' !== $settings['header_title']; $has_close = ! in_array( $settings['header_close_position'], ['', 'custom'] ); $this->add_render_attribute( [ 'content-boxes' => [ 'class' => [ 'ee-offcanvas__content', 'ee-offcanvas__content-' . $this->get_id(), ], ], 'content-header' => [ 'class' => [ 'ee-offcanvas__header', ], ], 'header-title' => [ 'class' => [ 'ee-offcanvas__header__title', ], ], 'header-close' => [ 'class' => [ 'ee-offcanvas__header__close', ], ], ] ); if ( $has_close ) { $this->add_render_attribute( [ 'content-header' => [ 'class' => [ 'ee-offcanvas__header-close--' . $settings['header_close_position'], ], ], ] ); } if ( $has_title ) { $title_tag = $settings['header_title_tag']; $this->add_render_attribute( [ 'content-header' => [ 'class' => [ 'ee-offcanvas__header--hide-title', ], ], ] ); } ?><div <?php echo $this->get_render_attribute_string( 'content-boxes' ); ?>> <?php if ( $has_title || $has_close ) { ?> <div <?php echo $this->get_render_attribute_string( 'content-header' ); ?>> <?php if ( $has_title ) { ?> <<?php echo $title_tag; ?> <?php echo $this->get_render_attribute_string( 'header-title' ); ?>> <?php echo $settings['header_title_text']; ?> </<?php echo $title_tag; ?>> <?php } ?> <?php if ( $has_close ) { ?> <div <?php echo $this->get_render_attribute_string( 'header-close' ); ?>><i class="eicon-close"></i></div> <?php } ?> </div> <?php } ?> <?php foreach ( $settings['content_boxes'] as $index => $item ) { $box_key = $this->get_repeater_setting_key( 'box', 'content_boxes', $index ); $this->add_render_attribute( $box_key, [ 'class' => [ 'ee-offcanvas__content__item', 'elementor-repeater-item-' . $item['_id'], ] ] ); ?><div <?php echo $this->get_render_attribute_string( $box_key ); ?>><?php switch ( $item['content_type'] ) { case 'text': $this->render_text( $index, $item ); break; case 'sidebar': $this->render_sidebar( $item ); break; case 'template': $template_key = 'content_' . $item['content_template_type'] . '_template_id'; if ( array_key_exists( $template_key, $item ) ) TemplatesControl::render_template_content( $item[ $template_key ], $this ); break; default: break; } ?></div><?php } ?> </div><?php } /** * Render Sidebar * * @since 2.0.0 * @return void */ public function render_sidebar( $item ) { $sidebar = $item['sidebar']; if ( empty( $sidebar ) ) { return; } ?><aside class="widget-area" role="complementary"><?php dynamic_sidebar( $sidebar ); ?></aside><?php } /** * Render Text * * @since 2.0.0 * @return void */ public function render_text( $index, $item ) { echo $this->parse_text_editor( $item['content'] ); } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 2.0.0 * @return void */ public function content_template() {} } navigation/widgets/slide-menu.php 0000644 00000064132 15112147616 0013136 0 ustar 00 <?php namespace ElementorExtras\Modules\Navigation\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\Navigation\Skins; use ElementorExtras\Modules\Navigation\Module as Module; use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Utils; use Elementor\Repeater; use Elementor\Controls_Manager; use Elementor\Icons_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Css_Filter; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Slide_Menu * * @since 2.0.0 */ class Slide_Menu extends Extras_Widget { /** * Has template content * * @since 2.0.0 * @var bool */ protected $_has_template_content = false; /** * Nav Menu Index * * @since 2.0.0 * @var int */ protected $nav_menu_index = 1; /** * Get Name * * Get the name of the widget * * @since 2.0.0 * @return string */ public function get_name() { return 'ee-slide-menu'; } /** * Get Title * * Get the title of the widget * * @since 2.0.0 * @return string */ public function get_title() { return __( 'Slide Menu', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 2.0.0 * @return string */ public function get_icon() { return 'nicon nicon-slide-menu'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 2.0.0 * @return array */ public function get_script_depends() { return [ 'slide-menu', ]; } /** * Register Skins * * @since 2.0.0 * @return void */ protected function register_skins() { $this->add_skin( new Skins\Skin_Classic( $this ) ); } /** * Get Nav Menu Index * * @since 2.0.0 * @return int */ protected function get_nav_menu_index() { return $this->nav_menu_index++; } /** * Get Available Menu * * Return the list of available WP menus * * @since 2.0.0 * @return array */ private function get_available_menus() { $menus = wp_get_nav_menus(); $options = []; foreach ( $menus as $menu ) { $options[ $menu->slug ] = $menu->name; } return $options; } /** * Register Widget Controls * * @since 2.0.0 * @return void */ protected function _register_controls() { // Content tab $this->register_settings_controls(); // Style tab $this->register_menu_style_controls(); $this->register_links_style_controls(); } /** * Register Settings Controls * * @since 2.0.0 * @return void */ protected function register_settings_controls() { $this->start_controls_section( 'section_settings', [ 'label' => __( 'Settings', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $menus = $this->get_available_menus(); if ( ! empty( $menus ) ) { $this->add_control( 'menu', [ 'label' => __( 'Menu', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => $menus, 'default' => array_keys( $menus )[0], 'save_default' => true, 'separator' => 'after', 'description' => sprintf( __( 'Go to the <a href="%s" target="_blank">Menus screen</a> to manage your menus.', 'elementor-extras' ), admin_url( 'nav-menus.php' ) ), ] ); } else { $this->add_control( 'menu', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => sprintf( __( '<strong>There are no menus in your site.</strong><br>Go to the <a href="%s" target="_blank">Menus screen</a> to create one.', 'elementor-extras' ), admin_url( 'nav-menus.php?action=edit&menu=0' ) ), 'separator' => 'after', 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', ] ); } $this->add_control( 'back_text', [ 'label' => __( 'Back Label', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => __( 'Back', 'elementor-extras' ), 'label_block' => false, 'frontend_available' => true, ] ); $this->add_control( 'effect', [ 'label' => __( 'Effect', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'overlay' => __( 'Overlay', 'elementor-extras' ), 'push' => __( 'Push', 'elementor-extras' ), // 'shift' => __( 'Shift', 'elementor-extras' ), ], 'default' => 'overlay', 'prefix_class' => 'ee-slide-menu-effect--', ] ); $this->add_control( 'direction', [ 'label' => __( 'Direction', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'left' => __( 'Left', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), 'bottom' => __( 'Bottom', 'elementor-extras' ), 'top' => __( 'Top', 'elementor-extras' ), ], 'default' => 'left', 'prefix_class' => 'ee-slide-menu-direction--', ] ); $this->add_responsive_control( 'duration', [ 'label' => __( 'Transition Duration', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 3, 'step'=> 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-menu__sub-menu, {{WRAPPER}} .ee-menu__menu' => 'transition-duration: {{SIZE}}s;', ], ] ); $this->add_control( 'link_navigation', [ 'label' => __( 'Link Navigation', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'description' => __( 'Allow navigating to sub-menus by clicking the links instead of just the arrows.', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'parent_icon', [ 'label' => __( 'Parent Icon', 'elementor' ), 'type' => Controls_Manager::ICONS, 'default' => [ 'value' => 'fas fa-angle-right', 'library' => 'fa-solid', ], ] ); $this->end_controls_section(); } /** * Register Menu Style Controls * * @since 2.0.0 * @return void */ protected function register_menu_style_controls() { $this->start_controls_section( 'section_menu_style', [ 'label' => __( 'Menu', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ '%' => [ 'min' => 0, 'max' => 100, ], 'px' => [ 'min' => 100, 'max' => 1000, ], ], 'selectors' => [ '{{WRAPPER}} .ee-slide-menu' => 'max-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'fixed_height', [ 'label' => __( 'Fixed Height', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'description' => __( 'If turned off, the menu will adjust its height based on the currently active sub-menu.', 'elementor-extras' ), 'default' => 'yes', ] ); $this->add_responsive_control( 'height', [ 'label' => __( 'Min. Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 100, 'max' => 1000, ], ], 'selectors' => [ '{{WRAPPER}} .ee-slide-menu, {{WRAPPER}} .ee-slide-menu__sub-menu' => 'min-height: {{SIZE}}px;', ], 'condition' => [ 'fixed_height!' => '', ], ] ); $this->add_control( 'align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'left', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'background', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-slide-menu, {{WRAPPER}} .ee-menu__sub-menu' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'navigation', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-slide-menu', ] ); $this->add_control( 'border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .ee-slide-menu, {{WRAPPER}} .ee-slide-menu__sub-menu' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'navigation_box_shadow', 'selector' => '{{WRAPPER}} .ee-slide-menu', 'separator' => '', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'navigation_links_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-slide-menu .ee-menu__item a', ] ); $this->end_controls_section(); } /** * Register Links Style Controls * * @since 2.0.0 * @return void */ protected function register_links_style_controls() { $this->start_controls_section( 'section_links_style', [ 'label' => __( 'Links', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'links_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-menu__item:not(:last-child)' => 'margin-bottom: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'links_separator_thickness', [ 'label' => __( 'Separator Thickness', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'separator' => 'before', 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-menu__item' => 'border-bottom-width: {{SIZE}}px; border-bottom-style: solid;', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'links', 'selector' => '{{WRAPPER}} .ee-menu__item__link, {{WRAPPER}} .ee-menu__arrow', 'separator' => '', ] ); $this->start_controls_tabs( 'links_type' ); $this->start_controls_tab( 'links_regular', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'links_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .ee-menu__item__link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} .ee-menu__arrow' => 'padding-top: {{TOP}}{{UNIT}}; padding-bottom: {{BOTTOM}}{{UNIT}};', ], ] ); $this->add_control( 'links_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'left', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-menu__item__link' => 'text-align: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'links_back', [ 'label' => __( 'Back', 'elementor-extras' ) ] ); $this->add_control( 'links_back_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'selectors' => [ '{{WRAPPER}} .ee-menu__back .ee-menu__item__link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} .ee-menu__back .ee-menu__arrow' => 'padding-top: {{TOP}}{{UNIT}}; padding-bottom: {{BOTTOM}}{{UNIT}};', ], ] ); $this->add_control( 'links_back_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'left', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-menu__back .ee-menu__item__link' => 'text-align: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->start_controls_tabs( 'links' ); $this->start_controls_tab( 'links_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'links_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__item__link' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'links_separator_color', [ 'label' => __( 'Separator Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__item' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'links_background', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__item__link' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'links_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'links_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__item__link:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'links_separator_color_hover', [ 'label' => __( 'Separator Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__item:hover' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'links_background_hover', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__item__link:hover' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'links_current', [ 'label' => __( 'Current', 'elementor-extras' ) ] ); $this->add_control( 'links_color_current', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__item__link.ee-menu__item__link--current, {{WRAPPER}} .ee-menu__item__link.ee-menu__item__link--current:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'links_separator_color_current', [ 'label' => __( 'Separator Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__item.ee-menu__item--current' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'links_background_current', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__item__link.ee-menu__item__link--current, {{WRAPPER}} .ee-menu__item__link.ee-menu__item__link--current:hover' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'heading_arrows', [ 'type' => Controls_Manager::HEADING, 'label' => __( 'Arrows', 'elementor-extras' ), 'separator' => 'before', ] ); $this->add_responsive_control( 'arrows_separator_thickness', [ 'label' => __( 'Separator Thickness', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'separator' => 'after', 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-menu__item--has-children > .ee-menu__arrow' => 'border-left-width: {{SIZE}}px; border-left-style: solid;', '{{WRAPPER}} .ee-menu__back > .ee-menu__arrow' => 'border-right-width: {{SIZE}}px; border-right-style: solid;', ], ] ); $this->start_controls_tabs( 'arrows_type' ); $this->start_controls_tab( 'arrows_regular', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_responsive_control( 'arrows_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'min' => 0.1, 'max' => 3, 'step'=> 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-menu__arrow' => 'font-size: {{SIZE}}em;', ], ] ); $this->add_control( 'arrows_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'allowed_dimensions' => [ 'right', 'left' ], 'selectors' => [ '{{WRAPPER}} .ee-menu__arrow' => 'padding-right: {{RIGHT}}{{UNIT}}; padding-left: {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'arrows_back', [ 'label' => __( 'Back', 'elementor-extras' ) ] ); $this->add_responsive_control( 'arrows_back_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'min' => 0.1, 'max' => 3, 'step'=> 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-menu__back .ee-menu__arrow' => 'font-size: {{SIZE}}em;', ], ] ); $this->add_control( 'arrows_back_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'allowed_dimensions' => [ 'right', 'left' ], 'selectors' => [ '{{WRAPPER}} .ee-menu__back .ee-menu__arrow' => 'padding-right: {{RIGHT}}{{UNIT}}; padding-left: {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->start_controls_tabs( 'arrows' ); $this->start_controls_tab( 'arrows_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'arrows_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__arrow' => 'color: {{VALUE}};', '{{WRAPPER}} .ee-menu__arrow svg' => 'fill: {{VALUE}};', ], ] ); $this->add_control( 'arrows_separator_color', [ 'label' => __( 'Separator Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__arrow' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'arrows_background', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__arrow' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'arrows_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'arrows_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__arrow:hover' => 'color: {{VALUE}};', '{{WRAPPER}} .ee-menu__arrow:hover svg' => 'fill: {{VALUE}};', ], ] ); $this->add_control( 'arrows_separator_color_hover', [ 'label' => __( 'Separator Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__arrow:hover' => 'border-color: {{VALUE}};', ], ] ); $this->add_control( 'arrows_background_hover', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-menu__arrow:hover' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 2.0.0 * @return void */ public function render() { $available_menus = $this->get_available_menus(); if ( ! $available_menus ) { return; } $settings = $this->get_active_settings(); ob_start(); Icons_Manager::render_icon( $settings['parent_icon'], [ 'aria-hidden' => 'true' ] ); $icon = ob_get_clean(); $args = [ 'echo' => false, 'menu' => $settings['menu'], 'menu_class' => 'ee-menu__menu ee-slide-menu__menu', 'menu_id' => 'menu-' . $this->get_nav_menu_index() . '-' . $this->get_id(), 'fallback_cb' => '__return_empty_string', 'before' => '<span class="ee-menu__arrow elementor-icon">' . $icon . '</span>', 'container' => '', ]; add_filter( 'walker_nav_menu_start_el', [ $this, 'filter_nav_menu_start_el' ], 10, 4 ); add_filter( 'wp_nav_menu_items', [ $this, 'handle_menu_items' ] ); add_filter( 'nav_menu_link_attributes', [ $this, 'handle_link_classes' ], 10, 4 ); add_filter( 'nav_menu_submenu_css_class', [ $this, 'handle_sub_menu_classes' ] ); add_filter( 'nav_menu_css_class', [ $this, 'handle_menu_item_classes' ] ); // General Menu. $menu_html = wp_nav_menu( $args ); remove_filter( 'wp_nav_menu_items', [ $this, 'handle_menu_items' ] ); remove_filter( 'nav_menu_link_attributes', [ $this, 'handle_link_classes' ] ); remove_filter( 'nav_menu_submenu_css_class', [ $this, 'handle_sub_menu_classes' ] ); remove_filter( 'nav_menu_css_class', [ $this, 'handle_menu_item_classes' ] ); remove_filter( 'walker_nav_menu_start_el', [ $this, 'filter_nav_menu_start_el' ] ); $this->add_render_attribute( [ 'wrapper' => [ 'class' => [ 'ee-menu', 'ee-slide-menu', ], ], ] ); ?> <div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>> <?php echo $menu_html; ?> </div><?php } /** * Filter for walker_nav_menu_start_el * * @since 2.0.0 * @return void */ function filter_nav_menu_start_el( $item_output, $item, $depth, $args ) { /** * Walkter Nav Menu Start Filter * * @since 2.2.16 */ return apply_filters( 'elementor_extras/widgets/slide_menu/nav_menu/walker_start_el', $item_output, $item, $depth, $args ); } /** * Handle Link Classes * * @since 2.0.0 * @return void */ public function handle_link_classes( $atts, $item, $args, $depth ) { $classes = $depth ? 'ee-menu__item__link ee-menu__sub-item__link' : 'ee-menu__item__link'; if ( in_array( 'current-menu-item', $item->classes ) ) { $classes .= ' ee-menu__item__link--current'; } if ( empty( $atts['class'] ) ) { $atts['class'] = $classes; } else { $atts['class'] .= ' ' . $classes; } return $atts; } /** * Handle Menu Items * * Filter for wp_nav_menu items * * @since 2.0.0 * @return void */ public function handle_menu_items( $items ) { return $items; } /** * Handle Menu Items Classes * * Filter for wp_nav_menu menu items classes * * @since 2.0.0 * @return void */ public function handle_menu_item_classes( $classes ) { $classes[] = 'ee-menu__item'; if ( in_array( 'menu-item-has-children', $classes ) ) { $classes[] = 'ee-menu__item--has-children'; } if ( in_array( 'current-menu-item', $classes ) ) { $classes[] = 'ee-menu__item--current'; } return $classes; } /** * Handle Sub-Menu Items Classes * * Filter for wp_nav_menu sub-menu items classes * * @since 2.0.0 * @return void */ public function handle_sub_menu_classes( $classes ) { $classes[] = 'ee-slide-menu__sub-menu'; $classes[] = 'ee-menu__sub-menu'; return $classes; } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 2.0.0 * @return void */ public function content_template() {} } navigation/module.php 0000644 00000001161 15112147616 0010704 0 ustar 00 <?php namespace ElementorExtras\Modules\Navigation; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Buttons\Module * * @since 2.0.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 2.0.0 * @return string */ public function get_name() { return 'navigation'; } /** * Get Widgets * * Get the modules' widgets * * @since 2.0.0 * @return array */ public function get_widgets() { return [ 'Offcanvas', 'Slide_Menu', ]; } } popup/skins/skin-base.php 0000644 00000002337 15112147616 0011434 0 ustar 00 <?php namespace ElementorExtras\Modules\Popup\Skins; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Skin_Base as Elementor_Skin_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Popup\Skins * * @since 2.0.0 */ abstract class Skin_Base extends Elementor_Skin_Base { /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.0.0 * @return void */ protected function _register_controls_actions() { add_action( 'elementor/element/ee-popup/section_items/before_section_end', [ $this, 'register_controls' ] ); } /** * Register Controls * * @since 2.0.0 * @return void * @param $widget Extras_Widget */ public function register_controls( Extras_Widget $widget ) { $this->parent = $widget; $this->register_content_controls(); } /** * Register Content Controls * * @since 2.0.0 * @return void */ public function register_content_controls() {} /** * Render * * Render widget contents on frontend * * @since 2.0.0 * @return void */ public function render() { $this->parent->render(); } } popup/skins/skin-classic.php 0000644 00000002204 15112147616 0012134 0 ustar 00 <?php namespace ElementorExtras\Modules\Popup\Skins; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Popup\Skins * * @since 2.0.0 */ class Skin_Classic extends Skin_Base { /** * Get ID * * Gets the current skin ID * * @since 2.0.0 * @return string */ public function get_id() { return 'classic'; } /** * Get Title * * Gets the current skin title * * @since 2.0.0 * @return string */ public function get_title() { return __( 'Classic', 'elementor-extras' ); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.0.0 * @return void */ protected function _register_controls_actions() { parent::_register_controls_actions(); // add_action( 'elementor/element/posts-extra/section_query/after_section_end', [ $this, 'register_parallax_controls' ] ); } /** * Register Layout Content Controls * * @since 2.0.0 * @return void */ public function register_layout_content_controls() { parent::register_layout_content_controls(); } } popup/widgets/age-gate.php 0000644 00000115246 15112147616 0011555 0 ustar 00 <?php namespace ElementorExtras\Modules\Popup\Widgets; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Group_Control_Transition; use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\Popup\Skins; use ElementorExtras\Modules\Popup\Module as Module; // Elementor Classes use Elementor\Icons_Manager; use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Css_Filter; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Age_Gate * * @since 2.0.0 */ class Age_Gate extends Extras_Widget { /** * Has template content * * @since 2.0.0 * @var bool */ protected $_has_template_content = false; /** * Get Name * * Get the name of the widget * * @since 2.0.0 * @return string */ public function get_name() { return 'ee-age-gate'; } /** * Get Title * * Get the title of the widget * * @since 2.0.0 * @return string */ public function get_title() { return __( 'Age Gate', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 2.0.0 * @return string */ public function get_icon() { return 'nicon nicon-age-gate'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 2.0.0 * @return array */ public function get_script_depends() { return [ 'magnific-popup', ]; } /** * Get Style Depends * * A list of css files that the widgets is depended in * * @since 2.0.0 * @return array */ public function get_style_depends() { return [ 'magnific-popup', ]; } /** * Register Skins * * @since 2.0.0 * @return void */ protected function register_skins() { $this->add_skin( new Skins\Skin_Classic( $this ) ); } /** * Register Widget Controls * * @since 2.0.0 * @return void */ protected function _register_controls() { $this->register_content_controls(); } /** * Register Content Controls * * @since 2.0.0 * @return void */ protected function register_content_controls() { $this->start_controls_section( 'section_settings', [ 'label' => __( 'Settings', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'popup_open', [ 'label' => __( 'Show Popup in Editor', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); if ( current_user_can( 'administrator' ) ) { $this->add_control( 'popup_open_admin', [ 'label' => __( 'Always Show for Admins', 'elementor-extras' ), 'description' => __( 'Have the popup open every time you visit the page if you\'re an Admin. This will help you test the functionality on the frontend without actually being granted access and losing the popup once you enter a correct age. Turn it off when you\'re done customising this widget.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); } $this->add_control( 'popup_animation', [ 'label' => __( 'Animation', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'zoom-in', 'options' => Module::get_animation_options(), 'frontend_available' => true, ] ); $this->add_control( 'age', [ 'label' => __( 'Required Age', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'separator' => 'before', 'default' => 18, 'min' => 10, 'step' => 1, 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_form', [ 'label' => __( 'Form', 'elementor-extras' ), ] ); $this->add_control( 'hide_form_on_denied', [ 'label' => __( 'Hide If Denied', 'elementor-extras' ), 'description' => __( 'If access is denied, remove entire form and header and just show the denied message.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'clear_form_on_denied', [ 'label' => __( 'Clear On Submit', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'hide_form_on_denied!' => 'yes' ], ] ); $this->add_control( 'denied', [ 'label' => __( 'Access Denied', 'elementor-extras' ), 'description' => __( 'Override the default Access Denied message.', 'elementor-extras' ), 'title' => __( 'Use %s to display the required age.', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'type' => Controls_Manager::TEXT, 'default' => __( 'Sorry, you must be at least %s to access this website.', 'elementor-extras' ), 'placeholder' => __( 'Sorry, you must be at least %s to access this website.', 'elementor-extras' ), ] ); $this->add_control( 'header_heading', [ 'label' => __( 'Header', 'elementor-extras' ), 'separator' => 'before', 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'title', [ 'label' => __( 'Title', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'type' => Controls_Manager::TEXT, 'default' => __( 'What\'s your age?', 'elementor-extras' ), ] ); $this->add_control( 'title_tag', [ 'label' => __( 'Title HTML Tag', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => __( 'H1', 'elementor-extras' ), 'h2' => __( 'H2', 'elementor-extras' ), 'h3' => __( 'H3', 'elementor-extras' ), 'h4' => __( 'H4', 'elementor-extras' ), 'h5' => __( 'H5', 'elementor-extras' ), 'h6' => __( 'H6', 'elementor-extras' ), 'div' => __( 'div', 'elementor-extras' ), 'span' => __( 'span', 'elementor-extras' ), 'p' => __( 'p', 'elementor-extras' ), ], 'default' => 'h1', ] ); $this->add_control( 'description', [ 'label' => __( 'Description', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'type' => Controls_Manager::TEXT, 'default' => __( 'Let\'s find out if we can let you in', 'elementor-extras' ), ] ); $this->add_control( 'input_heading', [ 'label' => __( 'Input', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'input_size', [ 'label' => __( 'Input Size', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'xs' => __( 'Extra Small', 'elementor-extras' ), 'sm' => __( 'Small', 'elementor-extras' ), 'md' => __( 'Medium', 'elementor-extras' ), 'lg' => __( 'Large', 'elementor-extras' ), 'xl' => __( 'Extra Large', 'elementor-extras' ), ], 'default' => 'sm', ] ); $this->add_responsive_control( 'input_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => __( 'Default', 'elementor-extras' ), '100' => '100%', '80' => '80%', '75' => '75%', '66' => '66%', '60' => '60%', '50' => '50%', '40' => '40%', '33' => '33%', '25' => '25%', '20' => '20%', ], 'default' => '100', ] ); $this->add_control( 'button_heading', [ 'label' => __( 'Button', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'button_text', [ 'label' => __( 'Text', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Let me in', 'elementor-extras' ), ] ); $this->add_control( 'button_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'sm', 'options' => Utils::get_button_sizes(), ] ); $this->add_responsive_control( 'button_width', [ 'label' => __( 'Column Width', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => __( 'Default', 'elementor-extras' ), '100' => '100%', '80' => '80%', '75' => '75%', '66' => '66%', '60' => '60%', '50' => '50%', '40' => '40%', '33' => '33%', '25' => '25%', '20' => '20%', ], 'default' => '100', ] ); $this->add_control( 'button_align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], 'stretch' => [ 'title' => __( 'Justified', 'elementor-extras' ), 'icon' => 'fa fa-align-justify', ], ], 'default' => 'stretch', 'frontend_available' => true, ] ); $this->add_control( 'selected_button_icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'button_icon', ] ); $this->add_control( 'button_icon_align', [ 'label' => __( 'Icon Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'left', 'options' => [ 'left' => __( 'Before', 'elementor-extras' ), 'right' => __( 'After', 'elementor-extras' ), ], 'condition' => [ 'selected_button_icon[value]!' => '', ], ] ); $this->add_control( 'button_icon_indent', [ 'label' => __( 'Icon Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 50, ], ], 'condition' => [ 'selected_button_icon[value]!' => '', ], 'selectors' => [ '.mfp-wrap.ee-mfp-popup-{{ID}} .elementor-button .elementor-align-icon-right' => 'margin-left: {{SIZE}}{{UNIT}};', '.mfp-wrap.ee-mfp-popup-{{ID}} .elementor-button .elementor-align-icon-left' => 'margin-right: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'button_css_id', [ 'label' => __( 'Button ID', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'title' => __( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor-extras' ), 'label_block' => false, 'description' => __( 'Please make sure the ID is unique and not used elsewhere on the page this form is displayed. This field allows <code>A-z 0-9</code> & underscore chars without spaces.', 'elementor-extras' ), ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_popup', [ 'label' => __( 'Popup', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'popup_valign', [ 'label' => __( 'Vertical Placement', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'middle', 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'popup_width', [ 'label' => __( 'Max. Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ '%' => [ 'min' => 0, 'max' => 100, ], 'px' => [ 'min' => 100, 'max' => 1000, ], ], 'selectors' => [ '.mfp-wrap.ee-mfp-popup-{{ID}} .mfp-content' => 'max-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'popup_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 10, ], ], 'frontend_available' => true, 'selectors' => [ '.mfp-wrap.ee-mfp-popup-{{ID}} .ee-age-gate__content' => 'border-radius: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'popup_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-age-gate__content' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'popup_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-age-gate__content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'popup_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-mfp-popup-{{ID}} .ee-age-gate__content, .ee-mfp-popup-{{ID}} .mfp-figure', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'popup_box_shadow', 'selector' => '.ee-mfp-popup-{{ID}} .ee-age-gate__content, .ee-mfp-popup-{{ID}} .mfp-figure', 'separator' => '', ] ); $this->add_control( 'popup_overlay_heading', [ 'label' => __( 'Overlay', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'popup_overlay_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.mfp-bg.ee-mfp-popup-{{ID}}' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'popup_overlay_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.8, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '.mfp-bg.ee-mfp-popup.mfp-ready:not(.mfp-removing).ee-mfp-popup-{{ID}}' => 'opacity: {{SIZE}}', ], ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'popup_overlay_filter', 'selector' => '.mfp-bg.ee-mfp-popup-{{ID}}', ] ); $this->add_control( 'popup_overlay_blend', [ 'label' => __( 'Blend mode', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'normal', 'options' => [ 'normal' => __( 'Normal', 'elementor-extras' ), 'multiply' => __( 'Multiply', 'elementor-extras' ), 'screen' => __( 'Screen', 'elementor-extras' ), 'overlay' => __( 'Overlay', 'elementor-extras' ), 'darken' => __( 'Darken', 'elementor-extras' ), 'lighten' => __( 'Lighten', 'elementor-extras' ), 'color' => __( 'Color', 'elementor-extras' ), 'color-dodge' => __( 'Color Dodge', 'elementor-extras' ), 'hue' => __( 'Hue', 'elementor-extras' ), ], 'selectors' => [ '.mfp-bg.ee-mfp-popup-{{ID}}' => 'mix-blend-mode: {{VALUE}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_header', [ 'label' => __( 'Header', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'header_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-age-gate__header' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'header_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-age-gate__header' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'header_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-mfp-popup-{{ID}} .ee-age-gate__header', ] ); $this->add_control( 'title_style_heading', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_responsive_control( 'title_align', [ 'label' => __( 'Text Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-age-gate__header__title' => 'text-align: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, ], 'selector' => '.ee-mfp-popup-{{ID}} .ee-age-gate__header__title', ] ); $this->add_control( 'title_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-age-gate__header__title' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'title_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-age-gate__header__title' => 'margin-bottom: {{SIZE}}px;', ], ] ); $this->add_control( 'description_heading', [ 'label' => __( 'Description', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_responsive_control( 'description_align', [ 'label' => __( 'Text Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-age-gate__header__description' => 'text-align: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'description_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '.ee-mfp-popup-{{ID}} .ee-age-gate__header__description', ] ); $this->add_control( 'description_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-age-gate__header__description' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'description_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-age-gate__header__description' => 'margin-bottom: {{SIZE}}px;', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_form', [ 'label' => __( 'Form', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'content_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-age-gate__content__body' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'content_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-mfp-popup-{{ID}} .ee-age-gate__content, .ee-mfp-popup-{{ID}} .mfp-figure', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'content_box_shadow', 'selector' => '.ee-mfp-popup-{{ID}} .ee-age-gate__content, .ee-mfp-popup-{{ID}} .mfp-figure', 'separator' => '', ] ); $this->add_control( 'column_gap', [ 'label' => __( 'Columns Gap', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 10, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 60, ], ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-field-group' => 'padding-right: calc( {{SIZE}}{{UNIT}}/2 ); padding-left: calc( {{SIZE}}{{UNIT}}/2 );', '.ee-mfp-popup-{{ID}} .elementor-form-fields-wrapper' => 'margin-left: calc( -{{SIZE}}{{UNIT}}/2 ); margin-right: calc( -{{SIZE}}{{UNIT}}/2 );', ], ] ); $this->add_control( 'row_gap', [ 'label' => __( 'Rows Gap', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 10, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 60, ], ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-field-group, .ee-mfp-popup-{{ID}} .ee-notification:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};', '.ee-mfp-popup-{{ID}} .elementor-form-fields-wrapper' => 'margin-bottom: -{{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'form_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-age-gate__content__body' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'input_style_heading', [ 'label' => __( 'Input', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'input_text_color', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-field' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'input_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-field' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'input_border_width', [ 'label' => __( 'Border Width', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'placeholder' => '1', 'size_units' => [ 'px' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-field' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'input_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-field' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'input_border_color', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-field' => 'border-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'input_typography', 'selector' => '.ee-mfp-popup-{{ID}} .elementor-field, .ee-mfp-popup-{{ID}} .elementor-field-subgroup label', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->add_control( 'button_style_heading', [ 'label' => __( 'Button', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '.ee-mfp-popup-{{ID}} .elementor-button', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_border', 'placeholder' => '1px', 'default' => '1px', 'selector' => '.ee-mfp-popup-{{ID}} .elementor-button', ] ); $this->add_control( 'button_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'button_text_padding', [ 'label' => __( 'Text Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->start_controls_tabs( 'tabs_button_style' ); $this->start_controls_tab( 'tab_button_normal', [ 'label' => __( 'Normal', 'elementor-extras' ), ] ); $this->add_control( 'button_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-button' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'button_text_color', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-button' => 'color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_button_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), ] ); $this->add_control( 'button_background_hover_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-button:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'button_hover_color', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-button:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_hover_border_color', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-mfp-popup-{{ID}} .elementor-button:hover' => 'border-color: {{VALUE}};', ], 'condition' => [ 'button_border_border!' => '', ], ] ); $this->add_control( 'button_hover_animation', [ 'label' => __( 'Animation', 'elementor-extras' ), 'type' => Controls_Manager::HOVER_ANIMATION, ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'denied_style_heading', [ 'label' => __( 'Denied Message', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'denied_typography', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_ACCENT, ], 'selector' => '.ee-mfp-popup-{{ID}} .ee-notification--error', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'denied_border', 'placeholder' => '1px', 'default' => '1px', 'selector' => '.ee-mfp-popup-{{ID}} .ee-notification--error', ] ); $this->add_control( 'denied_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-notification--error' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'denied_text_padding', [ 'label' => __( 'Text Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-notification--error' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'denied_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-notification--error' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'denied_text_color', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-notification--error' => 'color: {{VALUE}};', ], ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 2.0.0 * @return void */ public function render() { $settings = $this->get_settings_for_display(); $content_link = '#ee-age-gate__trigger-' . $this->get_id(); $this->add_render_attribute( [ 'wrapper' => [ 'class' => [ 'ee-age-gate', 'ee-popup', ], 'id' => 'popup-' . $this->get_id(), ], 'trigger' => [ 'class' => [ 'ee-age-gate__trigger', 'ee-popup__trigger', ], 'href' => $content_link, ], 'content' => [ 'id' => 'ee-age-gate__trigger-' . $this->get_id(), 'class' => [ 'ee-popup__content', 'ee-age-gate__content', 'ee-age-gate-' . $this->get_id(), 'zoom-anim-dialog', 'mfp-hide', ], ], ] ); if ( '' !== $settings['popup_animation'] ) { $this->add_render_attribute( 'content', 'class', 'mfp-with-anim' ); } ?><div <?php echo $this->get_render_attribute_string( 'wrapper' ) ; ?>> <?php echo $this->render_placeholder( [ 'body' => __( 'Make sure you place this widget in an Elementor template used on all pages such as the header or footer.', 'elementor-extras' ), ] ); ?> <a <?php echo $this->get_render_attribute_string( 'trigger' ) ; ?>></a> <div <?php echo $this->get_render_attribute_string( 'content' ) ; ?>> <?php $this->render_header(); ?> <?php $this->render_body(); ?> </div> </div><?php } /** * Render Header * * @since 2.0.0 * @return void */ public function render_header() { $settings = $this->get_settings_for_display(); if ( empty( $settings['title'] ) && empty( $settings['description'] ) ) return; $this->add_render_attribute( 'header', 'class', [ 'ee-age-gate__header', 'ee-popup__header', ] ); ?><div <?php echo $this->get_render_attribute_string( 'header' ) ; ?>> <?php $this->render_title(); ?> <?php $this->render_description(); ?> </div><?php } /** * Render Title * * @since 2.0.0 * @return void */ public function render_title() { $settings = $this->get_settings_for_display(); if ( empty( $settings['title'] ) ) return; $title_tag = $settings['title_tag']; $this->add_render_attribute( 'title', 'class', [ 'ee-age-gate__header__title', 'ee-popup__header__title', ] ); ?><<?php echo $title_tag; ?> <?php echo $this->get_render_attribute_string( 'title' ) ; ?>> <?php echo $settings['title']; ?> </<?php echo $title_tag; ?>><?php } /** * Render Description * * @since 2.0.0 * @return void */ public function render_description() { $settings = $this->get_settings_for_display(); if ( empty( $settings['description'] ) ) return; $this->add_render_attribute( 'description', 'class', [ 'ee-age-gate__header__description', 'ee-popup__header__description', ] ); ?><div <?php echo $this->get_render_attribute_string( 'description' ) ; ?>> <?php echo $settings['description']; ?> </div><?php } /** * Render Body * * @since 2.0.0 * @return void */ public function render_body() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'content-body' => [ 'class' => [ 'ee-age-gate__content__body', 'ee-popup__content__body', ], ], 'form' => [ 'class' => [ 'elementor-form', 'ee-form', 'ee-form--age-gate', 'elementor-button-align-' . $settings['button_align'], ], ], 'form-fields' => [ 'class' => [ 'elementor-form-fields-wrapper', ], ], 'form-field-age' => [ 'required' => 'required', 'class' => [ 'elementor-field-type-number', 'elementor-field-group', 'elementor-column', 'elementor-col-' . $settings['input_width'], 'elementor-field-group-name', 'ee-form__field', ], ], 'form-field-button' => [ 'class' => [ 'elementor-field-type-submit', 'elementor-field-group', 'elementor-column', 'elementor-col-' . $settings['button_width'], 'elementor-field-group-name', 'ee-form__field', ], ], 'field-age' => [ 'class' => [ 'elementor-field', 'elementor-size-' . $settings['input_size'], 'elementor-field-textual', 'ee-age-gate__form__age', 'ee-form__field__control', ], 'type' => 'number', 'step' => '1', 'name' => 'ee-age-gate-age', ], 'field-submit' => [ 'class' => [ 'elementor-button', 'elementor-size-' . $settings['button_size'], 'ee-form__field__control', 'ee-age-gate__form__submit', ], 'type' => 'submit', ], 'field-submit-icon' => [ 'class' => [ empty( $settings['button_icon_align'] ) ? '' : 'elementor-align-icon-' . $settings['button_icon_align'], 'ee-icon', 'ee-icon-support--svg', 'elementor-button-icon', ], ], 'field-submit-text' => [ 'class' => [ 'elementor-button-text', ], ], ] ); if ( '' !== $settings['button_css_id'] ) { $this->add_render_attribute( 'field-submit', 'id', $settings['button_css_id'] ); } $migrated = isset( $settings['__fa4_migrated']['selected_button_icon'] ); $is_new = empty( $settings['button_icon'] ) && Icons_Manager::is_migration_allowed(); ?><div <?php echo $this->get_render_attribute_string( 'content-body' ) ; ?>><?php $this->render_denied(); ?><form <?php echo $this->get_render_attribute_string( 'form' ) ; ?>> <div <?php echo $this->get_render_attribute_string( 'form-fields' ) ; ?>> <div <?php echo $this->get_render_attribute_string( 'form-field-age' ) ; ?>> <input <?php echo $this->get_render_attribute_string( 'field-age' ) ; ?> /> </div> <div <?php echo $this->get_render_attribute_string( 'form-field-button' ) ; ?>> <button <?php echo $this->get_render_attribute_string( 'field-submit' ) ; ?>> <span><?php if ( ! empty( $settings['button_icon'] ) || ! empty( $settings['selected_button_icon']['value'] ) ) { ?><span <?php echo $this->get_render_attribute_string( 'field-submit-icon' ); ?>><?php if ( $is_new || $migrated ) { Icons_Manager::render_icon( $settings['selected_button_icon'], [ 'aria-hidden' => 'true' ] ); } else { ?><i class="<?php echo esc_attr( $settings['button_icon'] ); ?>" aria-hidden="true"></i><?php } ?></span><?php } ?><span <?php echo $this->get_render_attribute_string( 'field-submit-text' ) ; ?>><?php echo $settings['button_text']; ?></span> </span> </button> </div> </div> </form> </div><?php } /** * Render Denied Message * * @since 2.0.0 * @return void */ public function render_denied() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( 'denied', 'class', [ 'ee-notification', 'ee-notification--error', ] ); ?><div <?php echo $this->get_render_attribute_string( 'denied' ) ; ?>> <?php printf( $settings['denied'], $settings['age'] ); ?> </div><?php } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 2.0.0 * @return void */ public function content_template() {} } popup/widgets/popup.php 0000644 00000200562 15112147616 0011242 0 ustar 00 <?php namespace ElementorExtras\Modules\Popup\Widgets; // Extras for Elementor Classes use ElementorExtras\Group_Control_Transition; use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\Popup\Skins; use ElementorExtras\Modules\Popup\Module as Module; use ElementorExtras\Modules\Image\Module as ImageModule; use ElementorExtras\Modules\TemplatesControl\Module as TemplatesControl; // Elementor Classes use Elementor\Utils; use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Css_Filter; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Popup * * @since 2.0.0 */ class Popup extends Extras_Widget { /** * Has template content * * @since 2.0.0 * @var bool */ protected $_has_template_content = false; /** * Get Name * * Get the name of the widget * * @since 2.0.0 * @return string */ public function get_name() { return 'ee-popup'; } /** * Get Title * * Get the title of the widget * * @since 2.0.0 * @return string */ public function get_title() { return __( 'Popup', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 2.0.0 * @return string */ public function get_icon() { return 'nicon nicon-popup'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 2.0.0 * @return array */ public function get_script_depends() { return [ 'magnific-popup', ]; } /** * Get Style Depends * * A list of css files that the widgets is depended in * * @since 2.0.0 * @return array */ public function get_style_depends() { return [ 'magnific-popup', ]; } /** * Register Skins * * @since 2.0.0 * @return void */ protected function register_skins() { $this->add_skin( new Skins\Skin_Classic( $this ) ); } /** * Register Widget Controls * * @since 2.0.0 * @return void */ protected function _register_controls() { $this->register_content_controls(); } /** * Register Content Controls * * @since 2.0.0 * @return void */ protected function register_content_controls() { $this->start_controls_section( 'section_settings', [ 'label' => __( 'Settings', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'popup_open', [ 'label' => __( 'Keep Open in Editor', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); if ( current_user_can( 'administrator' ) ) { $this->add_control( 'popup_open_admin', [ 'label' => __( 'Always Show for Admins', 'elementor-extras' ), 'description' => __( 'Have the popup open every time you visit the page if you\'re an Admin. This will help you test the functionality on the frontend without actually losing the popup if it\'s not persistent.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); } $this->add_control( 'refresh_widgets', [ 'label' => __( 'Refresh Popup Widgets', 'elementor-extras' ), 'description' => __( 'If you are using templates as content for the popup, this option will refresh any frontend functionality for all elements inside the popup when opened. Turn this off if you notice strange behaviour or broken elements inside the popup.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'popup_disable_on', [ 'label' => __( 'Disable on', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), '1025' => __( 'Mobile & Tablet', 'elementor-extras' ), '768' => __( 'Mobile', 'elementor-extras' ), ], 'separator' => 'before', 'frontend_available' => true, ] ); $this->add_control( 'popup_animation', [ 'label' => __( 'Animation', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'zoom-in', 'options' => Module::get_animation_options(), 'frontend_available' => true, ] ); $this->add_control( 'popup_preloader', [ 'label' => __( 'Preloader', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'separator' => 'before', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'popup_prevent_scroll', [ 'label' => __( 'Prevent Page Scroll', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'popup_fixed', [ 'label' => __( 'Fix On Scroll', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'popup_no_overlay', [ 'label' => __( 'Remove Overlay', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'popup_close_on_content', [ 'label' => __( 'Close On Content Click', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'popup_type!' => 'iframe', ], ] ); $this->add_control( 'popup_close_on_bg', [ 'label' => __( 'Close On Overlay Click', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'popup_no_overlay' => '' ], ] ); $this->add_control( 'popup_close_on_escape', [ 'label' => __( 'Close On Escape Key', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'popup_vertical_fit', [ 'label' => __( 'Fit Vertically', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'popup_type' => 'image', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_trigger', [ 'label' => __( 'Trigger', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'popup_trigger', [ 'label' => __( 'Trigger', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'click', 'options' => [ 'click' => __( 'Click', 'elementor-extras' ), 'instant' => __( 'Instant', 'elementor-extras' ), 'scroll' => __( 'Scroll', 'elementor-extras' ), 'intent' => __( 'Exit Intent', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_control( 'popup_click_target', [ 'label' => __( 'Click Target', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'text', 'options' => [ 'text' => __( 'Text', 'elementor-extras' ), 'id' => __( 'Element ID', 'elementor-extras' ), 'class' => __( 'Element Class', 'elementor-extras' ), ], 'condition' => [ 'popup_trigger' => 'click', ], 'frontend_available' => true, ] ); $this->add_control( 'popup_click_element_id', [ 'label' => __( 'Element CSS ID', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '', 'label_block' => false, 'frontend_available' => true, 'title' => __( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor-extras' ), 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'id', ], ] ); $this->add_control( 'popup_click_element_class', [ 'label' => __( 'Element CSS Class', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '', 'label_block' => false, 'frontend_available' => true, 'title' => __( 'Add your custom class WITHOUT the DOT key. e.g: my-class', 'elementor-extras' ), 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'class', ], ] ); $this->add_control( 'popup_scroll_type', [ 'label' => __( 'Scroll', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'amount', 'separator' => 'before', 'options' => [ 'amount' => __( 'Amount', 'elementor-extras' ), 'element' => __( 'Element', 'elementor-extras' ), ], 'condition' => [ 'popup_trigger' => 'scroll', ], 'frontend_available' => true, ] ); $this->add_control( 'popup_scroll_amount', [ 'label' => __( 'Amount (px)', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'dynamic' => [ 'active' => true ], 'default' => 200, 'min' => 0, 'step' => 10, 'frontend_available' => true, 'condition' => [ 'popup_trigger' => 'scroll', 'popup_scroll_type' => 'amount', ] ] ); $this->add_control( 'popup_scroll_element', [ 'label' => __( 'Element CSS ID', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '', 'label_block' => false, 'frontend_available' => true, 'title' => __( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor-extras' ), 'condition' => [ 'popup_trigger' => 'scroll', 'popup_scroll_type' => 'element', ] ] ); $this->add_control( 'popup_delay', [ 'label' => __( 'Delay (ms)', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'separator' => 'before', 'default' => 3000, 'min' => 0, 'step' => 1000, 'frontend_available' => true, 'condition' => [ 'popup_trigger' => 'instant', ] ] ); $this->add_control( 'popup_intent_sensitivity', [ 'label' => __( 'Intent Sensitivity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'separator' => 'before', 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, ], ], 'frontend_available' => true, 'condition' => [ 'popup_trigger' => 'intent', ] ] ); $this->add_control( 'popup_persist', [ 'label' => __( 'Persist', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'description' => __( 'Turn this off if you want the popup to not show again after opening a number of times.', 'elementor-extras' ), 'default' => 'yes', 'frontend_available' => true, 'condition' => [ 'popup_trigger!' => 'click', ] ] ); $this->add_control( 'popup_times', [ 'label' => __( 'Max. Times to Show', 'elementor-extras' ), 'description' => __( 'How many times should the popup show at most for the specified trigger.', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'frontend_available' => true, 'condition' => [ 'popup_trigger!' => 'click', 'popup_persist' => '', ], ] ); $this->add_control( 'popup_days', [ 'label' => __( 'Days', 'elementor-extras' ), 'description' => __( 'How many days should the popup not show for a user after last open.', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => '30', 'min' => 0, 'step' => 300, 'frontend_available' => true, 'condition' => [ 'popup_trigger!' => 'click', 'popup_persist' => '', ] ] ); $this->add_control( 'popup_trigger_heading', [ 'label' => __( 'Content', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->add_control( 'popup_trigger_text', [ 'label' => __( 'Text', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'type' => Controls_Manager::TEXT, 'default' => __( 'Open modal', 'elementor-extras' ), 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_content', [ 'label' => __( 'Content', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'popup_type', [ 'label' => __( 'Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'text', 'options' => [ 'text' => __( 'Text', 'elementor-extras' ), 'image' => __( 'Image', 'elementor-extras' ), 'template' => __( 'Template', 'elementor-extras' ), 'iframe' => __( 'Iframe', 'elementor-extras' ), 'url' => __( 'URL', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_control( 'popup_title', [ 'label' => __( 'Title', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'type' => Controls_Manager::TEXT, 'default' => __( 'Popup Title', 'elementor-extras' ), 'separator' => 'before', 'condition' => [ 'popup_type' => 'text', ] ] ); $this->add_control( 'popup_title_tag', [ 'label' => __( 'Title HTML Tag', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => __( 'H1', 'elementor-extras' ), 'h2' => __( 'H2', 'elementor-extras' ), 'h3' => __( 'H3', 'elementor-extras' ), 'h4' => __( 'H4', 'elementor-extras' ), 'h5' => __( 'H5', 'elementor-extras' ), 'h6' => __( 'H6', 'elementor-extras' ), 'div' => __( 'div', 'elementor-extras' ), 'span' => __( 'span', 'elementor-extras' ), 'p' => __( 'p', 'elementor-extras' ), ], 'default' => 'h1', 'condition' => [ 'popup_type' => 'text', ] ] ); $this->add_control( 'popup_content', [ 'label' => __( 'Content', 'elementor-extras' ), 'type' => Controls_Manager::WYSIWYG, 'dynamic' => [ 'active' => true ], 'default' => __( 'I am the content of a popup', 'elementor-extras' ), 'condition' => [ 'popup_type' => 'text', ] ] ); $this->add_control( 'popup_iframe_type', [ 'label' => __( 'Iframe Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'video' => __( 'Video', 'elementor-extras' ), 'map' => __( 'Google Map', 'elementor-extras' ), ], 'separator' => 'before', 'default' => 'video', 'condition' => [ 'popup_type' => 'iframe', ] ] ); $this->add_control( 'popup_video_url', [ 'label' => __( 'YouTube Video URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => 'https://www.youtube.com/watch?v=9uOETcuFjbE', 'condition' => [ 'popup_type' => 'iframe', 'popup_iframe_type' => 'video', ] ] ); $this->add_control( 'popup_map_url', [ 'label' => __( 'Google Map URL', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => 'https://maps.google.com/maps?q=221B+Baker+Street,+London,+United+Kingdom&hl=en&t=v&hnear=221B+Baker+St,+London+NW1+6XE,+United+Kingdom', 'condition' => [ 'popup_type' => 'iframe', 'popup_iframe_type' => 'map', ] ] ); $this->add_control( 'popup_image', [ 'label' => __( 'Choose Image', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, ], 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], 'separator' => 'before', 'condition' => [ 'popup_type' => 'image', ] ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'popup_image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `image_size` and `image_custom_dimension`. 'default' => 'large', 'separator' => 'none', 'condition' => [ 'popup_type' => 'image', ] ] ); $this->add_control( 'popup_image_caption_type', [ 'label' => __( 'Caption', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'title' => __( 'Title', 'elementor-extras' ), 'caption' => __( 'Caption', 'elementor-extras' ), 'description' => __( 'Description', 'elementor-extras' ), ], 'condition' => [ 'popup_type' => 'image', ] ] ); $this->add_control( 'popup_template', [ 'label' => __( 'Template', 'elementor-extras' ), 'type' => 'ee-query', 'query_type' => 'templates', 'label_block' => false, 'multiple' => false, 'condition' => [ 'popup_type' => 'template', ], ] ); $this->add_control( 'popup_url', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'separator' => 'before', 'dynamic' => [ 'active' => true ], 'default' => [ 'url' => 'https://www.google.com/', ], 'condition' => [ 'popup_type' => 'url', ], ] ); $this->add_control( 'popup_url_container', [ 'label' => __( 'Content Selector', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '', 'frontend_available' => true, 'title' => __( 'If you want to restrict content from the fetched url to a certain container, add a selector for that container here.', 'elementor-extras' ), 'condition' => [ 'popup_type' => 'url', ], 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_close', [ 'label' => __( 'Close', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'popup_close_icon_heading', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'popup_close_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'outside', 'options' => [ '' => __( 'Hide', 'elementor-extras' ), 'inside' => __( 'Inside', 'elementor-extras' ), 'outside' => __( 'Outside', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'popup_close_halign', [ 'label' => __( 'Horizontal Placement', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'right', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'frontend_available' => true, 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->add_responsive_control( 'popup_close_valign', [ 'label' => __( 'Vertical Placement', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'top', 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], ], 'frontend_available' => true, 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->add_control( 'popup_close_button_heading', [ 'label' => __( 'Button', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], ], ] ); $this->add_control( 'popup_close_button_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ '' => __( 'Hide', 'elementor-extras' ), 'default' => __( 'In Footer', 'elementor-extras' ), 'custom' => __( 'Custom Selector', 'elementor-extras' ), ], 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], ], 'frontend_available' => true, ] ); $this->add_control( 'popup_close_button_text', [ 'label' => __( 'Button Text', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => __( 'Close', 'elementor-extras' ), 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->add_control( 'popup_close_button_custom_notice', [ 'label' => false, 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Add your custom selector below and make sure the element resides inside the content of the popup. If you\'re using a template, edit it with Elementor and add the class to an element inside it.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'custom', ], ] ); $this->add_control( 'popup_close_button_selector', [ 'label' => __( 'Element Selector', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '', 'label_block' => false, 'frontend_available' => true, 'title' => __( 'Add your custom id or class WITH the Pound or Dot key. e.g: #my-id or .my-class', 'elementor-extras' ), 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'custom', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_popup', [ 'label' => __( 'Popup', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'popup_valign', [ 'label' => __( 'Vertical Placement', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'middle', 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'popup_width', [ 'label' => __( 'Max. Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%' ], 'range' => [ '%' => [ 'min' => 0, 'max' => 100, ], 'px' => [ 'min' => 100, 'max' => 1000, ], ], 'selectors' => [ '.ee-mfp-popup--overlay.mfp-wrap.ee-mfp-popup-{{ID}} .mfp-content, .ee-mfp-popup--no-overlay.mfp-wrap.ee-mfp-popup-{{ID}}' => 'max-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'popup_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '.mfp-wrap.ee-mfp-popup-{{ID}} .ee-popup__content, .mfp-wrap.ee-mfp-popup-{{ID}} .mfp-figure, .mfp-wrap.ee-mfp-popup-{{ID}} .mfp-iframe' => 'border-radius: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'popup_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__content' => 'background-color: {{VALUE}};', ], 'conditions' => $this->get_inline_conditions(), ] ); $this->add_control( 'popup_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $this->get_inline_conditions(), ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'popup_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-mfp-popup-{{ID}} .ee-popup__content, .ee-mfp-popup-{{ID}} .mfp-figure, .ee-mfp-popup-{{ID}} .mfp-iframe', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'popup_box_shadow', 'selector' => '.ee-mfp-popup-{{ID}} .ee-popup__content, .ee-mfp-popup-{{ID}} .mfp-figure', 'separator' => '', ] ); $this->add_control( 'popup_overlay_heading', [ 'label' => __( 'Overlay', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'popup_no_overlay' => '' ], ] ); $this->add_control( 'popup_overlay_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.mfp-bg.ee-mfp-popup-{{ID}}' => 'background-color: {{VALUE}};', ], 'condition' => [ 'popup_no_overlay' => '' ], ] ); $this->add_responsive_control( 'popup_overlay_opacity', [ 'label' => __( 'Opacity (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.8, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0, 'step' => 0.01, ], ], 'selectors' => [ '.mfp-bg.ee-mfp-popup.mfp-ready:not(.mfp-removing).ee-mfp-popup-{{ID}}' => 'opacity: {{SIZE}}', ], 'condition' => [ 'popup_no_overlay' => '' ], ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'popup_overlay_filter', 'selector' => '.mfp-bg.ee-mfp-popup-{{ID}}', 'condition' => [ 'popup_no_overlay' => '' ], ] ); $this->add_control( 'popup_overlay_blend', [ 'label' => __( 'Blend mode', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'normal', 'options' => [ 'normal' => __( 'Normal', 'elementor-extras' ), 'multiply' => __( 'Multiply', 'elementor-extras' ), 'screen' => __( 'Screen', 'elementor-extras' ), 'overlay' => __( 'Overlay', 'elementor-extras' ), 'darken' => __( 'Darken', 'elementor-extras' ), 'lighten' => __( 'Lighten', 'elementor-extras' ), 'color' => __( 'Color', 'elementor-extras' ), 'color-dodge' => __( 'Color Dodge', 'elementor-extras' ), 'hue' => __( 'Hue', 'elementor-extras' ), ], 'selectors' => [ '.mfp-bg.ee-mfp-popup-{{ID}}' => 'mix-blend-mode: {{VALUE}};', ], 'condition' => [ 'popup_no_overlay' => '' ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_trigger', [ 'label' => __( 'Trigger', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->add_responsive_control( 'trigger_align', [ 'label' => __( 'Text Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-popup--trigger-text' => 'text-align: {{VALUE}};', ], 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->add_control( 'trigger_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-popup__trigger' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'popup_trigger', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-popup__trigger', 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->add_control( 'trigger_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-popup__trigger' => 'border-radius: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'trigger_transition', 'selector' => '{{WRAPPER}} .ee-popup__trigger', 'separator' => '', 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->start_controls_tabs( 'trigger_default' ); $this->start_controls_tab( 'trigger_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-popup__trigger', 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->add_control( 'trigger_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-popup__trigger' => 'color: {{VALUE}};', ], 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->add_control( 'trigger_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-popup__trigger' => 'background-color: {{VALUE}};', ], 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'trigger_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-popup__trigger', 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->add_control( 'trigger_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-popup__trigger:hover' => 'color: {{VALUE}};', ], 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->add_control( 'trigger_background_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-popup__trigger:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ 'popup_trigger' => 'click', 'popup_click_target' => 'text', ], ] ); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_style_header', [ 'label' => __( 'Header', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'conditions' => $this->get_inline_conditions(), ] ); $this->add_control( 'popup_header_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__header' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $this->get_inline_conditions(), ] ); $this->add_control( 'popup_header_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__header' => 'background-color: {{VALUE}};', ], 'conditions' => $this->get_inline_conditions(), ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'popup_header_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-mfp-popup-{{ID}} .ee-popup__header', 'conditions' => $this->get_inline_conditions(), ] ); $this->add_control( 'popup_title_heading', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'conditions' => $this->get_inline_conditions(), ] ); $this->add_responsive_control( 'popup_title_align', [ 'label' => __( 'Text Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__header__title' => 'text-align: {{VALUE}};', ], 'conditions' => $this->get_inline_conditions(), ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'popup_title_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, ], 'selector' => '.ee-mfp-popup-{{ID}} .ee-popup__header__title', 'conditions' => $this->get_inline_conditions(), ] ); $this->add_control( 'popup_title_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__header__title' => 'color: {{VALUE}};', ], 'conditions' => $this->get_inline_conditions(), ] ); $this->add_control( 'popup_title_background', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__header__title' => 'background-color: {{VALUE}};', ], 'conditions' => $this->get_inline_conditions(), ] ); $this->add_responsive_control( 'popup_title_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__header__title' => 'margin-bottom: {{SIZE}}px;', ], 'conditions' => $this->get_inline_conditions(), ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_body', [ 'label' => __( 'Body', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'conditions' => $this->get_inline_conditions(), ] ); $this->add_responsive_control( 'popup_body_align', [ 'label' => __( 'Text Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__content__body' => 'text-align: {{VALUE}};', ], 'conditions' => $this->get_inline_conditions(), ] ); $this->add_control( 'popup_body_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__content__body' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $this->get_inline_conditions(), ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'popup_body_border', 'separator' => 'before', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-mfp-popup-{{ID}} .ee-popup__content__body', 'conditions' => $this->get_inline_conditions(), ] ); $this->add_control( 'popup_body_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'separator' => 'before', 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__content__body' => 'color: {{VALUE}};', ], 'conditions' => $this->get_inline_conditions(), ] ); $this->add_control( 'popup_body_background', [ 'label' => __( 'Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__content__body' => 'background-color: {{VALUE}};', ], 'conditions' => $this->get_inline_conditions(), ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'popup_body_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'selector' => '.ee-mfp-popup-{{ID}} .ee-popup__content__body', 'conditions' => $this->get_inline_conditions(), ] ); $this->end_controls_section(); $footer_conditions = [ [ 'name' => 'popup_close_button_position', 'operator' => '==', 'value' => 'default', ] ]; $this->start_controls_section( 'section_style_footer', [ 'label' => __( 'Footer', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'conditions' => $this->get_inline_conditions( $footer_conditions ), ] ); $this->add_control( 'popup_footer_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__footer' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $this->get_inline_conditions( $footer_conditions ), ] ); $this->add_control( 'popup_footer_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__footer' => 'background-color: {{VALUE}};', ], 'conditions' => $this->get_inline_conditions( $footer_conditions ), ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'popup_footer_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-mfp-popup-{{ID}} .ee-popup__footer', 'conditions' => $this->get_inline_conditions( $footer_conditions ), ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_image', [ 'label' => __( 'Image', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'popup_type' => 'image', ], ] ); $this->add_control( 'popup_image_heading', [ 'label' => __( 'Image', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'popup_type' => 'image', ], ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'popup_image_filter', 'selector' => '.ee-mfp-popup-{{ID}} .mfp-img', ] ); $this->add_control( 'popup_caption_heading', [ 'label' => __( 'Caption', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'popup_type' => 'image', 'popup_image_caption_type!' => '', ], ] ); $this->add_control( 'popup_caption_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-bottom-bar' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'popup_type' => 'image', 'popup_image_caption_type!' => '', ], ] ); $this->add_control( 'popup_caption_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-bottom-bar' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'popup_type' => 'image', 'popup_image_caption_type!' => '', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'popup_caption_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-mfp-popup-{{ID}} .mfp-bottom-bar', 'condition' => [ 'popup_type' => 'image', 'popup_image_caption_type!' => '', ], ] ); $this->add_control( 'popup_caption_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'separator' => 'before', 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-bottom-bar' => 'color: {{VALUE}};', ], 'conditions' => $this->get_inline_conditions(), ] ); $this->add_control( 'popup_caption_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-bottom-bar' => 'background-color: {{VALUE}};', ], 'condition' => [ 'popup_type' => 'image', 'popup_image_caption_type!' => '', ], ] ); $this->add_control( 'popup_caption_blend', [ 'label' => __( 'Blend mode', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'normal', 'options' => [ 'normal' => __( 'Normal', 'elementor-extras' ), 'multiply' => __( 'Multiply', 'elementor-extras' ), 'screen' => __( 'Screen', 'elementor-extras' ), 'overlay' => __( 'Overlay', 'elementor-extras' ), 'darken' => __( 'Darken', 'elementor-extras' ), 'lighten' => __( 'Lighten', 'elementor-extras' ), 'color' => __( 'Color', 'elementor-extras' ), 'color-dodge' => __( 'Color Dodge', 'elementor-extras' ), 'hue' => __( 'Hue', 'elementor-extras' ), ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-bottom-bar' => 'background-blend-mode: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'popup_caption_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'selector' => '.ee-mfp-popup-{{ID}} .mfp-bottom-bar', 'condition' => [ 'popup_type' => 'image', 'popup_image_caption_type!' => '', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_close', [ 'label' => __( 'Close', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'popup_close_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'popup_close_button_position', 'operator' => '!=', 'value' => '', ], ] ], ] ); $this->add_control( 'popup_style_icon_heading', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->add_responsive_control( 'popup_icon_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 4, 'step' => 0.1, ], ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-close.ee-popup__close' => 'font-size: {{SIZE}}em;', '.ee-mfp-popup-{{ID}} .ee-popup__content' => 'margin: {{SIZE}}em auto;', ], 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->add_responsive_control( 'popup_icon_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 0.9, 'step' => 0.01, ], ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-close.ee-popup__close:before' => 'transform: scale(calc( 1 - {{SIZE}} ));', ], 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->add_responsive_control( 'popup_icon_margin', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-close.ee-popup__close' => 'margin: {{SIZE}}px;', ], 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->add_responsive_control( 'popup_icon_margins', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-close.ee-popup__close' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->add_control( 'popup_icon_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-close.ee-popup__close' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'popup_icon', 'selector' => '.ee-mfp-popup-{{ID}} .ee-popup__close', 'separator' => '', 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->start_controls_tabs( 'icon_tabs_hover' ); $this->start_controls_tab( 'icon_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->add_control( 'popup_icon_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-close.ee-popup__close' => 'color: {{VALUE}};', ], 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->add_control( 'popup_icon_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-close.ee-popup__close' => 'background-color: {{VALUE}};', ], 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'icon_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->add_control( 'popup_icon_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-close.ee-popup__close:hover' => 'color: {{VALUE}};', ], 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->add_control( 'popup_icon_background_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .mfp-close.ee-popup__close:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ 'popup_close_position!' => '', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'popup_style_button_heading', [ 'label' => __( 'Button', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->add_responsive_control( 'popup_style_button_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__footer__button' => 'justify-content: {{VALUE}};', ], 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->add_control( 'popup_button_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__footer__button .ee-button-content-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->add_control( 'popup_button_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__footer__button' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->add_control( 'popup_button_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__footer__button .ee-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'popup_button_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-mfp-popup-{{ID}} .ee-popup__footer__button .ee-button', 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'popup_button_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'selector' => '.ee-mfp-popup-{{ID}} .ee-popup__footer__button .ee-button', 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'popup_button', 'selector' => '.ee-mfp-popup-{{ID}} .ee-popup__footer__button .ee-button', 'separator' => '', 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->start_controls_tabs( 'button_tabs_hover' ); $this->start_controls_tab( 'button_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->add_control( 'popup_button_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__footer__button .ee-button' => 'color: {{VALUE}};', ], 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->add_control( 'popup_button_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__footer__button .ee-button' => 'background-color: {{VALUE}};', ], 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'button_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->add_control( 'popup_button_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__footer__button:hover .ee-button' => 'color: {{VALUE}};', ], 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->add_control( 'popup_button_background_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '.ee-mfp-popup-{{ID}} .ee-popup__footer__button:hover .ee-button' => 'background-color: {{VALUE}};', ], 'condition' => [ 'popup_type!' => [ 'image', 'iframe' ], 'popup_close_button_position' => 'default', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Get Inline Conditions * * Get generic conditions for inline trigger * * @since 2.0.0 * @return void */ private function get_inline_conditions( $new_terms = array() ) { $conditions = [ 'relation' => 'and', 'terms' => [ [ 'name' => 'popup_type', 'operator' => '!=', 'value' => 'image', ], [ 'name' => 'popup_type', 'operator' => '!=', 'value' => 'iframe', ], ] ]; if ( ! empty( $new_terms ) ) { foreach( $new_terms as $term ) { $conditions['terms'][] = $term; } } return $conditions; } /** * Render * * Render widget contents on frontend * * @since 2.0.0 * @return void */ public function render() { $settings = $this->get_settings_for_display(); $has_inline_trigger = 'click' === $settings['popup_trigger'] && 'text' == $settings['popup_click_target']; $content_link = '#ee_popup__trigger-' . $this->get_id(); if ( 'iframe' === $settings['popup_type'] ) { if ( 'video' === $settings['popup_iframe_type'] ) $content_link = $settings['popup_video_url']; if ( 'map' === $settings['popup_iframe_type'] ) $content_link = $settings['popup_map_url']; } if ( 'image' === $settings['popup_type'] && ! empty( $settings['popup_image']['url'] ) ) { $image_url = Group_Control_Image_Size::get_attachment_image_src( $settings['popup_image']['id'], 'popup_image', $settings ); $content_link = $image_url ? $image_url : $settings['popup_image']['url']; $this->add_render_attribute( 'popup-trigger', [ 'data-elementor-open-lightbox' => 'no', 'title' => ImageModule::get_image_caption( $settings['popup_image']['id'] ), ] ); } $this->add_render_attribute( [ 'popup' => [ 'class' => [ 'ee-popup', 'ee-popup--trigger-' . $settings['popup_click_target'], ], 'id' => 'popup-' . $this->get_id(), ], 'popup-trigger' => [ 'class' => [ 'ee-popup__trigger', 'ee-popup__trigger--' . $settings['popup_trigger'], ], 'href' => $content_link, ], 'popup-content' => [ 'class' => [ 'ee-popup__content', 'zoom-anim-dialog', 'mfp-hide', ], 'id' => 'ee_popup__trigger-' . $this->get_id(), ], ] ); if ( 'id' === $settings['popup_click_target'] ) { $this->add_render_attribute( 'popup-trigger', 'data-trigger-id', $settings['popup_click_element_id'] ); } else if ( 'class' === $settings['popup_click_target'] ) { $this->add_render_attribute( 'popup-trigger', 'data-trigger-class', $settings['popup_click_element_class'] ); } if ( '' !== $settings['popup_animation'] ) { $this->add_render_attribute( 'popup-content', 'class', 'mfp-with-anim' ); } if ( 'url' === $settings['popup_type'] && '' !== $settings['popup_url']['url'] ) { $this->add_render_attribute( 'popup-content', 'data-ee-popup-url', $settings['popup_url']['url'] ); } ?><div <?php echo $this->get_render_attribute_string( 'popup' ) ; ?>><?php if ( 'click' !== $settings['popup_trigger'] || 'text' !== $settings['popup_click_target'] ) echo $this->render_placeholder( [ 'body' => __( 'This area will not appear on the front-end.', 'elementor-extras' ), ] ); ?> <a <?php echo $this->get_render_attribute_string( 'popup-trigger' ) ; ?>><?php if ( $has_inline_trigger ) echo $settings['popup_trigger_text']; ?></a> <div <?php echo $this->get_render_attribute_string( 'popup-content' ) ; ?>> <?php $this->render_header(); ?> <?php $this->render_body(); ?> <?php $this->render_footer(); ?> </div> </div><?php } /** * Render Header * * @since 2.0.0 * @return void */ public function render_header() { $settings = $this->get_settings_for_display(); if ( empty( $settings['popup_title'] ) ) return; $title_tag = $settings['popup_title_tag']; $this->add_render_attribute( 'popup-header', 'class', 'ee-popup__header' ); $this->add_render_attribute( 'popup-content-title', 'class', 'ee-popup__header__title' ); ?><div <?php echo $this->get_render_attribute_string( 'popup-header' ) ; ?>> <<?php echo $title_tag; ?> <?php echo $this->get_render_attribute_string( 'popup-content-title' ) ; ?>> <?php echo $settings['popup_title']; ?> </<?php echo $title_tag; ?>> </div><?php } /** * Render Body * * @since 2.0.0 * @return void */ public function render_body() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( 'popup-content-body', 'class', 'ee-popup__content__body' ); ?><div <?php echo $this->get_render_attribute_string( 'popup-content-body' ) ; ?>><?php switch ( $settings['popup_type'] ) { case 'text': echo $this->parse_text_editor( $settings['popup_content'] ); break; case 'template': TemplatesControl::render_template_content( $settings['popup_template'], $this ); break; default: break; } ?></div><?php } /** * Render Footer * * @since 2.0.0 * @return void */ public function render_footer() { $settings = $this->get_settings_for_display(); if ( 'default' !== $settings['popup_close_button_position'] ) return; $this->add_render_attribute( 'popup-footer', 'class', 'ee-popup__footer' ); $this->add_render_attribute( 'popup-button-wrapper', 'class', [ 'ee-popup__footer__button', 'ee-button-wrapper', ] ); $this->add_render_attribute( 'popup-button', 'class', [ 'ee-button', 'ee-button-link', 'ee-size-sm', ] ); $this->add_render_attribute( 'popup-button-content', 'class', 'ee-button-content-wrapper' ); ?><div <?php echo $this->get_render_attribute_string( 'popup-footer' ) ; ?>> <a <?php echo $this->get_render_attribute_string( 'popup-button-wrapper' ) ; ?>> <span <?php echo $this->get_render_attribute_string( 'popup-button' ) ; ?>> <span <?php echo $this->get_render_attribute_string( 'popup-button-content' ) ; ?>> <?php echo $settings['popup_close_button_text']; ?> </span> </span> </a> </div><?php } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 2.0.0 * @return void */ public function content_template() {} } popup/module.php 0000644 00000002455 15112147616 0007717 0 ustar 00 <?php namespace ElementorExtras\Modules\Popup; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; use ElementorExtras\Utils; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Popup\Module * * @since 2.0.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 2.0.0 * @return string */ public function get_name() { return 'popup'; } /** * Get Widgets * * Get the modules' widgets * * @since 2.0.0 * @return array */ public function get_widgets() { return [ 'Popup', 'Age_Gate', ]; } /** * Get Animation Options * * @since 2.0.0 * @return array */ public static function get_animation_options() { return [ '' => __( 'None', 'elementor-extras' ), 'zoom-in' => __( 'Zoom In', 'elementor-extras' ), 'zoom-out' => __( 'Zoom Out', 'elementor-extras' ), 'slide-right' => __( 'Slide Right', 'elementor-extras' ), 'slide-left' => __( 'Slide Left', 'elementor-extras' ), 'slide-top' => __( 'Slide Top', 'elementor-extras' ), 'slide-bottom' => __( 'Slide Bottom', 'elementor-extras' ), 'unfold-horizontal' => __( 'Unfold Horizontal', 'elementor-extras' ), 'unfold-vertical' => __( 'Unfold Vertical', 'elementor-extras' ), ]; } } posts/skins/skin-base.php 0000644 00000144406 15112147616 0011445 0 ustar 00 <?php namespace ElementorExtras\Modules\Posts\Skins; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\Posts\Module as PostsModule; use ElementorExtras\Modules\CustomFields\Module as CustomFields; use ElementorExtras\Modules\TemplatesControl\Module as TemplatesControl; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Group_Control_Image_Size; use Elementor\Skin_Base as Elementor_Skin_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Posts\Skins * * @since 1.6.0 */ abstract class Skin_Base extends Elementor_Skin_Base { /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 1.6.0 * @return void */ protected function _register_controls_actions() { add_action( 'elementor/element/posts-extra/section_layout/before_section_end', [ $this, 'register_controls' ] ); add_action( 'elementor/element/posts-extra/section_layout/before_section_end', [ $this, 'register_controls' ] ); } /** * Register Controls * * @since 1.6.0 * @return void * @param $widget Extras_Widget */ public function register_controls( Extras_Widget $widget ) { $this->parent = $widget; $this->register_before_skin_controls(); $this->register_layout_content_controls(); } /** * Register Before Skin Controls * * @since 2.1.0 * @return void */ public function register_before_skin_controls() { $this->parent->start_injection( [ 'at' => 'before', 'of' => '_skin', ] ); $this->add_control( 'widget_helpers', [ 'label' => __( 'Editor Helper', 'elementor-extras' ), 'description' => __( 'Shows labels overlaid on posts to help your easily identify each post area', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'on', 'prefix_class' => 'ee-posts-helpers-', ] ); $this->parent->end_injection(); } /** * Register Layout Content Controls * * @since 1.6.0 * @return void */ public function register_layout_content_controls() { $this->add_responsive_control( 'grid_columns_spacing', [ 'label' => __( 'Columns Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 24, 'unit' => 'px', ], 'tablet_default' => [ 'size' => 12, 'unit' => 'px', ], 'mobile_default' => [ 'size' => 0, 'unit' => 'px', ], 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'grid_rows_spacing', [ 'label' => __( 'Rows Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'default' => [ 'size' => 24, 'unit' => 'px', ], 'tablet_default' => [ 'size' => 12, 'unit' => 'px', ], 'mobile_default' => [ 'size' => 0, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post' => 'margin-bottom: {{SIZE}}{{UNIT}}', ], ] ); $this->add_responsive_control( 'layout_align', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'stretch', 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], 'stretch' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-v-align-stretch', ], ], 'prefix_class' => 'ee-grid-align%s--', 'condition' => [ $this->get_control_id( 'layout' ) => 'default', ], ] ); $this->add_control( 'layout_equalize', [ 'label' => __( 'Force Equal Height', 'elementor-extras' ), 'description' => __( 'This option tries to give a 100% height to all relevant wrappers inside your template. You will still need to set your desired columns and sections Vertical Align attribute to Space Between, Space Around or Space Evenly if you want your elements to stretch.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'stretch', 'prefix_class' => 'ee-posts-skin--', 'condition' => [ 'skin_source' => 'template', $this->get_control_id( 'layout_align' ) => 'stretch', ], ] ); $this->add_responsive_control( 'layout_halign', [ 'label' => __( 'Horizontal Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'left', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'prefix_class' => 'ee-grid-halign%s--', 'condition' => [ $this->get_control_id( 'layout' ) => 'default', ], ] ); } /** * Get Post Link * * Return the filtered post link * * @since 2.2.6 * @return void */ protected function get_post_link( $post ) { /** * Global Link Filter * * Filters the post media link. This is available only if the whole media area * is linked when the Content > Media > Link to Post option is enabled. * * @since 2.2.6 * @param array $link The original post link * @param object|WP_Post $post The current post */ return apply_filters( 'elementor_extras/widgets/posts/link', get_permalink( $post ), $post ); } /** * Render * * Render widget contents on frontend * * @since 1.6.0 * @return void */ public function render() { $this->parent->render(); $this->parent->query_posts(); $wp_query = $this->parent->get_query(); if ( ! $wp_query->found_posts ) { $this->render_not_found(); return; } // Add filters add_filter( 'excerpt_more', [ $this, 'custom_excerpt_more_filter' ], 999 ); add_filter( 'excerpt_length', [ $this, 'custom_excerpt_length' ], 999 ); add_filter( 'wp_calculate_image_srcset_meta', '__return_null' ); $this->before_loop(); $this->render_loop_start(); $this->render_sizer(); while ( $wp_query->have_posts() ) { $wp_query->the_post(); global $post; $query_id = $this->parent->get_settings('posts_query_id'); if ( $query_id ) { $post->query_id = $query_id; } $index = $wp_query->current_post + 1; $settings = $this->parent->get_settings(); $this->render_post_start(); switch ( $settings['skin_source'] ) { case 'template': TemplatesControl::render_template_content( $this->parent->get_settings( 'skin_template' ), $this->parent, true ); break; default: $this->render_post(); break; } $this->render_post_end(); } wp_reset_postdata(); wp_reset_query(); $this->render_loop_end(); $this->after_loop(); $this->render_scripts(); // Remove filters remove_filter( 'wp_calculate_image_srcset_meta', '__return_null' ); remove_filter( 'excerpt_length', [ $this, 'custom_excerpt_length' ], 999 ); remove_filter( 'excerpt_more', [ $this, 'custom_excerpt_more_filter' ], 999 ); } /** * Render not found message * * @since 2.2.39 * @return void */ public function render_not_found() { $this->parent->add_render_attribute('not-found', 'class', 'ee-posts__nothing-found'); ?><div <?php echo $this->parent->get_render_attribute_string('not-found'); ?>><?php if ( '' !== $this->parent->get_settings( 'nothing_found_type' ) ) { TemplatesControl::render_template_content( $this->parent->get_settings( 'nothing_found_template' ), $this->parent, true ); } else { echo $this->parent->get_settings_for_display( 'nothing_found_message' ); } ?></div><?php } /** * Custom Excerpt Length * * Applies the custom excerpt length * * @since 1.6.0 * @return void */ public function custom_excerpt_length() { return $this->parent->get_settings( 'post_excerpt_length' ); } /** * Custom Excerpt More Filter * * Filter for setting the custom more suffix * * @since 2.1.0 */ public function custom_excerpt_more_filter( $more ) { return $this->parent->get_settings( 'post_excerpt_more' ); } /** * Custom Excerpt More * * Returns the post excerpt more suffix text * * @since 2.1.0 */ public function custom_excerpt_more() { return $this->parent->get_settings( 'post_excerpt_more' ); } /** * Render Loop Start * * Function to render markup before the posts loop starts * * @since 1.6.0 * @return void */ protected function render_loop_start() { $this->parent->add_render_attribute( [ 'metas-separator' => [ 'class' => 'ee-post__meta__separator', ], 'terms-separator' => [ 'class' => [ 'ee-post__terms__separator', ], ], 'loop' => [ 'class' => [ 'ee-grid', 'ee-loop', ], ], ] ); if ( '' !== $this->parent->get_settings( 'layout' ) ) { $this->parent->add_render_attribute( 'loop', 'class', 'ee-grid--' . $this->parent->get_settings( 'classic_layout' ) ); } ?><div <?php echo $this->parent->get_render_attribute_string( 'loop' ); ?>><?php } /** * Render Sizer * * Render markup for masonry sizer * * @since 1.6.0 * @return void */ protected function render_sizer() { $settings = $this->parent->get_settings(); $this->parent->add_render_attribute( 'sizer', 'class', [ 'ee-grid__item--sizer', ] ); ?><div <?php echo $this->parent->get_render_attribute_string( 'sizer' ); ?>></div><?php } /** * Render Post * * Output post content * * @since 1.6.0 * @return void */ protected function render_post() { $settings = $this->parent->get_settings(); if ( ! in_array( $settings[ 'post_media_position' ], array( 'left', 'right' ) ) ) { $this->render_vertical_post(); } else if ( 'yes' === $settings['post_media'] ) { $this->render_horizontal_post(); } else { $this->render_vertical_post(); } } /** * Render Vertical Post * * Output required markup for posts in vertical layout * * @since 1.6.0 * @return void */ protected function render_vertical_post() { $this->render_post_header(); $this->render_post_media(); $this->render_post_body(); $this->render_post_footer(); } /** * Render Horizontal Post * * Output required markup for posts in horizontal layout * * @since 1.6.0 * @return void */ protected function render_horizontal_post() { $this->render_post_media(); $post_content_key = 'post-content-' . get_the_ID(); $this->parent->add_render_attribute( [ $post_content_key => [ 'class' => 'ee-post__content', ], ] ); ?><div <?php echo $this->parent->get_render_attribute_string( $post_content_key ); ?>><?php $this->render_post_header(); $this->render_post_body(); $this->render_post_footer(); ?></div><?php } /** * Render Post Start * * HTML tags and content before the post content starts * * @since 1.6.0 * @return void */ protected function render_post_start() { global $post; $grid_item_key = 'grid-item-' . get_the_ID(); $this->parent->add_render_attribute( $grid_item_key, 'class', [ 'ee-grid__item', 'ee-loop__item', ] ); /** * Item Classes Filter * * Filter for additional item classes * * @since 2.2.28 * @param string $item_classes The array of classes * @param object|WP_Post $post The current post * @param object|WP_Post $settings The widget settings */ $item_classes = apply_filters( 'elementor_extras/widgets/posts/item_classes', [], $post, $this->parent->get_settings() ); $this->parent->add_render_attribute( $grid_item_key, 'class', $item_classes ); $this->before_grid_item(); ?><div <?php echo $this->parent->get_render_attribute_string( $grid_item_key ); ?>><?php $this->after_grid_item_start(); ?><article <?php post_class( $this->parent->get_post_classes() ); ?>><?php } /** * Render Post Header * * @since 1.6.0 * @return void */ protected function render_post_header() { global $post; $settings = $this->parent->get_settings_for_display(); /** * Before Post Header * * Fires right before the output of post header area. * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( 'elementor_extras/widgets/posts/before_post_header', $settings, $post->ID ); $area = 'header'; if ( ! $this->parent->is_empty_area( $area ) ) { $post_header_key = 'post-header-' . get_the_ID(); $this->parent->add_render_attribute( $post_header_key, 'class', [ 'ee-post__header', 'ee-post__area', ] ); $this->parent->add_helper_render_attribute( $post_header_key, 'Header' ); ?><div <?php echo $this->parent->get_render_attribute_string( 'post-header-' . get_the_ID() ); ?>><?php $this->render_post_parts( $area ); ?></div><!-- .ee-post__header --><?php } /** * After Post Header * * Fires right after the output of post header area. * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( 'elementor_extras/widgets/posts/after_post_header', $settings, $post->ID ); } /** * Render Post Media * * @since 1.6.0 * @return void */ protected function render_post_media() { global $post; $settings = $this->parent->get_settings_for_display(); /** * Before Post Media * * Fires right before the output of post media area. * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( 'elementor_extras/widgets/posts/before_post_media', $settings, $post->ID ); $area = 'media'; $media_tag = 'div'; $media_key = 'post-media-' . $post->ID; $media_content_key = 'post-media-content-' . $post->ID; // Option to not show media if ( 'yes' !== $settings['post_media'] ) return; // No thumbnail and no placeholder -> hide if ( ! has_post_thumbnail() && empty( $settings['image']['url'] ) ) return; $this->parent->add_render_attribute( $media_key, 'class', [ 'ee-media', 'ee-post__media', ] ); $this->parent->add_helper_render_attribute( $media_key, 'Media' ); if ( '' !== $settings['post_media_link'] ) { $media_tag = 'a'; $this->parent->add_render_attribute( [ $media_key => [ /** * Media Link Filter * * Filters the post media link. This is available only if the whole media area * is linked when the Content > Media > Link to Post option is enabled. * * @since 2.2.2 * @param array $media_link The original post link * @param object|WP_Post $post The current post */ 'href' => apply_filters( 'elementor_extras/widgets/posts/media/link', $this->get_post_link( $post ), $post ), ], ] ); if ( '' !== $settings['post_media_blank'] ) { $this->parent->add_render_attribute( $media_key, 'target', '_blank' ); } } if ( ! $this->parent->is_empty_area( $area ) ) { $this->parent->add_render_attribute( [ $media_key => [ 'class' => [ 'ee-post__media--content' ], ], $media_content_key => [ 'class' => [ 'ee-media__content', 'ee-post__media__content', 'ee-post__area', ], ], ] ); } ?><<?php echo $media_tag; ?> <?php echo $this->parent->get_render_attribute_string( $media_key ); ?>><?php $this->render_post_media_thumbnail(); $this->render_post_media_overlay(); if ( ! $this->parent->is_empty_area( $area ) ) { ?><div <?php echo $this->parent->get_render_attribute_string( $media_content_key ); ?>><?php $this->render_post_parts( $area ); ?></div><!-- .ee-post__media__content --><?php } ?></<?php echo $media_tag; ?>><!-- .ee-post__media --><?php /** * After Post Media * * Fires right after the output of post media area. * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( 'elementor_extras/widgets/posts/after_post_media', $settings, $post->ID ); } /** * Render Post Body * * @since 1.6.0 * @return void */ protected function render_post_body() { global $post; $settings = $this->parent->get_settings_for_display(); /** * Before Post Body * * Fires right before the output of post body area. * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( 'elementor_extras/widgets/posts/before_post_body', $settings, $post->ID ); $area = 'body'; if ( $this->parent->is_empty_area( $area ) ) return; $body_key = 'post-body-' . get_the_ID(); $this->parent->add_render_attribute( $body_key, 'class', [ 'ee-post__body', 'ee-post__area', ] ); $this->parent->add_helper_render_attribute( $body_key, 'Body' ); ?><div <?php echo $this->parent->get_render_attribute_string( $body_key ); ?>><?php $this->render_post_parts( $area ); ?></div><!-- .ee-post__body --><?php /** * After Post Body * * Fires right after the output of post body area. * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( 'elementor_extras/widgets/posts/after_post_body', $settings, $post->ID ); } /** * Render Post Footer * * @since 1.6.0 * @return void */ protected function render_post_footer() { global $post; $settings = $this->parent->get_settings_for_display(); /** * Before Post Footer * * Fires right before the output of post footer area. * * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( "elementor_extras/widgets/posts/before_post_footer", $settings, $post->ID ); $area = 'footer'; $footer_key = 'post-footer-' . get_the_ID(); if ( $this->parent->is_empty_area( $area ) ) return; $this->parent->add_render_attribute( $footer_key, 'class', [ 'ee-post__footer', 'ee-post__area', ] ); $this->parent->add_helper_render_attribute( $footer_key, 'Footer' ); ?><div <?php echo $this->parent->get_render_attribute_string( $footer_key ); ?>><?php $this->render_post_parts( $area ); ?></div><!-- .ee-post__footer --><?php /** * After Post Footer * * Fires right after the output of post footer area. * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( 'elementor_extras/widgets/posts/after_post_footer', $settings, $post->ID ); } /** * Render Post Parts * * Calls method for given post part * * @since 1.6.0 * @param area The area to render the post parts in * @return void */ protected function render_post_parts( $area ) { global $post; $_ordered_parts = $this->parent->get_ordered_post_parts( PostsModule::get_post_parts() ); /** * After Area Start * * Fires right after the output of a post area container starting html tag. * The $area part refers to the area of the post (header, media, body, footer) * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( "elementor_extras/widgets/posts/after_{$area}_start", $this->parent->get_settings(), $post->ID ); foreach ( $_ordered_parts as $part => $index ) { /** * Before Post Part * * Fires right before the output of a post content part belonging to a post area. * The $area part refers to the area of the post (header, media, body, footer) and * $part refers to one of the post content parts ( terms, title, excerpt, button, metas ). * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( "elementor_extras/widgets/posts/before_{$area}_{$part}", $this->parent->get_settings(), $post->ID ); call_user_func( array( $this, 'render_post_' . $part ), $area ); /** * After Post Part * * Fires right after the output of a post content part belonging to a post area. * The $area part refers to the area of the post (header, media, body, footer) and * $part refers to one of the post content parts ( terms, title, excerpt, button, metas ). * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( "elementor_extras/widgets/posts/after_{$area}_{$part}", $this->parent->get_settings(), $post->ID ); } /** * Before Area End * * Fires right before the output of a post area container ending html tag. * The $area part refers to the area of the post (header, media, body, footer) * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( "elementor_extras/widgets/posts/before_{$area}_end", $this->parent->get_settings(), $post->ID ); } /** * Render Post Metas * * @since 1.6.0 * @param area The post area * @return void */ protected function render_post_metas( $area ) { global $post; // Render any metas in an area if ( $this->parent->metas_in_area( $area ) || $this->parent->is_in_area( 'avatar', $area ) ) { $metas_area_key = 'post-metas-' . $area . '-' . get_the_ID(); $metas_list_key = 'post-metas-list-' . $area . '-' . get_the_ID(); $this->parent->add_render_attribute( [ $metas_area_key => [ 'class' => 'ee-post__metas', ], ] ); $this->parent->add_helper_render_attribute( $metas_area_key, 'Metas' ); $this->parent->add_render_attribute( $metas_list_key, 'class', 'ee-post__metas__list' ); if ( '' !== $this->parent->get_settings( 'metas_display' ) ) { $this->parent->add_render_attribute( $metas_list_key, 'class', 'display--' . $this->parent->get_settings( 'metas_display' ) ); } if ( $this->parent->is_in_area( 'avatar', $area ) ) { $this->parent->add_render_attribute( $metas_area_key, 'class', 'ee-post__metas--has-avatar' ); } if ( $this->parent->metas_in_area( $area ) ) { $this->parent->add_render_attribute( $metas_area_key, 'class', 'ee-post__metas--has-metas' ); } ?><div <?php echo $this->parent->get_render_attribute_string( $metas_area_key ); ?>><?php $this->render_post_avatar( $area ); if ( $this->parent->metas_in_area( $area ) ) { ?><ul <?php echo $this->parent->get_render_attribute_string( $metas_list_key ); ?>><?php $_ordered_parts = $this->parent->get_ordered_post_parts( PostsModule::get_meta_parts() ); /** * Before Metas * * Fires before the output of the first meta in the area. * Any outputted content should be wrapped in <li></li> tags. * The $area part refers to the area of the post ( header, media, body or footer ). * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( "elementor_extras/widgets/posts/before_{$area}_metas", $this->parent->get_settings(), $post->ID ); foreach ( $_ordered_parts as $meta => $index ) { /** * Before Meta * * Fires right before the output of a post meta. * The $meta part refers to the meta of the post ( author, date, comments or price ). * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID * @param string $area The area the meta resides in */ do_action( "elementor_extras/widgets/posts/before_{$meta}", $this->parent->get_settings(), $post->ID, $area ); call_user_func( array( $this, 'render_post_' . $meta ), $area ); /** * After Meta * * Fires right after the output of a post meta. * The $meta part refers to the meta of the post ( author, date, comments or price ). * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID * @param string $area The area the meta resides in */ do_action( "elementor_extras/widgets/posts/after_{$meta}", $this->parent->get_settings(), $post->ID, $area ); } /** * After Metas * * Fires right after the output of the last meta in the area. * Any outputted content should be wrapped in <li></li> tags. * The $area part refers to the area of the post ( header, media, body or footer ). * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( "elementor_extras/widgets/posts/after_{$area}_metas", $this->parent->get_settings(), $post->ID ); ?></ul><?php } ?></div><?php } } /** * Render Post Media Thumbnail * * @since 1.6.0 * @return void */ protected function render_post_media_thumbnail() { global $post; $settings = $this->parent->get_settings_for_display(); // Setup using placholder image field $post_thumbnail = Group_Control_Image_Size::get_attachment_image_html( $settings ); // Setup using post thumbnail if ( has_post_thumbnail() ) { $settings[ 'post_media_thumbnail_size' ] = [ 'id' => get_post_thumbnail_id(), ]; $post_thumbnail = Group_Control_Image_Size::get_attachment_image_html( $settings, 'post_media_thumbnail_size' ); } if ( empty( $post_thumbnail ) ) { return; } $thumbnail_key = 'post-thumbnail' . get_the_ID(); $this->parent->add_render_attribute( $thumbnail_key, 'class', [ 'ee-post__media__thumbnail', 'ee-media__thumbnail', ] ); /** * Post Thumbnail Filter * * Filters the post thumbnail * * @since 2.1.3 * @param string $post_thumbnail The html for the thumbnail of the post * @param object|WP_Post $post The current post */ $post_thumbnail = apply_filters( 'elementor_extras/widgets/posts/thumbnail', $post_thumbnail, $post ); ?><div <?php echo $this->parent->get_render_attribute_string( $thumbnail_key ); ?>><?php echo $post_thumbnail; ?></div><?php } /** * Render Post Media Overlay * * @since 1.6.0 * @return void */ protected function render_post_media_overlay() { $overlay_key = 'post-overlay' . get_the_ID(); $this->parent->add_render_attribute( $overlay_key, 'class', [ 'ee-post__media__overlay', 'ee-media__overlay', ] ); ?><div <?php echo $this->parent->get_render_attribute_string( $overlay_key ); ?>></div><?php } /** * Render Post Terms * * @since 1.6.0 * @param area The area in which the terms are displayed. Defaults to 'header' * @return void */ protected function render_post_terms( $area = 'header' ) { if ( ! $this->parent->is_in_area( 'terms', $area ) ) return; $settings = $this->parent->get_settings(); $terms = $this->parent->get_terms(); $terms_key = 'post-terms-' . get_the_ID(); $term_prefix_key = 'term-prefix-' . get_the_ID(); $term_count = $settings['post_terms_count']; if ( ! $terms || $term_count === 0 ) return; $count = 0; $terms_tag = 'span'; $terms_linked = 'yes' === $this->parent->get_settings( 'post_terms_link' ); $media_linked = 'yes' === $this->parent->get_settings( 'post_media_link' ); $in_media = $this->parent->is_in_area( 'terms', 'media' ); $this->parent->add_render_attribute( [ $terms_key => [ 'class' => [ 'ee-post__terms', ], ], $term_prefix_key => [ 'class' => [ 'ee-post__terms__term', 'ee-post__terms__term--prefix', ], ], ] ); $this->parent->add_helper_render_attribute( $terms_key, 'Terms' ); ?> <ul <?php echo $this->parent->get_render_attribute_string( $terms_key ); ?>> <?php if ( $settings['post_terms_prefix'] ) { ?> <li <?php echo $this->parent->get_render_attribute_string( $term_prefix_key ); ?>> <?php echo $settings['post_terms_prefix']; ?> </li> <?php } ?> <?php foreach( $terms as $term ) { if ( '' !== $term_count && $term_count === $count ) break; $term_render_key = 'term-item-' . get_the_ID() . ' ' . $term->term_id; $term_link_render_key = 'term-link-' . get_the_ID() . ' ' . $term->term_id; $this->parent->add_render_attribute( [ $term_render_key => [ 'class' => [ 'ee-post__terms__term', 'ee-term', 'ee-term--' . $term->slug, ], ], $term_link_render_key => [ 'class' => [ 'ee-post__terms__link', 'ee-term__link', ], ], ] ); if ( ( $in_media && ! $media_linked && $terms_linked ) || ( ! $in_media && $terms_linked ) ) { $terms_tag = 'a'; $this->parent->add_render_attribute( $term_link_render_key, 'href', get_term_link( $term ) ); } ?> <li <?php echo $this->parent->get_render_attribute_string( $term_render_key ); ?>> <<?php echo $terms_tag; ?> <?php echo $this->parent->get_render_attribute_string( $term_link_render_key ); ?>> <?php echo $term->name; ?> </<?php echo $terms_tag; ?>><?php echo $this->render_terms_separator(); ?> </li> <?php $count++; } ?> </ul> <?php } /** * Render Post Title * * @since 1.6.0 * @param area The area to render the post title in * @return void */ protected function render_post_title( $area = 'body' ) { if ( ! $this->parent->is_in_area( 'title', $area ) ) return; global $post; $title_tag = 'div'; $heading_tag = $this->parent->get_settings( 'post_title_element' ); $title_key = 'post-title-' . get_the_ID(); $heading_key = 'post-title-heading-' . get_the_ID(); $in_media = $this->parent->is_in_area( 'title', 'media' ); $title_linked = 'yes' === $this->parent->get_settings( 'post_title_link' ); $media_linked = 'yes' === $this->parent->get_settings( 'post_media_link' ); $post_title = get_the_title(); if ( ( $in_media && ! $media_linked && $title_linked ) || ( ! $in_media && $title_linked ) ) { $title_tag = 'a'; $this->parent->add_render_attribute( [ $title_key => [ /** * Title Link Filter * * Filters the link for the title * * @since 2.2.6 * @param array $title_link The original post link * @param object|WP_Post $post The current post */ 'href' => apply_filters( 'elementor_extras/widgets/posts/title/link', $this->get_post_link( $post ), $post ) ] ] ); if ( '' !== $this->parent->get_settings( 'post_title_link_blank') ) { $this->parent->add_render_attribute( $title_key, 'target', '_blank' ); } } $this->parent->add_render_attribute( [ $title_key => [ 'class' => 'ee-post__title', ], $heading_key => [ 'class' => 'ee-post__title__heading', ], ] ); $this->parent->add_helper_render_attribute( $title_key, 'Title' ); /** * Post Title Filter * * Filters the current post title * * @since 2.1.3 * @param string $post_title The original post date time * @param object|WP_Post $post The current post */ $post_title = apply_filters_deprecated( 'ee_posts_title', [ $post_title, $post ], '2.1.3', 'elementor_extras/widgets/posts/post_title' ); $post_title = apply_filters( 'elementor_extras/widgets/posts/title', $post_title, $post ); ?><<?php echo $title_tag; ?> <?php echo $this->parent->get_render_attribute_string( $title_key ); ?>> <<?php echo $heading_tag; ?> <?php echo $this->parent->get_render_attribute_string( $heading_key ); ?>><?php echo $post_title; ?></<?php echo $heading_tag; ?>> </<?php echo $title_tag; ?>><?php } /** * Render Metas Separator * * @since 1.6.0 * @return void */ protected function render_metas_separator() { if ( '' === $this->parent->get_settings( 'post_metas_separator' ) ) return; $separator = $this->parent->get_settings( 'post_metas_separator' ); ?><span <?php echo $this->parent->get_render_attribute_string( 'metas-separator' ); ?>><?php echo $separator; ?></span><?php } /** * Render Terms Separator * * @since 1.6.0 * @return void */ protected function render_terms_separator() { if ( '' === $this->parent->get_settings( 'post_terms_separator' ) ) return; $separator = $this->parent->get_settings( 'post_terms_separator' ); ?><span <?php echo $this->parent->get_render_attribute_string( 'terms-separator' ); ?>><?php echo $separator; ?></span><?php } /** * Render Post Author * * @since 1.6.0 * @param area The area that the post author is displayed in * @return void */ protected function render_post_author( $area = 'footer' ) { if ( ! $this->parent->is_in_area( 'author', $area ) ) return; $has_link = ! $this->parent->is_in_area( 'author', 'media' ) && 'yes' === $this->parent->get_settings( 'post_author_link' ); $meta_author_key = 'meta-author-' . get_the_ID(); $meta_author_link_key = 'meta-author-link-' . get_the_ID(); $this->parent->add_render_attribute( [ $meta_author_key => [ 'class' => [ 'ee-post__meta', 'ee-post__meta--author', ], ], $meta_author_link_key => [ 'href' => get_author_posts_url( get_the_author_meta( 'ID' ) ), ], ] ); ?><li <?php echo $this->parent->get_render_attribute_string( $meta_author_key ); ?>> <?php if ( $has_link ) : ?> <a <?php echo $this->parent->get_render_attribute_string( $meta_author_link_key ); ?>> <?php endif; ?> <?php echo $this->parent->get_settings('post_author_prefix'); ?> <?php the_author(); ?><?php echo $this->render_metas_separator(); ?> <?php if ( $has_link ) : ?></a><?php endif; ?> </li> <?php } /** * Render Post Avatar * * @since 1.6.0 * @param area The area that the post avatar is displayed in * @return void */ protected function render_post_avatar( $area = 'footer' ) { if ( ! $this->parent->is_in_area( 'avatar', $area ) ) return; $has_link = ! $this->parent->is_in_area( 'avatar', 'media' ) && 'yes' === $this->parent->get_settings( 'post_avatar_link' ); $meta_avatar_key = 'meta-avatar-' . get_the_ID(); $meta_avatar_link_key = 'meta-avatar-link-' . get_the_ID(); $args = [ 'class' => 'ee-post__metas__avatar__image', 'size' => 64, ]; $this->parent->add_render_attribute( [ $meta_avatar_key => [ 'class' => [ 'ee-post__metas__avatar', 'ee-post__meta--avatar' ], ], $meta_avatar_link_key => [ 'href' => get_author_posts_url( get_the_author_meta( 'ID' ) ), ], ] ); ?><div <?php echo $this->parent->get_render_attribute_string( $meta_avatar_key ); ?>> <?php if ( $has_link ) : ?> <a <?php echo $this->parent->get_render_attribute_string( $meta_avatar_link_key ); ?>> <?php endif; ?> <?php echo get_avatar( get_the_author_meta( 'ID' ), 64, '', get_the_author_meta( 'display_name' ), $args ); ?> <?php if ( $has_link ) : ?></a><?php endif; ?> </div><?php } /** * Render Post Datre * * @since 1.6.0 * @param area The area that the post date is displayed in * @return void */ protected function render_post_date( $area = 'footer' ) { global $post; if ( ! $this->parent->is_in_area( 'date', $area ) ) return; $meta_date_key = 'post-date-' . get_the_ID(); $settings = $this->parent->get_settings(); $custom = 'custom' === $settings['post_date_format']; $this->parent->add_render_attribute( [ $meta_date_key => [ 'class' => [ 'ee-post__meta', 'ee-post__meta--date', 'ee-post__metas__date', ], ], ] ); $post_date_time = $this->parent->get_date_formatted( $custom, $settings['post_date_custom_format'], $settings['post_date_format'], $settings['post_time_format'] ); /** * Date Time Filter * * Filters the date and time text * * @since 2.1.3 * @param string $post_date_time The original post date time * @param object|WP_Post $post The current post */ $post_date_time = apply_filters_deprecated( 'ee_posts_date_time', [ $post_date_time, $post ], '2.1.3', 'elementor_extras/widgets/posts/date_time' ); $post_date_time = apply_filters( 'elementor_extras/widgets/posts/date_time', $post_date_time, $post ); ?><li <?php echo $this->parent->get_render_attribute_string( $meta_date_key ); ?>><?php echo $settings['post_date_prefix'] . ' ' . $post_date_time; echo $this->render_metas_separator(); ?></li><?php } /** * Render Post Price * * @since 1.6.0 * @param area The area that the post price is displayed in * @return void */ protected function render_post_price( $area = 'footer' ) { if ( ! is_woocommerce_active() || ! function_exists( 'wc_get_product' ) ) return; if ( ! $this->parent->is_in_area( 'price', $area ) ) return; global $product; $product = wc_get_product(); if ( empty( $product ) ) return; $meta_date_key = 'post-price-' . get_the_ID(); $this->parent->add_render_attribute( [ $meta_date_key => [ 'class' => [ 'ee-post__meta', 'ee-post__meta--price', 'ee-post__metas__price', ], ], ] ); ?><li <?php echo $this->parent->get_render_attribute_string( $meta_date_key ); ?>> <?php wc_get_template( '/single-product/price.php' ); ?> <?php echo $this->render_metas_separator(); ?> </li><?php } /** * Render Post Comments * * @since 1.6.0 * @param area The area that the post comments are displayed in * @return void */ protected function render_post_comments( $area = 'body' ) { if ( ! $this->parent->is_in_area( 'comments', $area ) ) return; global $post; $post_comments = get_comments_number(); $post_comments_prefix = $this->parent->get_settings( 'post_comments_prefix' ); $post_comments_suffix = $this->parent->get_settings( 'post_comments_suffix' ); $comments_key = 'post-comments-' . get_the_ID(); $this->parent->add_render_attribute( [ $comments_key => [ 'class' => [ 'ee-post__meta', 'ee-post__meta--comments', ], ], ] ); /** * Comments Prefix Filter * * Filters the prefix of the post comments counter * * @since 2.1.3 * @param string $post_comments_prefix The initial post comments prefix * @param object|WP_Post $post The current post */ $post_comments_prefix = apply_filters_deprecated( 'ee_posts_comments_prefix', [ $post_comments_prefix, $post ], '2.1.3', 'elementor_extras/widgets/posts/comments/prefix' ); $post_comments_prefix = apply_filters( 'elementor_extras/widgets/posts/comments/prefix', $post_comments_prefix, $post ); /** * Comments Count Filter * * Filters the comments count for the current post * * @since 2.1.3 * @param string $post_comments The initial post comments count * @param object|WP_Post $post The current post */ $post_comments = apply_filters_deprecated( 'ee_posts_comments', [ $post_comments, $post ], '2.1.3', 'elementor_extras/widgets/posts/comments' ); $post_comments = apply_filters( 'elementor_extras/widgets/posts/comments', $post_comments, $post ); /** * Comments Suffix Filter * * Filters the prefix of the post comments counter * * @since 2.1.3 * @param string $post_comments_suffix The initial post comments suffix * @param object|WP_Post $post The current post */ $post_comments_suffix = apply_filters_deprecated( 'ee_posts_comments_suffix', [ $post_comments_suffix, $post ], '2.1.3', 'elementor_extras/widgets/posts/comments/prefix' ); $post_comments_suffix = apply_filters( 'elementor_extras/widgets/posts/comments/suffix', $post_comments_suffix, $post ); ?><li <?php echo $this->parent->get_render_attribute_string( $comments_key ); ?>><?php echo $post_comments_prefix; echo $post_comments; echo $post_comments_suffix; echo $this->render_metas_separator(); ?></li><?php } /** * Render Post Excerpt * * @since 1.6.0 * @param area The area that the post excerpt is displayed in * @return void */ protected function render_post_excerpt( $area = 'body' ) { if ( ! $this->parent->is_in_area( 'excerpt', $area ) || ! $this->custom_excerpt_length() ) return; global $post; $post_excerpt_key = 'post-excerpt-' . get_the_ID(); $post_excerpt = get_the_excerpt(); $post_excerpt_tag = 'div'; $this->parent->add_render_attribute( $post_excerpt_key, 'class', 'ee-post__excerpt' ); $this->parent->add_helper_render_attribute( $post_excerpt_key, 'Excerpt' ); if ( 'yes' === $this->parent->get_settings( 'post_excerpt_trim_custom' ) ) { $post_excerpt = wp_trim_words( $post_excerpt, $this->custom_excerpt_length(), $this->custom_excerpt_more() ); } if ( 'media' === $area ) $tag = 'span'; /** * Post Excerpt Filter * * Filters the post excerpt after at a post level * * @since 2.1.3 * @param string $post_excerpt The original excerpt * @param object|WP_Post $post The current post */ $post_excerpt = apply_filters_deprecated( 'ee_posts_excerpt', [ $post_excerpt, $post ], '2.1.3', 'elementor_extras/widgets/posts/excerpt' ); $post_excerpt = apply_filters( 'elementor_extras/widgets/posts/excerpt', $post_excerpt, $post ); ?><<?php echo $post_excerpt_tag; ?> <?php echo $this->parent->get_render_attribute_string( $post_excerpt_key ); ?>><?php echo $post_excerpt; ?></<?php echo $post_excerpt_tag; ?>><?php } /** * Render Post Button * * @since 2.0.0 * @param area The area that the post button is displayed in * @return void */ protected function render_post_button( $area = 'body' ) { if ( ! $this->parent->is_in_area( 'button', $area ) ) return; if ( 'product' === $this->parent->get_settings('posts_post_type') && 'add_to_cart' == $this->parent->get_settings('post_button_type') ) { $this->render_add_to_cart_button( $area ); } else { $this->render_button( $area ); } } /** * Render Button * * @since 2.1.2 * @param area The area that the post button is displayed in * @return void */ protected function render_button( $area = 'body' ) { global $post; $button_tag = 'a'; $settings = $this->parent->get_settings(); $button_link = $this->get_post_link( $post ); $post_read_more_key = $this->parent->_get_repeater_setting_key( 'post-read-more', 'parts', get_the_ID() ); $post_button_key = $this->parent->_get_repeater_setting_key( 'post-button', 'parts', get_the_ID() ); $this->parent->add_render_attribute( [ $post_read_more_key => [ 'class' => 'ee-post__read-more', ], $post_button_key => [ 'class' => 'ee-post__button', ], ] ); if ( 'media' === $area && 'yes' === $settings['post_media_link'] ) { $button_tag = 'div'; } else { $this->parent->add_render_attribute( $post_button_key, [ /** * Button Link Filter * * Filters the link for the button * * @since 2.1.5 * @param array $button_link The original post link * @param object|WP_Post $post The current post */ 'href' => apply_filters( 'elementor_extras/widgets/posts/button/link', $button_link, $post ), ] ); if ( '' !== $settings['post_button_blank'] ) { $this->parent->add_render_attribute( $post_button_key, 'target', '_blank' ); } } $this->parent->add_helper_render_attribute( $post_read_more_key, 'Button' ); /** * Button Text Filter * * Filters the text for the button * * @since 2.1.3 * @param string $button_text The original text * @param object|WP_Post $post The current post */ $button_text = apply_filters( 'elementor_extras/widgets/posts/button/text', $settings['post_read_more_text'], $post ); ?><div <?php echo $this->parent->get_render_attribute_string( $post_read_more_key ); ?>> <<?php echo $button_tag; ?> <?php echo $this->parent->get_render_attribute_string( $post_button_key ); ?>> <?php echo $button_text; ?> </<?php echo $button_tag; ?>> </div><?php } /** * Render Add To Cart Button * * @since 2.1.2 * @param area The area that the post button is displayed in * @return void */ protected function render_add_to_cart_button( $area = 'body' ) { if ( ! is_woocommerce_active() ) return; if ( 'media' === $area && 'yes' === $this->parent->get_settings('post_media_link') ) return; $add_to_cart_key = $this->parent->_get_repeater_setting_key( 'add_to_cart', 'parts', get_the_ID() ); $this->parent->add_render_attribute( [ $add_to_cart_key => [ 'class' => [ 'ee-post__read-more', 'ee-post__add-to-cart', ], ], ] ); add_filter( 'woocommerce_loop_add_to_cart_args', [ $this, 'filter_woocommerce_add_to_cart_button_args' ], 10, 2 ); add_filter( 'woocommerce_product_add_to_cart_text', [ $this, 'filter_woocommerce_add_to_cart_button_text' ], 10, 2 ); ?><div <?php echo $this->parent->get_render_attribute_string( $add_to_cart_key ); ?>><?php woocommerce_template_loop_add_to_cart(); ?></div><?php remove_filter( 'woocommerce_loop_add_to_cart_args', [ $this, 'filter_woocommerce_add_to_cart_button_args' ], 10, 2 ); remove_filter( 'woocommerce_product_add_to_cart_text', [ $this, 'filter_woocommerce_add_to_cart_button_text' ], 10, 2 ); } /** * Add To Cart Button Filter * * @since 2.1.2 * @param area The area that the post button is displayed in * @return void */ public function filter_woocommerce_add_to_cart_button_args( $defaults, $product ) { $args = [ 'class' => $defaults['class'] . ' ee-post__button ee-post__button--add-to-cart', ]; return wp_parse_args( $args, $defaults ); } /** * Add To Cart Button Text Filter * * @since 2.1.2 * @param area The area that the post button is displayed in * @return void */ public function filter_woocommerce_add_to_cart_button_text( $add_to_cart_text, $instance ) { global $product; $setting_text = $this->parent->get_settings( 'post_button_add_to_cart_text' ); if ( '' !== $setting_text ) { $add_to_cart_text = $setting_text; } /** * Add To Cart Filter * * Filters the button text for add to cart button * * @since 2.1.3 * @param string $add_to_cart_text The original text * @param object|WP_Product $product The current woocommerce product */ $add_to_cart_text = apply_filters( 'elementor_extras/widgets/posts/button/text', $add_to_cart_text, $product ); $add_to_cart_text = apply_filters( 'elementor_extras/widgets/posts/add_to_cart/text', $add_to_cart_text, $product ); return $add_to_cart_text; } /** * Render Loop End * * Outputs the markup for the end of the loop * * @since 1.6.0 * @return void */ protected function render_loop_end() { ?></div><!-- .ee-loop --><?php } /** * Render Post End * * Outputs the markup for the end of the post * * @since 1.6.0 * @return void */ protected function render_post_end() { ?></article><!-- .ee-post --><?php $this->before_grid_item_end(); ?></div><!-- .ee-loop__item --><?php $this->after_grid_item(); } /** * Before Loop * * Executes before the loop is started * * @since 1.6.0 * @return void */ public function before_loop() { global $post; /** * Before Loop * * Fires right before the loop starts * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( 'elementor_extras/widgets/posts/before_loop', $this->parent->get_settings(), $post->ID ); } /** * Before Grid Item * * Executes before the grid item is outputted * * @since 1.6.0 * @return void */ public function before_grid_item() { global $post; /** * Before Grid Item * * Fires right before the output of the grid item container * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( 'elementor_extras/widgets/posts/before_grid_item', $this->parent->get_settings(), $post->ID ); } /** * After Grid Item Start * * Executes after the grid item opening tag is outputted * * @since 2.2.0 * @return void */ public function after_grid_item_start() { global $post; $skin = $this->parent->get_settings( '_skin' ); /** * After Grid Item Start * * Fires right after the output of the grid item container starting html tag. * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( 'elementor_extras/widgets/posts/after_grid_item_start', $this->parent->get_settings(), $post->ID ); } /** * Before Grid Item End * * Executes before the grid item closing tag is outputted * * @since 2.2.0 * @return void */ public function before_grid_item_end() { global $post; $skin = $this->parent->get_settings( '_skin' ); /** * After Grid Item Start * * Fires right after the output of the grid item container ending html tag. * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( 'elementor_extras/widgets/posts/before_grid_item_end', $this->parent->get_settings(), $post->ID ); } /** * After Grid Item * * Executes after the grid item is outputted * * @since 1.6.0 * @return void */ public function after_grid_item() { global $post; /** * After Grid Item * * Fires right after the output of the grid item container * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( 'elementor_extras/widgets/posts/after_grid_item', $this->parent->get_settings(), $post->ID ); } /** * Before Loop * * Executes after the loop has ended * * @since 1.6.0 * @return void */ protected function after_loop() { global $post; /** * After Loop * * Fires right after the loop ends * * @since 2.2.0 * @param array $settings The current widget settings * @param int $post_id The post ID */ do_action( 'elementor_extras/widgets/posts/after_loop', $this->parent->get_settings(), $post->ID ); } /** * Render Pagination * * @since 1.6.0 * @return void */ public function render_pagination() {} /** * Render Load Status * * @since 1.6.0 * @return void */ public function render_load_status() {} /** * Render Load Button * * @since 1.6.0 * @return void */ public function render_load_button() {} /** * Render Scripts * * @since 1.6.0 * @return void */ public function render_scripts() {} } posts/skins/skin-carousel.php 0000644 00000120364 15112147616 0012345 0 ustar 00 <?php namespace ElementorExtras\Modules\Posts\Skins; // Extras for Elementor Classes use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Posts\Skins * * @since 1.6.0 */ class Skin_Carousel extends Skin_Base { /** * Get ID * * Gets the current skin ID * * @since 1.6.0 * @return string */ public function get_id() { return 'carousel'; } /** * Get Title * * Gets the current skin title * * @since 1.6.0 * @return string */ public function get_title() { return __( 'Carousel', 'elementor-extras' ); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 1.6.0 * @return void */ protected function _register_controls_actions() { parent::_register_controls_actions(); add_action( 'elementor/element/posts-extra/section_query/after_section_end', [ $this, 'register_carousel_controls' ] ); add_action( 'elementor/element/posts-extra/section_layout/before_section_end', [ $this, 'inject_layout_content_controls' ] ); add_action( 'elementor/element/posts-extra/section_style_posts/after_section_end', [ $this, 'register_carousel_style_controls' ] ); } /** * Register Layout Content Controls * * @since 1.6.0 * @return void */ public function register_layout_content_controls() { $slides_per_column = range( 1, 6 ); $slides_per_column = array_combine( $slides_per_column, $slides_per_column ); $this->add_control( 'carousel_heading', [ 'label' => __( 'Carousel', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_responsive_control( 'direction', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Orientation', 'elementor-extras' ), 'default' => 'horizontal', 'tablet_default' => 'horizontal', 'mobile_default' => 'horizontal', 'options' => [ 'horizontal' => __( 'Horizontal', 'elementor-extras' ), 'vertical' => __( 'Vertical', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'slides_per_view', [ 'label' => __( 'Slides Per View', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'tablet_default' => '', 'mobile_default' => '', 'options' => [ '' => __( 'Default', 'elementor-extras' ), '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'slides_per_column', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Slides Per Column', 'elementor-extras' ), 'options' => [ '' => __( 'Default', 'elementor-extras' ) ] + $slides_per_column, 'condition' => [ $this->get_control_id( 'direction' ) => 'horizontal', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'slides_to_scroll', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Slides to Scroll', 'elementor-extras' ), 'options' => [ '' => __( 'Default', 'elementor-extras' ) ] + $slides_per_column, 'frontend_available' => true, ] ); parent::register_layout_content_controls(); $this->update_control( 'grid_columns_spacing', [ 'label' => __( 'Grid Spacing', 'elementor-extras' ), ] ); $this->remove_control( 'grid_rows_spacing' ); } /** * Inject Layout Content Controls * * @since 2.1.0 * @return void */ public function inject_layout_content_controls() { $this->parent->start_injection( [ 'at' => 'before', 'of' => 'carousel_grid_columns_spacing', ] ); $this->add_control( 'height', [ 'label' => __( 'Height', 'elementor-extras' ), 'description' => __( 'The carousel needs to have a fixed defined height to work in vertical mode.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'vh' ], 'default' => [ 'size' => 500, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 200, 'max' => 2000, ], '%' => [ 'min' => 0, 'max' => 100, ], 'vh' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-swiper__container' => 'height: {{SIZE}}{{UNIT}};', ], 'condition' => [ $this->get_control_id( 'direction' ) => 'vertical', ], ] ); $this->parent->end_injection(); $this->parent->start_injection( [ 'at' => 'after', 'of' => 'slides_to_scroll', ] ); $this->add_responsive_control( 'slides_align', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'stretch', 'options' => [ 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], 'stretch' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-v-align-stretch', ], ], 'prefix_class' => 'ee-grid-align%s--', ] ); $this->parent->end_injection(); } /** * Register Carousel Controls * * @since 1.6.0 * @return void */ public function register_carousel_controls() { $this->start_controls_section( 'section_carousel', [ 'label' => __( 'Carousel', 'elementor-extras' ), ] ); $this->add_control( 'effect', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Effect', 'elementor-extras' ), 'default' => 'slide', 'options' => [ 'slide' => __( 'Slide', 'elementor-extras' ), 'fade' => __( 'Fade', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_control( 'effect_fade_warning', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'The Fade effect ignores the Slides per View and Slides per Column settings', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', 'condition' => [ $this->get_control_id('effect') => 'fade', ], ] ); $this->add_control( 'speed', [ 'label' => __( 'Duration (ms)', 'elementor-extras' ), 'description' => __( 'Duration of the effect transition.', 'elementor-extras' ) , 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 300, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 2000, 'step' => 100, ], ], 'frontend_available' => true, ] ); $this->add_control( 'resistance_ratio', [ 'label' => __( 'Resistance', 'elementor-extras' ), 'description' => __( 'Set the value for resistant bounds.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.25, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.05, ], ], 'frontend_available' => true, ] ); $this->add_control( 'loop', [ 'type' => Controls_Manager::SWITCHER, 'label' => __( 'Loop', 'elementor-extras' ), 'default' => '', 'separator' => 'before', 'frontend_available' => true, ] ); $this->add_control( 'autoheight', [ 'type' => Controls_Manager::SWITCHER, 'label' => __( 'Auto Height', 'elementor-extras' ), 'default' => '', 'frontend_available' => true, 'conditions'=> [ 'relation' => 'or', 'terms' => [ [ 'name' => $this->get_control_id('slides_per_column'), 'operator' => '==', 'value' => '1', ], [ 'name' => $this->get_control_id('slides_per_column'), 'operator' => '==', 'value' => '', ], ] ] ] ); $this->add_control( 'slide_change_resize', [ 'type' => Controls_Manager::SWITCHER, 'label' => __( 'Trigger Resize on Slide', 'elementor-extras' ), 'description' => __( 'Some widgets inside post skins templates might require triggering a window resize event when changing slides to display correctly.', 'elementor-extras' ), 'default' => '', 'frontend_available' => true, 'condition' => [ 'skin_source' => 'template', ], ] ); $this->add_control( 'arrows', [ 'label' => __( 'Arrows', 'elementor-extras' ), 'type' => Controls_Manager::POPOVER_TOGGLE, 'default' => 'on', 'label_on' => __( 'On', 'elementor-extras' ), 'label_off' => __( 'Off', 'elementor-extras' ), 'return_value' => 'on', 'frontend_available' => true, ] ); $this->parent->start_popover(); $this->add_control( 'arrows_placement', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Placement', 'elementor-extras' ), 'default' => 'inside', 'options' => [ 'inside' => __( 'Inside', 'elementor-extras' ), 'outside' => __( 'Outside', 'elementor-extras' ), ], 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->parent->end_popover(); $this->add_control( 'free_mode', [ 'type' => Controls_Manager::POPOVER_TOGGLE, 'label' => __( 'Free Mode', 'elementor-extras' ), 'description' => __( 'Disable fixed positions for slides.', 'elementor-extras' ), 'default' => '', 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->parent->start_popover(); $this->add_control( 'free_mode_sticky', [ 'type' => Controls_Manager::SWITCHER, 'label' => __( 'Snap to position', 'elementor-extras' ), 'description' => __( 'Enable to snap slides to positions in free mode.', 'elementor-extras' ), 'default' => '', 'return_value' => 'yes', 'frontend_available' => true, 'condition' => [ $this->get_control_id( 'free_mode!' ) => '', ], ] ); $this->add_control( 'free_mode_momentum', [ 'type' => Controls_Manager::SWITCHER, 'label' => __( 'Momentum', 'elementor-extras' ), 'description' => __( 'Enable to keep slide moving for a while after you release it.', 'elementor-extras' ), 'default' => 'yes', 'return_value' => 'yes', 'separator' => 'before', 'frontend_available' => true, 'condition' => [ $this->get_control_id( 'free_mode!' ) => '', ], ] ); $this->add_control( 'free_mode_momentum_ratio', [ 'label' => __( 'Ratio', 'elementor-extras' ), 'description' => __( 'Higher value produces larger momentum distance after you release slider.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 5, 'step' => 0.1, ], ], 'condition' => [ $this->get_control_id( 'free_mode!' ) => '', $this->get_control_id( 'free_mode_momentum!' ) => '', ], 'frontend_available' => true, ] ); $this->add_control( 'free_mode_momentum_velocity', [ 'label' => __( 'Velocity', 'elementor-extras' ), 'description' => __( 'Higher value produces larger momentum velocity after you release slider.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 5, 'step' => 0.1, ], ], 'condition' => [ $this->get_control_id( 'free_mode!' ) => '', $this->get_control_id( 'free_mode_momentum!' ) => '', ], 'frontend_available' => true, ] ); $this->add_control( 'free_mode_momentum_bounce', [ 'type' => Controls_Manager::SWITCHER, 'label' => __( 'Bounce', 'elementor-extras' ), 'description' => __( 'Set to No if you want to disable momentum bounce in free mode.', 'elementor-extras' ), 'default' => 'yes', 'return_value' => 'yes', 'frontend_available' => true, 'condition' => [ $this->get_control_id( 'free_mode!' ) => '', $this->get_control_id( 'free_mode_momentum!' ) => '', ], ] ); $this->add_control( 'free_mode_momentum_bounce_ratio', [ 'label' => __( 'Bounce Ratio', 'elementor-extras' ), 'description' => __( 'Higher value produces larger momentum bounce effect.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 5, 'step' => 0.1, ], ], 'condition' => [ $this->get_control_id( 'free_mode!' ) => '', $this->get_control_id( 'free_mode_momentum!' ) => '', $this->get_control_id( 'free_mode_momentum_bounce!' ) => '', ], 'frontend_available' => true, ] ); $this->parent->end_popover(); $this->add_control( 'autoplay', [ 'label' => __( 'Autoplay', 'elementor-extras' ), 'type' => Controls_Manager::POPOVER_TOGGLE, 'default' => '', 'frontend_available' => true, ] ); $this->parent->start_popover(); $this->add_control( 'autoplay_speed', [ 'label' => __( 'Autoplay Speed', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 5000, 'condition' => [ $this->get_control_id( 'autoplay!' ) => '', ], 'frontend_available' => true, ] ); $this->add_control( 'pause_on_interaction', [ 'label' => __( 'Disable on Interaction', 'elementor-extras' ), 'description' => __( 'Removes autoplay completely on the first interaction with the carousel.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'condition' => [ $this->get_control_id( 'autoplay!' ) => '', ], 'frontend_available' => true, ] ); $this->add_control( 'stop_on_hover', [ 'label' => __( 'Pause on Hover', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'frontend_available' => true, 'condition' => [ $this->get_control_id( 'autoplay!' ) => '', ], ] ); $this->parent->end_popover(); $this->add_control( 'pagination', [ 'label' => __( 'Pagination', 'elementor-extras' ), 'type' => Controls_Manager::POPOVER_TOGGLE, 'default' => 'on', 'label_on' => __( 'On', 'elementor-extras' ), 'label_off' => __( 'Off', 'elementor-extras' ), 'return_value' => 'on', 'frontend_available' => true, ] ); $this->parent->start_popover(); $this->add_control( 'pagination_position', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Position', 'elementor-extras' ), 'default' => 'inside', 'options' => [ 'inside' => __( 'Inside', 'elementor-extras' ), 'outside' => __( 'Outside', 'elementor-extras' ), ], 'frontend_available' => true, 'condition' => [ $this->get_control_id( 'pagination!' ) => '', ] ] ); $this->add_control( 'pagination_type', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Type', 'elementor-extras' ), 'default' => 'bullets', 'options' => [ 'bullets' => __( 'Bullets', 'elementor-extras' ), 'fraction' => __( 'Fraction', 'elementor-extras' ), ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', ], 'frontend_available' => true, ] ); $this->add_control( 'pagination_clickable', [ 'type' => Controls_Manager::SWITCHER, 'label' => __( 'Clickable', 'elementor-extras' ), 'default' => 'yes', 'return_value' => 'yes', 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ], 'frontend_available' => true, ] ); $this->parent->end_popover(); $this->end_controls_section(); } /** * Register Carousel Style Controls * * @since 1.6.0 * @return void */ public function register_carousel_style_controls() { $this->start_controls_section( 'section_style_carousel', [ 'label' => __( 'Carousel', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'conditions'=> [ 'relation' => 'and', 'terms' => [ [ 'name' => '_skin', 'operator' => '==', 'value' => 'carousel', ], [ 'relation' => 'or', 'terms' => [ [ 'name' => $this->get_control_id('arrows'), 'operator' => '!=', 'value' => '', ], [ 'name' => $this->get_control_id('pagination'), 'operator' => '!=', 'value' => '', ], ] ] ] ] ] ); $this->add_control( 'arrows_style_heading', [ 'label' => __( 'Arrows', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->add_control( 'arrows_position', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Position', 'elementor-extras' ), 'default' => 'middle', 'options' => [ 'top' => __( 'Top', 'elementor-extras' ), 'middle' => __( 'Middle', 'elementor-extras' ), 'bottom' => __( 'Bottom', 'elementor-extras' ), ], 'condition' => [ $this->get_control_id('arrows!') => '', $this->get_control_id('direction') => 'horizontal', ] ] ); $this->add_control( 'arrows_position_vertical', [ 'type' => Controls_Manager::SELECT, 'label' => __( 'Position', 'elementor-extras' ), 'default' => 'center', 'options' => [ 'left' => __( 'Left', 'elementor-extras' ), 'center' => __( 'Center', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'condition' => [ $this->get_control_id('arrows!') => '', $this->get_control_id('direction') => 'vertical', ] ] ); $this->add_responsive_control( 'arrows_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 12, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-swiper__button' => 'font-size: {{SIZE}}px;', ], 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->add_responsive_control( 'arrows_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-swiper__button' => 'padding: {{SIZE}}em;', ], 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->add_responsive_control( 'arrows_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .ee-swiper__navigation--inside.ee-swiper__navigation--middle.ee-arrows--horizontal .ee-swiper__button' => 'margin-left: {{SIZE}}px; margin-right: {{SIZE}}px;', '{{WRAPPER}} .ee-swiper__navigation--inside:not(.ee-swiper__navigation--middle).ee-arrows--horizontal .ee-swiper__button' => 'margin: {{SIZE}}px;', '{{WRAPPER}} .ee-swiper__navigation--outside.ee-arrows--horizontal .ee-swiper__button--prev' => 'left: -{{SIZE}}px;', '{{WRAPPER}} .ee-swiper__navigation--outside.ee-arrows--horizontal .ee-swiper__button--next' => 'right: -{{SIZE}}px;', '{{WRAPPER}} .ee-swiper__navigation--inside.ee-swiper__navigation--center.ee-arrows--vertical .ee-swiper__button' => 'margin-top: {{SIZE}}px; margin-bottom: {{SIZE}}px;', '{{WRAPPER}} .ee-swiper__navigation--inside:not(.ee-swiper__navigation--center).ee-arrows--vertical .ee-swiper__button' => 'margin: {{SIZE}}px;', '{{WRAPPER}} .ee-swiper__navigation--outside.ee-arrows--vertical .ee-swiper__button--prev' => 'top: -{{SIZE}}px;', '{{WRAPPER}} .ee-swiper__navigation--outside.ee-arrows--vertical .ee-swiper__button--next' => 'bottom: -{{SIZE}}px;', ], 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->add_responsive_control( 'arrows_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-swiper__button' => 'border-radius: {{SIZE}}%;', ], 'condition' => [ $this->get_control_id('arrows!') => '', ], 'separator' => 'after', ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'arrows', 'selector' => '{{WRAPPER}} .ee-swiper__button', 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->start_controls_tabs( 'arrows_tabs_hover' ); $this->start_controls_tab( 'arrows_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->add_control( 'arrows_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-swiper__button i:before' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->add_control( 'arrows_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-swiper__button' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'arrows_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->add_control( 'arrows_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-swiper__button:not(.ee-swiper__button--disabled):hover i:before' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->add_control( 'arrows_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-swiper__button:not(.ee-swiper__button--disabled):hover' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'arrows_tab_disabled', [ 'label' => __( 'Disabled', 'elementor-extras' ), 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->add_responsive_control( 'arrows_opacity_disabled', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.05, ], ], 'selectors' => [ '{{WRAPPER}} .ee-swiper__button--disabled' => 'opacity: {{SIZE}};', ], 'condition' => [ $this->get_control_id('arrows!') => '', ] ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'pagination_style_heading', [ 'separator' => 'before', 'label' => __( 'Pagination', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ $this->get_control_id( 'pagination!' ) => '', ] ] ); $this->add_responsive_control( 'pagination_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-swiper__pagination.ee-swiper__pagination--horizontal' => 'text-align: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'direction' ) => 'horizontal', ] ] ); $this->add_responsive_control( 'pagination_align_vertical', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'middle', 'options' => [ 'flex-start' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], ], 'selectors' => [ '{{WRAPPER}} .ee-swiper__pagination.ee-swiper__pagination--vertical' => 'justify-content: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'direction' ) => 'vertical', ] ] ); $this->add_responsive_control( 'pagination_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-swiper__pagination--inside.ee-swiper__pagination--horizontal' => 'padding: 0 {{SIZE}}px {{SIZE}}px {{SIZE}}px;', '{{WRAPPER}} .ee-swiper__pagination--outside.ee-swiper__pagination--horizontal' => 'padding: {{SIZE}}px 0 0 0;', '{{WRAPPER}} .ee-swiper__pagination--inside.ee-swiper__pagination--vertical' => 'padding: {{SIZE}}px {{SIZE}}px {{SIZE}}px 0;', '{{WRAPPER}} .ee-swiper__pagination--outside.ee-swiper__pagination--vertical' => 'padding: 0 0 0 {{SIZE}}px;', ], 'condition' => [ $this->get_control_id('pagination!') => '', ] ] ); $this->add_responsive_control( 'pagination_bullets_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 20, ], ], 'selectors' => [ '{{WRAPPER}} .ee-swiper__pagination--horizontal .swiper-pagination-bullet' => 'margin: 0 {{SIZE}}px', '{{WRAPPER}} .ee-swiper__pagination--vertical .swiper-pagination-bullet' => 'margin: {{SIZE}}px 0', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ] ] ); $this->add_responsive_control( 'pagination_bullets_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .swiper-pagination-bullet' => 'border-radius: {{SIZE}}px;', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ], 'separator' => 'after', ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'pagination', 'selector' => '{{WRAPPER}} .swiper-pagination-bullet', 'condition' => [ $this->get_control_id( 'pagination!' ) => '', ] ] ); $this->start_controls_tabs( 'pagination_bullets_tabs_hover' ); $this->start_controls_tab( 'pagination_bullets_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ] ] ); $this->add_responsive_control( 'pagination_bullets_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 12, ], ], 'selectors' => [ '{{WRAPPER}} .swiper-pagination-bullet' => 'width: {{SIZE}}px; height: {{SIZE}}px;', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ] ] ); $this->add_control( 'pagination_bullets_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .swiper-pagination-bullet' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ] ] ); $this->add_responsive_control( 'pagination_bullets_opacity', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.05, ], ], 'selectors' => [ '{{WRAPPER}} .swiper-pagination-bullet' => 'opacity: {{SIZE}};', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'pagination_bullets_tab_hover',[ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ] ] ); $this->add_responsive_control( 'pagination_bullets_size_hover', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 1.5, 'step'=> 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .swiper-pagination-bullet:hover' => 'transform: scale({{SIZE}});', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ] ] ); $this->add_control( 'pagination_bullets_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .swiper-pagination-bullet:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ] ] ); $this->add_responsive_control( 'pagination_bullets_opacity_hover', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.05, ], ], 'selectors' => [ '{{WRAPPER}} .swiper-pagination-bullet:hover' => 'opacity: {{SIZE}};', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'pagination_bullets_tab_active', [ 'label' => __( 'Active', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ] ] ); $this->add_responsive_control( 'pagination_bullets_size_active', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 1.5, 'step'=> 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .swiper-pagination-bullet-active' => 'transform: scale({{SIZE}});', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ] ] ); $this->add_control( 'pagination_bullets_color_active', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .swiper-pagination-bullet-active' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ] ] ); $this->add_responsive_control( 'pagination_bullets_opacity_active', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.05, ], ], 'selectors' => [ '{{WRAPPER}} .swiper-pagination-bullet-active' => 'opacity: {{SIZE}};', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', $this->get_control_id( 'pagination_type' ) => 'bullets', ] ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Before Loop * * Executes before the loop is started * * @since 2.2.28 * @return void */ public function before_loop() { parent::before_loop(); add_filter( 'elementor_extras/widgets/posts/item_classes', [ $this, 'filter_item_classes' ], 10, 3 ); } /** * Before Loop * * Executes after the loop has ended * * @since 2.2.28 * @return void */ public function after_loop() { remove_filter( 'elementor_extras/widgets/posts/item_classes', [ $this, 'filter_item_classes' ] ); parent::after_loop(); } /** * Filter for item classes * * @since 2.2.28 * @return array */ public function filter_item_classes( $classes, $post, $settings ) { $classes[] = 'ee-swiper__slide'; $classes[] = 'swiper-slide'; return $classes; } /** * Render Loop Start * * Function to render markup before the posts loop starts * * @since 1.6.0 * @return void */ protected function render_loop_start() { $settings = $this->parent->get_settings(); $this->parent->add_render_attribute( [ 'metas-separator' => [ 'class' => 'ee-post__meta__separator', ], 'terms-separator' => [ 'class' => [ 'ee-post__terms__separator', ], ], 'swiper' => [ 'class' => [ 'ee-swiper', ], ], 'swiper-container' => [ 'class' => [ 'swiper', 'ee-swiper__container', ], ], 'swiper-wrapper' => [ 'class' => [ 'ee-grid', 'ee-swiper__wrapper', 'swiper-wrapper', ], ], ] ); ?> <div <?php echo $this->parent->get_render_attribute_string( 'swiper' ); ?>> <div <?php echo $this->parent->get_render_attribute_string( 'swiper-container' ); ?>> <div <?php echo $this->parent->get_render_attribute_string( 'swiper-wrapper' ); ?>> <?php } /** * Render Loop End * * Outputs the markup for the end of the loop * * @since 1.6.0 * @return void */ protected function render_loop_end() { ?></div><!-- .ee-swiper__wrapper --> <?php // if ( 'outside' !== $this->parent->get_settings( $this->get_control_id( 'arrows_placement' ) ) ) // $this->render_swiper_navigation(); if ( 'outside' !== $this->parent->get_settings( $this->get_control_id( 'pagination_position' ) ) ) $this->render_swiper_pagination(); ?> </div><!-- .ee-swiper__container --> </div><!-- .ee-swiper --><?php // if ( 'outside' === $this->parent->get_settings( $this->get_control_id( 'arrows_placement' ) ) ) { $this->render_swiper_navigation(); // } if ( 'outside' === $this->parent->get_settings( $this->get_control_id( 'pagination_position' ) ) ) { $this->render_swiper_pagination(); } } /** * Render Swiper Navigation * * Outputs markup for the swiper navigation * * @since 1.6.0 * @return void */ protected function render_swiper_navigation() { $this->parent->add_render_attribute( [ 'navigation' => [ 'class' => [ 'ee-arrows', 'ee-arrows--' . $this->parent->get_settings( $this->get_control_id( 'direction' ) ), 'ee-swiper__navigation', 'ee-swiper__navigation--' . $this->parent->get_settings( $this->get_control_id( 'arrows_placement' ) ), 'ee-swiper__navigation--' . $this->parent->get_settings( $this->get_control_id( 'arrows_position' ) ), 'ee-swiper__navigation--' . $this->parent->get_settings( $this->get_control_id( 'arrows_position_vertical' ) ), ], ], ] ); // if ( '' !== $settings[ $this->get_control_id('arrows') ] ) { // $this->parent->add_render_attribute( 'swiper', [ // 'class' => [ // 'ee-swiper-arrows-placement--' . $settings[ $this->get_control_id('arrows_placement') ], // 'ee-swiper-arrows-position--' . $settings[ $this->get_control_id('arrows_position') ], // ], // ], // ); // } ?><div <?php echo $this->parent->get_render_attribute_string( 'navigation' ); ?>><?php $this->render_swiper_arrows(); ?></div><?php } /** * Render Swiper Pagination * * Outputs markup for the swiper bullets pagination * * @since 1.6.0 * @return void */ public function render_swiper_pagination() { if ( '' === $this->parent->get_settings( $this->get_control_id( 'pagination' ) ) ) return; $this->parent->add_render_attribute( 'pagination', 'class', [ 'ee-swiper__pagination', 'ee-swiper__pagination--' . $this->parent->get_settings( $this->get_control_id( 'direction' ) ), 'ee-swiper__pagination--' . $this->parent->get_settings( $this->get_control_id( 'pagination_position' ) ), 'ee-swiper__pagination-' . $this->parent->get_id(), 'swiper-pagination', ] ); ?><div <?php echo $this->parent->get_render_attribute_string( 'pagination' ); ?>></div><?php } /** * Render Swiper Arrows * * Outputs markup for the swiper arrows navigation * * @since 1.6.0 * @return void */ protected function render_swiper_arrows() { if ( '' === $this->parent->get_settings( $this->get_control_id( 'arrows' ) ) ) return; $prev = is_rtl() ? 'right' : 'left'; $next = is_rtl() ? 'left' : 'right'; $this->parent->add_render_attribute( [ 'button-prev' => [ 'class' => [ 'ee-swiper__button', 'ee-swiper__button--prev', 'ee-arrow', 'ee-arrow--prev', 'ee-swiper__button--prev-' . $this->parent->get_id(), ], ], 'button-prev-icon' => [ 'class' => 'eicon-chevron-' . $prev, ], 'button-next' => [ 'class' => [ 'ee-swiper__button', 'ee-swiper__button--next', 'ee-arrow', 'ee-arrow--next', 'ee-swiper__button--next-' . $this->parent->get_id(), ], ], 'button-next-icon' => [ 'class' => 'eicon-chevron-' . $next, ], ] ); ?><div <?php echo $this->parent->get_render_attribute_string( 'button-prev' ); ?>> <i <?php echo $this->parent->get_render_attribute_string( 'button-prev-icon' ); ?>></i> </div> <div <?php echo $this->parent->get_render_attribute_string( 'button-next' ); ?>> <i <?php echo $this->parent->get_render_attribute_string( 'button-next-icon' ); ?>></i> </div><?php } /** * Render Sizer * * Stop rendering markup for masonry sizer * * @since 1.6.0 * @return void */ protected function render_sizer() {} } posts/skins/skin-classic.php 0000644 00000212540 15112147616 0012147 0 ustar 00 <?php namespace ElementorExtras\Modules\Posts\Skins; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Group_Control_Transition; use ElementorExtras\Modules\Posts\Module; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Border; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Posts\Skins * * @since 1.6.0 */ class Skin_Classic extends Skin_Base { /** * Get Title * * Gets the current skin ID * * @since 1.6.0 * @return string */ public function get_id() { return 'classic'; } /** * Get Title * * Gets the current skin title * * @since 1.6.0 * @return string */ public function get_title() { return __( 'Classic', 'elementor-extras' ); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 1.6.0 * @return void */ protected function _register_controls_actions() { parent::_register_controls_actions(); // add_action( 'elementor/element/posts-extra/section_query/after_section_end', [ $this, 'register_parallax_controls' ] ); add_action( 'elementor/element/posts-extra/section_query/after_section_end', [ $this, 'register_filters_controls' ] ); add_action( 'elementor/element/posts-extra/section_query/after_section_end', [ $this, 'register_infinite_scroll_controls' ] ); add_action( 'elementor/element/posts-extra/section_query/after_section_end', [ $this, 'register_pagination_controls' ] ); add_action( 'elementor/element/posts-extra/section_style_terms/after_section_end', [ $this, 'register_filters_style_controls' ] ); add_action( 'elementor/element/posts-extra/section_style_terms/after_section_end', [ $this, 'register_pagination_style_controls' ] ); add_action( 'elementor/element/posts-extra/section_style_terms/after_section_end', [ $this, 'register_infinite_scroll_style_controls' ] ); } /** * Register Layout Content Controls * * @since 1.6.0 * @return void */ public function register_layout_content_controls() { parent::register_layout_content_controls(); $this->update_responsive_control( 'grid_columns_spacing', [ 'selectors' => [ '{{WRAPPER}} .ee-grid__item' => 'padding-left: {{SIZE}}{{UNIT}}', '{{WRAPPER}} .ee-grid' => 'margin-left: -{{SIZE}}{{UNIT}}', ], ] ); $this->parent->start_injection( [ 'at' => 'before', 'of' => 'classic_grid_columns_spacing', ] ); $this->add_control( 'grid_heading', [ 'label' => __( 'Grid', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'layout', [ 'label' => __( 'Layout', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), 'masonry' => __( 'Masonry', 'elementor-extras' ), ], 'condition' => [ 'columns!' => '1', ], 'frontend_available' => true, ] ); $this->parent->end_injection(); } /** * Register Parallax Controls * * @since 1.6.0 * @return void */ public function register_parallax_controls() { $this->start_controls_section( 'section_parallax', [ 'label' => __( 'Parallax', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'parallax!' ) => '', ], ] ); $this->add_control( 'parallax_disable_on', [ 'label' => __( 'Disable for', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'mobile', 'options' => [ 'none' => __( 'None', 'elementor-extras' ), 'tablet' => __( 'Mobile and tablet', 'elementor-extras' ), 'mobile' => __( 'Mobile only', 'elementor-extras' ), ], 'condition' => [ $this->get_control_id( 'parallax!' ) => '', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'parallax_speed', [ 'label' => __( 'Parallax speed', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0.5, 'unit' => 'px', ], 'tablet_default' => [ 'size' => 0.5, 'unit' => 'px', ], 'mobile_default' => [ 'size' => 0.5, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 0.05, 'max' => 1, 'step' => 0.01, ], ], 'condition' => [ $this->get_control_id( 'parallax!' ) => '', ], 'frontend_available' => true, ] ); $this->end_controls_section(); } /** * Register Infinite Scroll Controls * * @since 1.6.0 * @return void */ public function register_infinite_scroll_controls() { $this->start_controls_section( 'section_infinite_scroll', [ 'label' => __( 'Infinite Scroll', 'elementor-extras' ), ] ); $this->add_control( 'infinite_scroll', [ 'label' => __( 'Infinite Scroll', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'separator' => 'after', 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'infinite_scroll_history', [ 'label' => __( 'Enable History', 'elementor-extras' ), 'description' => __( 'Change the browser history and URL when loading new posts.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'frontend_available' => true, 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', ], ] ); $this->add_control( 'infinite_scroll_status_heading', [ 'separator' => 'before', 'label' => __( 'Status and Loader', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', ], ] ); $this->add_control( 'infinite_scroll_status', [ 'label' => __( 'Show Statuses', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', ], ] ); $this->add_control( 'infinite_scroll_status_helper', [ 'label' => __( 'Preview in Editor', 'elementor-extras' ), 'description' => __( 'Preview loader and status texts in editor mode.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'on', 'condition' => [ $this->get_control_id( 'infinite_scroll_status!' ) => '', $this->get_control_id( 'infinite_scroll!' ) => '', ], 'prefix_class' => 'ee-load-status-helper-' ] ); $this->add_control( 'infinite_scroll_loading_type', [ 'label' => __( 'Loading Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'loader', 'options' => [ 'loader' => __( 'Loader', 'elementor-extras' ), 'text' => __( 'Text', 'elementor-extras' ), ], 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_status!' ) => '', ], ] ); $this->add_control( 'infinite_scroll_loading_loader', [ 'label' => __( 'Loader', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'track', 'options' => [ 'track' => [ 'title' => __( 'Circle Track', 'elementor-extras' ), 'icon' => 'nicon nicon-loader-track', ], 'circle' => [ 'title' => __( 'Circle', 'elementor-extras' ), 'icon' => 'nicon nicon-loader-circle', ], 'bars-equal' => [ 'title' => __( 'Equal Bars', 'elementor-extras' ), 'icon' => 'nicon nicon-loader-bars-equal', ], 'bars-flex' => [ 'title' => __( 'Flexible Bars', 'elementor-extras' ), 'icon' => 'nicon nicon-loader-bars-flex', ], ], 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_status!' ) => '', $this->get_control_id( 'infinite_scroll_loading_type' ) => 'loader', ], ] ); $this->add_control( 'infinite_scroll_loading_text', [ 'label' => __( 'Loading Text', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Loading', 'elementor-extras' ), 'placeholder' => __( 'Loading', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_status!' ) => '', $this->get_control_id( 'infinite_scroll_loading_type' ) => 'text', ], ] ); $this->add_control( 'infinite_scroll_last_text', [ 'label' => __( 'Last Text', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'All articles loaded', 'elementor-extras' ), 'placeholder' => __( 'All articles loaded', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_status!' ) => '', ], ] ); $this->add_control( 'infinite_scroll_error_text', [ 'label' => __( 'Error Text', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'No more articles to load', 'elementor-extras' ), 'placeholder' => __( 'No more articles to load', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_status!' ) => '', ], ] ); $this->add_control( 'infinite_scroll_button_heading', [ 'separator' => 'before', 'label' => __( 'Load Button', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', ], ] ); $this->add_control( 'infinite_scroll_button', [ 'label' => __( 'Show Load Button', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'frontend_available' => true, 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', ], ] ); $this->add_control( 'infinite_scroll_button_text', [ 'label' => __( 'Button Text', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Load more', 'elementor-extras' ), 'placeholder' => __( 'Load more', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button' ) => 'yes', ], ] ); $this->end_controls_section(); } /** * Register Filters Controls * * @since 1.6.0 * @return void */ public function register_filters_controls() { $this->start_controls_section( 'section_filters', [ 'label' => __( 'Filters', 'elementor-extras' ), ] ); $this->add_control( 'filters', [ 'label' => __( 'Enable Filters', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'separator' => 'after', 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'filters_is_warning', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Warning: Filters are not meant to work optimally with Infinite Scroll because posts posts will load upon scroll might result in empty filters until the posts are loaded. ', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'condition' => [ $this->get_control_id( 'filters!' ) => '', ], ] ); $taxonomies = Utils::get_taxonomies_options(); $this->add_control( 'filters_taxonomy', [ 'label' => __( 'Taxonomy', 'elementor-extras' ), 'type' => Controls_Manager::SELECT2, 'label_block' => true, 'default' => 'category', 'options' => $taxonomies, 'condition' => [ $this->get_control_id( 'filters!' ) => '', ], ] ); foreach ( $taxonomies as $name => $label ) { $terms = Utils::get_terms_options( $name ); $this->add_control( 'filters_taxonomy_' . str_replace( '-', '_', $name ), [ 'label' => __( 'Default term', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'label_block' => true, 'default' => '', 'options' => $terms, 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy' ) => $name, ], ] ); $exclude_terms = Utils::get_terms_options( $name, 'id', false ); $this->add_control( 'filters_taxonomy_exclude_' . str_replace( '-', '_', $name ), [ 'label' => __( 'Exclude Terms', 'elementor-extras' ), 'type' => Controls_Manager::SELECT2, 'placeholder' => __( 'None', 'elementor-extras' ), 'multiple' => true, 'options' => $exclude_terms, 'label_block' => true, 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy' ) => $name, ], ] ); } $this->add_control( 'filters_show_all', [ 'label' => __( 'Show All Terms', 'elementor-extras' ), 'description' => __( 'Show all filters (except excluded ones) instead of just those corresponding to the initial queried posts?', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'frontend_available' => true, 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'infinite_scroll' ) => 'yes', ] ] ); include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); if ( is_plugin_active( 'intuitive-custom-post-order/intuitive-custom-post-order.php' ) ) { $this->add_control( 'filters_order_warning', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Looks like you\'re using the Intuitive Custom Posts Order plugin. If you enable ordering on your taxonomy with this plugin, the ordering options below won\'t have any effect.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'condition' => [ $this->get_control_id( 'filters!' ) => '', ], ] ); } $this->add_control( 'filters_orderby', [ 'label' => __( 'Order By', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'name', 'options' => [ 'name' => __( 'Name', 'elementor-extras' ), 'term_id' => __( 'Term ID', 'elementor-extras' ), 'count' => __( 'Post Count', 'elementor-extras' ), 'slug' => __( 'Slug', 'elementor-extras' ), 'description' => __( 'Description', 'elementor-extras' ), 'parent' => __( 'Term Parent', 'elementor-extras' ), 'menu_order' => __( 'Menu Order', 'elementor-extras' ), ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', ], ] ); $this->add_control( 'filters_order', [ 'label' => __( 'Order', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'ASC', 'options' => [ 'ASC' => __( 'Ascending', 'elementor-extras' ), 'DESC' => __( 'Descending', 'elementor-extras' ), ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', ], ] ); $this->add_control( 'filters_show_count', [ 'label' => __( 'Show Post Count', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'frontend_available' => true, 'condition' => [ $this->get_control_id( 'filters!' ) => '', ] ] ); $this->add_control( 'filters_not_found_text', [ 'label' => __( 'Not Found text', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'No posts available', 'elementor-extras' ), 'placeholder' => __( 'No posts available', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'infinite_scroll' ) => 'yes', $this->get_control_id( 'filters_show_all' ) => 'yes', ], 'frontend_available' => true, ] ); $this->add_control( 'filters_all_show', [ 'label' => __( 'Show "All" Filter', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', 'separator' => 'before', 'condition' => [ $this->get_control_id( 'filters!' ) => '', ] ] ); $this->add_control( 'filters_all_text', [ 'label' => __( 'All Text', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'All', 'elementor-extras' ), 'placeholder' => __( 'All', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_all_show!' ) => '', ], ] ); $this->end_controls_section(); } /** * Register Pagination Controls * * @since 1.6.0 * @return void */ public function register_pagination_controls() { $this->start_controls_section( 'section_pagination', [ 'label' => __( 'Pagination', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'infinite_scroll' ) => '', ], ] ); $this->add_control( 'pagination', [ 'label' => __( 'Pagination', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'separator' => 'after', 'return_value' => 'yes', 'condition' => [ $this->get_control_id( 'infinite_scroll' ) => '', ] ] ); $this->add_control( 'pagination_numbers', [ 'label' => __( 'Show Numbers', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', 'condition' => [ $this->get_control_id( 'infinite_scroll' ) => '', $this->get_control_id( 'pagination' ) => 'yes', ] ] ); $this->add_control( 'pagination_show_all', [ 'label' => __( 'Show All Numbers', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', 'condition' => [ $this->get_control_id( 'pagination_numbers' ) => 'yes', $this->get_control_id( 'infinite_scroll' ) => '', $this->get_control_id( 'pagination' ) => 'yes', ], ] ); $this->add_control( 'pagination_prev_next', [ 'label' => __( 'Show Prev Next', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', 'condition' => [ $this->get_control_id( 'infinite_scroll' ) => '', $this->get_control_id( 'pagination' ) => 'yes', ] ] ); $this->add_control( 'pagination_page_limit', [ 'label' => __( 'Page Limit', 'elementor-extras' ), 'default' => '5', 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => $this->get_control_id( 'infinite_scroll' ), 'operator' => '==', 'value' => 'yes', ], [ 'name' => $this->get_control_id( 'pagination' ), 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $this->add_control( 'pagination_multiple', [ 'label' => __( 'Handle Multiple', 'elementor-extras' ), 'description' => __( 'If you have multiple Posts Extra widgets on this page, enable this to make sure one pagination doesn\'t affect the others', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'condition' => [ $this->get_control_id( 'infinite_scroll' ) => '', $this->get_control_id( 'pagination' ) => 'yes', 'posts_post_type!' => 'current_query', ], ] ); $this->add_control( 'pagination_previous_label', [ 'label' => __( 'Previous Label', 'elementor-extras' ), 'default' => __( '← Previous', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'pagination_prev_next' ) => 'yes', $this->get_control_id( 'infinite_scroll' ) => '', $this->get_control_id( 'pagination' ) => 'yes', ], ] ); $this->add_control( 'pagination_next_label', [ 'label' => __( 'Next Label', 'elementor-extras' ), 'default' => __( 'Next →', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'pagination_prev_next' ) => 'yes', $this->get_control_id( 'infinite_scroll' ) => '', $this->get_control_id( 'pagination' ) => 'yes', ], ] ); $this->end_controls_section(); } /** * Register Filters Style Controls * * @since 1.6.0 * @return void */ public function register_filters_style_controls() { $this->start_controls_section( 'section_style_filters', [ 'label' => __( 'Filters', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ $this->get_control_id( 'filters!' ) => '', ] ] ); $this->add_control( 'filters_filters_heading', [ 'separator' => 'before', 'label' => __( 'Filters', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->add_responsive_control( 'stack', [ 'label' => __( 'Stack', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'stack', 'prefix_class' => 'ee-filters%s--', ] ); $this->add_responsive_control( 'filters_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], 'justify' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-h-align-stretch', ], ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ], 'prefix_class' => 'ee-filters-align%s-', ] ); $this->add_responsive_control( 'filters_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-filters' => 'margin-bottom: {{SIZE}}px', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'filters_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-filters__item', 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->add_control( 'filters_filter_heading', [ 'separator' => 'before', 'label' => __( 'Filter', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->add_responsive_control( 'filters_filter_spacing', [ 'label' => __( 'Horizontal Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-filters' => 'margin-left: -{{SIZE}}px', '{{WRAPPER}} .ee-filters__item' => 'margin-left: {{SIZE}}px', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->add_responsive_control( 'filters_filter_vertical_spacing', [ 'label' => __( 'Vertical Spacing', 'elementor-extras' ), 'description' => __( 'If your terms are stacked, this will help you distance them from one another.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-filters__item' => 'margin-bottom: {{SIZE}}px', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->add_responsive_control( 'filters_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-filters__item a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->add_control( 'filters_border_radius', [ 'type' => Controls_Manager::DIMENSIONS, 'label' => __( 'Border Radius', 'elementor-extras' ), 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-filters__item a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->start_controls_tabs( 'filters_tabs_hover' ); $this->start_controls_tab( 'filters_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'filters_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item a' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->add_control( 'filters_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item a' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'filters_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-filters__item a', 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'filters_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'filters_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item a:hover' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->add_control( 'filters_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item a:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->add_control( 'filters_border_color_hover', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item a:hover' => 'border-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'filters_tab_active', [ 'label' => __( 'Active', 'elementor-extras' ) ] ); $this->add_control( 'filters_color_active', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item a.ee--active' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->add_control( 'filters_background_color_active', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item a.ee--active' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->add_control( 'filters_border_color_active', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item a.ee--active' => 'border-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', ] ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'filters_count_heading', [ 'separator' => 'before', 'label' => __( 'Post Count', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ], ] ); $this->add_responsive_control( 'filters_count_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-filters__item__count' => 'margin-left: {{SIZE}}px', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'filters_count_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-filters__item__count', 'exclude' => [ 'font-family', 'line_height', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ], ] ); $this->add_responsive_control( 'filters_count_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-filters__item__count' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ], ] ); $this->add_control( 'filters_count_border_radius', [ 'type' => Controls_Manager::DIMENSIONS, 'label' => __( 'Border Radius', 'elementor-extras' ), 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-filters__item__count' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ], ] ); $this->start_controls_tabs( 'filters_count_tabs' ); $this->start_controls_tab( 'filters_count_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ], ] ); $this->add_control( 'filters_count_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item__count' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ] ] ); $this->add_control( 'filters_count_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item__count' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'filters_count_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ], ] ); $this->add_control( 'filters_count_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item a:hover .ee-filters__item__count' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ] ] ); $this->add_control( 'filters_count_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item a:hover .ee-filters__item__count' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'filters_count_active', [ 'label' => __( 'Active', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ], ] ); $this->add_control( 'filters_count_color_active', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item a.ee--active .ee-filters__item__count' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ] ] ); $this->add_control( 'filters_count_background_color_active', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-filters__item a.ee--active .ee-filters__item__count' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'filters!' ) => '', $this->get_control_id( 'filters_taxonomy!' ) => '', $this->get_control_id( 'filters_show_count!' ) => '', ] ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Register Pagination Style Controls * * @since 1.6.0 * @return void */ public function register_pagination_style_controls() { $this->start_controls_section( 'section_style_pagination', [ 'label' => __( 'Pagination', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ $this->get_control_id( 'pagination!' ) => '', ] ] ); $this->add_control( 'pagination_heading', [ 'separator' => 'before', 'label' => __( 'Pagination', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ $this->get_control_id( 'pagination!' ) => '', ] ] ); $this->add_responsive_control( 'pagination_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', ], 'selectors' => [ '{{WRAPPER}} .ee-pagination' => 'text-align: {{VALUE}};', ] ] ); $this->add_responsive_control( 'pagination_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-pagination' => 'margin-top: {{SIZE}}px', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', ] ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'pagination_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-pagination .page-numbers', 'condition' => [ $this->get_control_id( 'pagination!' ) => '', ] ] ); $this->add_control( 'pagination_numbers_heading', [ 'separator' => 'before', 'label' => __( 'Numbers', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ $this->get_control_id( 'pagination!' ) => '', ] ] ); $this->add_responsive_control( 'pagination_numbers_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers' => 'margin: 0 {{SIZE}}px', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', ] ] ); $this->add_responsive_control( 'pagination_numbers_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', ] ] ); $this->add_control( 'pagination_numbers_border_radius', [ 'separator' => 'after', 'type' => Controls_Manager::DIMENSIONS, 'label' => __( 'Border Radius', 'elementor-extras' ), 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ $this->get_control_id( 'pagination!' ) => '', ] ] ); $this->start_controls_tabs( 'pagination_numbers_tabs_hover' ); $this->start_controls_tab( 'pagination_numbers_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'pagination_numbers_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'pagination_numbers_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'pagination_numbers_opacity', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.05, ], ], 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers' => 'opacity: {{SIZE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'pagination_numbers_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-pagination .page-numbers', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'pagination_numbers_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'pagination_numbers_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers[href]:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'pagination_numbers_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers[href]:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'pagination_numbers_border_color_hover', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers[href]:hover' => 'border-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'pagination_numbers_opacity_hover', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.05, ], ], 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers[href]:hover' => 'opacity: {{SIZE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'pagination_numbers_tab_current', [ 'label' => __( 'Current', 'elementor-extras' ) ] ); $this->add_control( 'pagination_numbers_color_current', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers.current' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'pagination_numbers_background_color_current', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers.current' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'pagination_numbers_border_color_current', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers.current' => 'border-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'pagination_numbers_opacity_current', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.05, ], ], 'selectors' => [ '{{WRAPPER}} .ee-pagination .page-numbers.current' => 'opacity: {{SIZE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Register Infinite Scroll Style Controls * * @since 1.6.0 * @return void */ public function register_infinite_scroll_style_controls() { $this->start_controls_section( 'section_style_infinite_scroll', [ 'label' => __( 'Infinite Scroll', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', ] ] ); $this->add_control( 'infinite_scroll_status_style_heading', [ 'separator' => 'before', 'label' => __( 'Status', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_status!' ) => '', ] ] ); $this->add_responsive_control( 'infinite_scroll_status_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-load-status' => 'margin-top: {{SIZE}}px', ], 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_status!' ) => '', ] ] ); $this->add_control( 'infinite_scroll_loader_style_heading', [ 'separator' => 'before', 'label' => __( 'Loader', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_status!' ) => '', $this->get_control_id( 'infinite_scroll_loading_type' ) => 'loader', ] ] ); $this->add_control( 'infinite_scroll_loader_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-load-status__request svg *[fill]' => 'fill: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_status!' ) => '', $this->get_control_id( 'infinite_scroll_loading_type' ) => 'loader', ] ] ); $this->add_control( 'infinite_scroll_button_style_heading', [ 'separator' => 'before', 'label' => __( 'Button', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ] ] ); $this->add_responsive_control( 'infinite_scroll_button_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-load-button' => 'margin-top: {{SIZE}}px', ], 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ] ] ); $this->add_responsive_control( 'infinite_scroll_button_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-load-button' => 'display: flex; justify-content: {{VALUE}};' ], 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ], ] ); $this->add_responsive_control( 'infinite_scroll_button_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-load-button__trigger .ee-button-content-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'load_button', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-load-button__trigger', 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ] ] ); $this->add_control( 'infinite_scroll_button_border_radius', [ 'separator' => 'after', 'type' => Controls_Manager::DIMENSIONS, 'label' => __( 'Border Radius', 'elementor-extras' ), 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-load-button__trigger' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'infinite_scroll_button_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-load-button__trigger', 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'load_button', 'selector' => '{{WRAPPER}} .ee-load-button__trigger', 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ], ] ); $this->start_controls_tabs( 'infinite_scroll_button_tabs_hover' ); $this->start_controls_tab( 'infinite_scroll_button_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ], ] ); $this->add_control( 'infinite_scroll_button_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-load-button__trigger' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ], ] ); $this->add_control( 'infinite_scroll_button_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-load-button__trigger' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'infinite_scroll_button_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ], ] ); $this->add_control( 'infinite_scroll_button_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-load-button__trigger:hover' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ], ] ); $this->add_control( 'infinite_scroll_button_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-load-button__trigger:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'infinite_scroll!' ) => '', $this->get_control_id( 'infinite_scroll_button!' ) => '', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Before Loop * * Executes before the loop is started * * @since 1.6.0 * @return void */ public function before_loop() { $this->render_filters(); parent::before_loop(); add_filter( 'elementor_extras/widgets/posts/item_classes', [ $this, 'filter_item_classes' ], 10, 3 ); } /** * Before Loop * * Executes after the loop has ended * * @since 1.6.0 * @return void */ public function after_loop() { remove_filter( 'elementor_extras/widgets/posts/item_classes', [ $this, 'filter_item_classes' ] ); parent::after_loop(); if ( 'yes' === $this->get_instance_value( 'infinite_scroll' ) || 'yes' === $this->get_instance_value( 'pagination' ) ) { $this->parent->add_render_attribute( 'pagination', [ 'aria-label' => __( 'Pagination', 'elementor-extras' ), 'class' => 'ee-pagination', 'role' => 'navigation', ] ); if ( 'yes' === $this->get_instance_value('pagination_multiple') ) { add_filter( 'elementor_extras/widgets/posts/pagination_link', [ $this->parent, 'filter_page_link' ], 10, 2 ); } if ( 'yes' === $this->get_instance_value('infinite_scroll') ) { $this->render_infinite_scroll(); $this->render_load_status(); $this->render_load_button(); } else { $this->render_pagination(); } if ( 'yes' === $this->get_instance_value('pagination_multiple') ) { remove_filter( 'elementor_extras/widgets/posts/pagination_link', [ $this->parent, 'filter_page_link' ] ); } } } /** * Filter for item classes * * * @since 2.2.28 * @return array */ public function filter_item_classes( $classes, $post, $settings ) { // Generate array with class names from filters if ( isset( $post->filters ) ) { foreach ( $post->filters as $filter ) { $classes[] = 'ee-filter-' . $filter->term_id; } } return $classes; } /** * Render Filters * * Outputs filters from taxonomy terms * * @since 1.6.0 * @return void */ protected function render_filters() { $taxonomy = $this->get_instance_value( 'filters_taxonomy' ); if ( '' === $this->get_instance_value( 'filters' ) || ! $taxonomy ) return; $this->parent->set_filters( $taxonomy ); $filters = $this->parent->get_filters(); $default_filter_control_id = $this->get_control_id( 'filters_taxonomy_' . str_replace( '-', '_', $taxonomy ) ); $default_filter = $this->parent->get_settings( $default_filter_control_id ); if ( empty( $filters ) ) return; $this->parent->add_render_attribute( [ 'filters' => [ 'class' => [ 'ee-filters', 'ee-filters--' . $taxonomy, ], ], 'filter-all' => [ 'class' => [ 'ee-filters__item', 'o-nav__item', ], ], 'filter-count' => [ 'class' => [ 'ee-filters__item__count', ], ], $this->get_control_id( 'filters_all_text' ) => [ 'data-filter' => '*', ], ] ); if ( '' === $default_filter ) { $this->parent->add_render_attribute( $this->get_control_id( 'filters_all_text' ), 'class', 'ee--active' ); } ?><ul <?php echo $this->parent->get_render_attribute_string( 'filters' ); ?>> <?php if ( $this->get_instance_value( 'filters_all_show' ) ) : ?> <li <?php echo $this->parent->get_render_attribute_string( 'filter-all' ); ?>><a <?php echo $this->parent->get_render_attribute_string( $this->get_control_id( 'filters_all_text' ) ); ?>> <?php echo $this->get_instance_value( 'filters_all_text' ); ?> </a></li> <?php endif; ?> <?php foreach ( $filters as $filter ) { $filter_term_key = 'filter-term-' . $filter->term_id; $filter_link_key = 'filter-link-' . $filter->term_id; $this->parent->add_render_attribute( [ $filter_term_key => [ 'class' => [ 'ee-filters__item', 'o-nav__item', 'ee-term', 'ee-term--' . $filter->slug, ], ], $filter_link_key => [ 'data-filter' => '.ee-filter-' . $filter->term_id, 'class' => 'ee-term__link' ], ] ); if ( $filter->slug === $default_filter ) { $this->parent->add_render_attribute( $filter_link_key, 'class', 'ee--active' ); } ?><li <?php echo $this->parent->get_render_attribute_string( $filter_term_key ); ?>> <a <?php echo $this->parent->get_render_attribute_string( $filter_link_key ); ?>> <?php echo $filter->name; ?> <?php if ( $this->parent->get_settings( $this->get_control_id( 'filters_show_count' ) ) ) { ?> <span <?php echo $this->parent->get_render_attribute_string( 'filter-count' ); ?>> <?php echo $filter->count; ?> </span> <?php } ?> </a> </li> <?php } ?> </ul><?php if ( 'yes' === $this->parent->get_settings( $this->get_control_id( 'filters_show_all' ) ) && 'yes' === $this->parent->get_settings( $this->get_control_id( 'infinite_scroll' ) ) ) { $this->render_filters_not_found(); } } /** * Render Filters Not Found * * Outputs html for message to be displayed when no filters are found * * @since 1.6.0 * @return void */ protected function render_filters_not_found() { $this->parent->add_render_attribute( 'filters-not-found', [ 'class' => [ 'ee-grid__notice', 'ee-grid__notice--not-found', 'ee-text--center' ], ] ); ?><p <?php echo $this->parent->get_render_attribute_string( 'filters-not-found' ); ?>> <?php echo $this->parent->get_settings( $this->get_control_id( 'filters_not_found_text' ) ); ?> </p><?php } /** * Render Load Status * * The status of the infinite scroll loading process * * @since 1.6.0 * @return void */ public function render_load_status() { if ( 'yes' !== $this->get_instance_value( 'infinite_scroll_status' ) ) return; $this->parent->add_render_attribute( [ 'status' => [ 'class' => 'ee-load-status', ], 'status-request' => [ 'class' => [ 'ee-load-status__request', 'infinite-scroll-request', ], ], 'status-last' => [ 'class' => [ 'ee-load-status__last', 'infinite-scroll-last', ], ], 'status-error' => [ 'class' => [ 'ee-load-status__error', 'infinite-scroll-error', ], ], ] ); ?><div <?php echo $this->parent->get_render_attribute_string( 'status' ); ?>> <div <?php echo $this->parent->get_render_attribute_string( 'status-request' ); ?>> <?php if ( 'text' === $this->get_instance_value( 'infinite_scroll_loading_type' ) ) { echo $this->get_instance_value( 'infinite_scroll_loading_text' ); } else if ( 'loader' === $this->get_instance_value( 'infinite_scroll_loading_type' ) ) { echo $this->render_loading_svg(); } ?> </div> <div <?php echo $this->parent->get_render_attribute_string( 'status-last' ); ?>> <?php echo $this->get_instance_value( 'infinite_scroll_last_text' ); ?> </div> <div <?php echo $this->parent->get_render_attribute_string( 'status-error' ); ?>> <?php echo $this->get_instance_value( 'infinite_scroll_error_text' ); ?> </div> </div><?php } /** * Render Loading SVG * * Svg code for the loading state of infinite scroll * * @since 1.6.0 * @return void */ protected function render_loading_svg() { $loader_filename = 'track'; if ( $this->get_instance_value( 'infinite_scroll_loading_loader' ) ) { $loader_filename = $this->get_instance_value( 'infinite_scroll_loading_loader' ); } include ELEMENTOR_EXTRAS_PATH . 'assets/shapes/loader-' . $loader_filename . '.svg'; } /** * Render Load Button * * Markup to display the load more button for infinite scroll * * @since 1.6.0 * @return void */ public function render_load_button() { if ( '' === $this->get_instance_value( 'infinite_scroll_button' ) || 2 > $this->parent->get_query()->max_num_pages ) { return; } $this->parent->add_render_attribute( [ 'load' => [ 'class' => [ 'ee-load-button', ], ], 'load-button' => [ 'class' => [ 'ee-load-button__trigger', 'ee-load-button__trigger--' . $this->parent->get_id(), 'ee-button', 'ee-size-sm', ], 'href' => '', ], 'load-button-content-wrapper' => [ 'class' => 'ee-button-content-wrapper', ], 'load-button-text' => [ 'class' => 'ee-button-text', ], ] ); ?><div <?php echo $this->parent->get_render_attribute_string( 'load' ); ?>> <a <?php echo $this->parent->get_render_attribute_string( 'load-button' ); ?>> <span <?php echo $this->parent->get_render_attribute_string( 'load-button-content-wrapper' ); ?>> <span <?php echo $this->parent->get_render_attribute_string( 'load-button-text' ); ?>> <?php echo $this->get_instance_value( 'infinite_scroll_button_text' ); ?> </span> </span> </a> </div><?php } /** * Render Infinite Scroll * * Renders links used for infinite scroll to * fetch next pages and load content into the * list of posts * * @since 2.2.8 * @return void */ public function render_infinite_scroll() { // Prevent output when using infinite scroll in edit mode if ( $this->parent->_is_edit_mode ) { return; } $this->parent->add_render_attribute( 'pagination', 'class', 'ee-pagination--is' ); ?><nav <?php echo $this->parent->get_render_attribute_string( 'pagination' ); ?>><?php $this->parent->render_pagination_link( $this->get_instance_value('pagination_next_label'), 'next' ); ?></nav><?php } /** * Render Pagination * * @since 1.6.0 * @return void */ public function render_pagination() { $limit = $this->parent->get_query()->max_num_pages; if ( empty( $this->get_instance_value('pagination') ) || $limit < 2 ) { return; } $custom_limit = $this->get_instance_value('pagination_page_limit'); $has_next_prev = 'yes' === $this->get_instance_value('pagination_prev_next'); $has_numbers = 'yes' === $this->get_instance_value('pagination_numbers'); $multiple = 'yes' === $this->get_instance_value('pagination_multiple'); if ( ! empty( $custom_limit ) ) { $limit = min( $custom_limit, $limit ); } ?><nav <?php echo $this->parent->get_render_attribute_string('pagination'); ?>><?php if ( $has_next_prev ) { $this->parent->render_pagination_link( $this->get_instance_value('pagination_previous_label'), 'previous', $limit ); } if ( $has_numbers ) { /** * Paginate Links Args Filter * * Filters the paginate_links args * * @since 2.2.38 * @param array $args The initial args */ $paginate_args = apply_filters( 'elementor_extras/widgets/posts/paginate_links_args', [ 'type' => 'plain', 'total' => $limit, 'current' => $this->parent->get_current_page(), 'show_all' => 'yes' === $this->get_instance_value('pagination_show_all'), 'prev_next' => false, 'before_page_number' => '<span class="elementor-screen-only">' . __( 'Page ', 'elementor-extras' ) . '</span>', ] ); /* * On single pages we use a custom format * for pagination based on custom query var */ if ( Module::is_custom_pagination() ) { global $wp_rewrite; if ( $wp_rewrite->using_permalinks() ) { $paginate_args['base'] = trailingslashit( get_permalink() ) . '%_%'; $paginate_args['format'] = user_trailingslashit( "%#%", 'single_paged' ); } else { $paginate_args['format'] = "?page=%#%"; } } if ( $multiple ) { add_filter( 'paginate_links', [ $this, 'add_unique_pagination_query_arg' ] ); } else { add_filter( 'paginate_links', [ $this, 'remove_unique_pagination_query_arg' ] ); } echo paginate_links( $paginate_args ); // Remove all filters remove_filter( 'paginate_links', [ $this, 'add_unique_pagination_query_arg' ] ); remove_filter( 'paginate_links', [ $this, 'remove_unique_pagination_query_arg' ] ); } if ( $has_next_prev ) { $this->parent->render_pagination_link( $this->get_instance_value('pagination_next_label'), 'next', $limit ); } ?></nav><?php } /** * Filters the paginate_links page numbers links * * Add posts widget id to current pagination numbers links * * @since 2.2.38 * @access public * @return string */ public function add_unique_pagination_query_arg( $link ) { return add_query_arg( 'posts', $this->parent->get_id(), $link ); } /** * Filters the paginate_links page numbers links * * Remove posts widget id from current pagination numbers links * * @since 2.2.38 * @access public * @return string */ public function remove_unique_pagination_query_arg( $link ) { return filter_input( INPUT_GET, 'posts' ) ? remove_query_arg( 'posts', $link ) : $link; } /** * Render Scripts * * Handles javascript functionality for the widget inside the editor ONLY * * @since 1.6.0 * @return void */ public function render_scripts() { if ( \Elementor\Plugin::instance()->editor->is_edit_mode() === false ) return; ?><script type="text/javascript"> jQuery( document ).ready( function( $ ) { $( '.ee-loop' ).each( function() { var $scope_id = '<?php echo $this->parent->get_id(); ?>', $scope = $( '[data-id="' + $scope_id + '"]' ); // Don't move forward if this is not our widget if ( $(this).closest( $scope ).length < 1 ) { return; } var $loop = $(this), $filters = $loop.siblings('.ee-filters'), $triggers = $filters.find( '[data-filter]' ), _layout = '<?php echo $this->get_instance_value( 'layout' ); ?>', isotopeArgs = { itemSelector : '.ee-loop__item', layoutMode : _layout, percentPosition : true, hiddenStyle : { opacity : 0, }, masonry : { columnWidth : '.ee-grid__item--sizer', }, }, filteryArgs = { wrapper : $loop, filterables : '.ee-loop__item', activeFilterClass : 'ee--active', }; $loop.imagesLoaded( function() { if ( _layout !== 'default' ) { var $isotope = $loop.isotope( isotopeArgs ); var isotopeInstance = $loop.data( 'isotope' ); $loop.find('.ee-grid__item:last-child')._resize( function() { $loop.isotope( 'layout' ); }); if ( $triggers.length ) { // Filter by default var $default_trigger = $triggers.filter('.ee--active'); if ( $default_trigger.length ) { default_filter = $default_trigger.data('filter'); $loop.isotope({ filter: default_filter }); } // Filter by click $triggers.on( 'click', function() { var _filter = $(this).data('filter'); $loop.isotope({ filter: _filter }); $triggers.removeClass('ee--active'); $(this).addClass('ee--active'); }); } } else { if ( $triggers.length ) { $filters.filtery( filteryArgs ); } } }); } ); } ); </script><?php } } posts/widgets/posts-base.php 0000644 00000027100 15112147616 0012157 0 ustar 00 <?php namespace ElementorExtras\Modules\Posts\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\Posts\Module; // Elementor Classes use Elementor\Controls_Manager; // Elementor Pro Classes use ElementorPro\Modules\QueryControl\Controls\Group_Control_Related; use ElementorPro\Modules\QueryControl\Module as Module_Query; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Posts * * @since 1.6.0 */ abstract class Posts_Base extends Extras_Widget { /** * Query * * @since 2.2.0 * @var \WP_Query */ protected $_query = null; /** * Get Query * * @since 2.2.0 * @return object|\WP_Query */ public function get_query() { return $this->_query; } /** * Register Query Content Controls * * @since 2.2.0 * @return void */ protected function register_query_content_controls( $condition = [] ) { $this->start_controls_section( 'section_query', [ 'label' => __( 'Query', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, 'condition' => $condition, ] ); $this->add_group_control( Group_Control_Related::get_type(), [ 'name' => 'posts', 'presets' => [ 'full' ], 'exclude' => [ 'posts_per_page', //use the one from Layout section 'ignore_sticky_posts' ], ] ); $this->end_controls_section(); $this->start_injection( [ 'at' => 'after', 'of' => 'posts_select_date', ] ); $this->update_control( 'posts_orderby', [ 'options' => [ 'post_date' => __( 'Date', 'elementor-extras' ), 'post_title' => __( 'Title', 'elementor-extras' ), 'menu_order' => __( 'Menu Order', 'elementor-extras' ), 'rand' => __( 'Random', 'elementor-extras' ), 'meta_value' => __( 'Meta Value (text)', 'elementor-extras' ), 'meta_value_num' => __( 'Meta Value (number)', 'elementor-extras' ) ], ] ); $this->end_injection(); $this->start_injection( [ 'at' => 'after', 'of' => 'posts_orderby', ] ); $this->add_control( 'posts_orderby_meta_key', [ 'label' => __( 'Meta Key', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'condition' => [ 'posts_orderby' => [ 'meta_value', 'meta_value_num' ], ], ] ); $this->end_injection(); $this->start_injection( [ 'at' => 'after', 'of' => 'posts_order', ] ); $this->add_control( 'sticky_posts', [ 'label' => __( 'Sticky Posts', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'separator' => 'before', 'return_value' => 'yes', ] ); $this->add_control( 'sticky_posts_info', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Preview of sticky posts option is only available on frontend.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', 'condition' => [ 'sticky_posts!' => '', 'sticky_only' => '', ], ] ); $this->add_control( 'sticky_only', [ 'label' => __( 'Show Only Sticky Posts', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'condition' => [ 'sticky_posts!' => '', 'posts_post_type!' => 'by_id', ], 'return_value' => 'yes', ] ); $this->end_injection(); } /** * Query Posts * * @since 2.2.0 * @return void */ public function query_posts() { $query_args = [ 'ignore_sticky_posts' => 1, 'posts_per_page' => $this->get_posts_per_page(), 'paged' => $this->get_current_page(), ]; if ( $this->get_settings( 'posts_orderby_meta_key' ) ) { $query_args['meta_key'] = $this->get_settings( 'posts_orderby_meta_key' ); } if ( 'yes' === $this->get_settings('sticky_posts') ) { $sticky_posts = get_option('sticky_posts'); $post__in = ! empty( $query_args['post__in'] ) ? $query_args['post__in'] : []; if ( 'yes' === $this->get_settings('sticky_only') ) { if ( empty( $sticky_posts ) ) { $sticky_posts = [0]; } $query_args['post__in'] = array_merge( $post__in, $sticky_posts ); } else { $query_args['ignore_sticky_posts'] = 0; } } $this->set_query( $query_args ); } /** * Retrieve posts per page setting * * @since 2.2.16 * @return int */ public function get_posts_per_page() { $posts_per_page = $this->get_settings('posts_per_page'); if ( 'current_query' === $this->get_settings('posts_post_type') || ! $posts_per_page ) { $posts_per_page = (int)get_option( 'posts_per_page' ); } else if ( 0 >= $posts_per_page ) { $posts_per_page = -1; } return $posts_per_page; } /** * Checks for the Query ID and inits the WP_Query object * * @since 2.2.0 * @param Array $query_args * @return void */ public function set_query( $query_args ) { if ( ! is_elementor_pro_active() ) { return; } if ( '' === $query_args['posts_per_page'] ) { // Handle empty posts per page setting $query_args['posts_per_page'] = (int)get_option( 'posts_per_page' ); } $elementor_query = Module_Query::instance(); add_filter( 'elementor/query/get_query_args/current_query', [ $this, 'fix_default_query_args' ] ); $this->_query = $elementor_query->get_query( $this, 'posts', $query_args, [] ); /** * Query Filter * * Filters the current query * * @since 2.1.3 * @param WP_Query $query The initial query */ $this->_query = apply_filters( 'elementor_extras/widgets/posts/query', $this->_query ); remove_filter( 'elementor/query/get_query_args/current_query', [ $this, 'fix_default_query_args' ] ); } /** * Filter to override posts per page on current query setting * * @since 2.2.0 * @param Array $global_args */ public function fix_default_query_args( $global_args ) { // When using current_query some default categories are set with a new WP_Query // which restrict results in archive pages if ( 'current_query' === $this->get_settings( 'posts_post_type' ) ) { if ( ! is_category() ) { $global_args['cat'] = false; $global_args['category_name'] = ''; } } return $global_args; } /** * Get Formatted Date * * Format a date based on format settings * * @since 2.2.0 * @param string $custom Wether the format is custom or not * @param string $date_format The date format * @param string $time_format The time format * * @return string */ public function get_date_formatted( $custom = false, $custom_format, $date_format, $time_format, $post_id = null ) { if ( $custom ) { $format = $custom_format; } else { $date_format = $date_format; $time_format = $time_format; $format = ''; if ( 'default' === $date_format ) { $date_format = get_option( 'date_format' ); } if ( 'default' === $time_format ) { $time_format = get_option( 'time_format' ); } if ( $date_format ) { $format = $date_format; $has_date = true; } else { $has_date = false; } if ( $time_format ) { if ( $has_date ) { $format .= ' '; } $format .= $time_format; } } $value = get_the_date( $format, $post_id ); return wp_kses_post( $value ); } /** * Filter pagination link for page number * * @since 2.2.38 * @return string */ public function filter_page_link( $link, $page ) { return add_query_arg( 'posts', $this->get_id(), $link ); } /** * Fetch wp link for page number * Based on https://developer.wordpress.org/reference/functions/_wp_link_page/ * * @since 2.2.38 * @return string */ private function wp_link_page( $page ) { global $wp_rewrite; $post = get_post(); $query_args = []; if ( $page == 1 ) { $url = get_permalink(); } else { if ( '' === get_option( 'permalink_structure' ) || in_array( $post->post_status, [ 'draft', 'pending' ] ) ) { $url = add_query_arg( 'page', $page, get_permalink() ); } elseif ( get_option( 'show_on_front' ) === 'page' && (int) get_option( 'page_on_front' ) === $post->ID ) { $url = trailingslashit( get_permalink() ) . user_trailingslashit( "$wp_rewrite->pagination_base/" . $page, 'single_paged' ); } else { $url = trailingslashit( get_permalink() ) . user_trailingslashit( $page, 'single_paged' ); } } if ( is_preview() ) { if ( ( 'draft' !== $post->post_status ) && isset( $_GET['preview_id'], $_GET['preview_nonce'] ) ) { $query_args['preview_id'] = wp_unslash( $_GET['preview_id'] ); $query_args['preview_nonce'] = wp_unslash( $_GET['preview_nonce'] ); } $url = get_preview_post_link( $post, $query_args, $url ); } return $url; } /** * Get Pagination Link * * Fetch link for page number * Based on https://developer.wordpress.org/reference/functions/_wp_link_page/ * * @since 2.2.38 * @return string */ private function get_pagination_link( $page ) { $link = Module::is_custom_pagination() ? $this->wp_link_page( $page ) : get_pagenum_link( $page ); /** * Pagination Link Filter * * Filters the pagination link of the specified page * * @since 2.2.38 * @param string $link The initial link * @param object|WP_Post $page The page number */ return apply_filters( 'elementor_extras/widgets/posts/pagination_link', $link, $page ); } /** * Render pagination link by page number * * @since 2.2.38 * @return void */ public function render_pagination_link( $label, $direction = NULL, $limit = NULL ) { $page = $this->get_current_page(); if ( is_null( $limit ) ) { $limit = $this->get_query()->max_num_pages; } if ( 'next' === $direction ) { $page = intval( $page ) + 1; if ( $page > $limit ) { return; } } else if ( 'previous' === $direction ) { $page = intval( $page ) - 1; if ( $page < 1 ) { return; } } else { if ( $page < 1 || $page > $limit ) { return; } $label = $page; } $nav_link_key = $this->_get_repeater_setting_key( 'pagination', $direction, $page ); $this->add_render_attribute( $nav_link_key, [ 'class' => [ 'ee-pagination__' . $direction, 'page-numbers', ], 'href' => $this->get_pagination_link( $page ), ] ); ?><a <?php echo $this->get_render_attribute_string( $nav_link_key ); ?>><?php echo $label; ?></a><?php } /** * Get Pagination Query Var * * @since 2.2.39 * @return string */ protected function get_pagination_query_var() { if ( is_front_page() && ! is_home() ) { // Page et as homepage uses paged in query // string and page as query var return 'page'; } else if ( Module::is_custom_pagination() ) { // Use our own query var return 'ee-page'; } // Default return 'paged'; } /** * Get Current Page * * @since 1.6.0 * @return array */ public function get_current_page() { $pagination = '' !== $this->get_skin_setting( 'pagination' ); $multiple = '' !== $this->get_skin_setting( 'pagination_multiple' ); $infinite = '' !== $this->get_skin_setting( 'infinite_scroll' ); $posts = isset( $_GET['posts'] ) ? $_GET['posts'] : false; $query_var = $this->get_pagination_query_var(); if ( ! $infinite && ! $pagination ) { return 1; } $page = get_query_var( $query_var ); if ( ! $page || $page < 2 ) { return 1; } if ( $posts && $this->get_id() !== $posts ) { return 1; } else { if ( $multiple && ! $posts ) { return 1; } } return $page; } /** * get_repeater_setting_key wrapper * * @since 2.1.2 * @return string */ public function _get_repeater_setting_key( $setting_key, $repeater_key, $repeater_item_index ) { return $this->get_repeater_setting_key( $setting_key, $repeater_key, $repeater_item_index ); } } posts/widgets/posts.php 0000644 00000410420 15112147616 0011250 0 ustar 00 <?php namespace ElementorExtras\Modules\Posts\Widgets; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Group_Control_Button_Effect; use ElementorExtras\Group_Control_Transition; use ElementorExtras\Modules\Posts\Skins; use ElementorExtras\Modules\Posts\Module; use ElementorExtras\Modules\Posts\Widgets\Posts_Base; // Elementor Classes use Elementor\Repeater; use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Background; use Elementor\Group_Control_Css_Filter; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; // Elementor Pro Classes use ElementorPro\Modules\QueryControl\Controls\Group_Control_Related; use ElementorPro\Modules\QueryControl\Module as Query_Module; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Posts * * @since 1.6.0 */ class Posts extends Posts_Base { /** * Filters * * @since 1.6.0 * @var array */ private $_filters = []; /** * Has template content * * @since 1.6.0 * @var bool */ protected $_has_template_content = false; /** * Get Name * * Get the name of the widget * * @since 1.6.0 * @return string */ public function get_name() { return 'posts-extra'; } /** * Get Title * * Get the title of the widget * * @since 1.6.0 * @return string */ public function get_title() { return __( 'Posts Extra', 'elementor-extras' ); } /** * Get Icon * * Get the name of the widget * * @since 1.6.0 * @return string */ public function get_icon() { return 'nicon nicon-posts'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 1.6.0 * @return array */ public function get_script_depends() { return [ 'jquery-resize-ee', 'infinite-scroll-ee', 'isotope', 'filtery', ]; } public function get_keywords() { return [ 'posts', 'cpt', 'loop', 'query', 'cards', 'custom post type', 'carousel' ]; } /** * Requires elementor pro * * Sets the widget requirements for Elementor Pro * * @since 1.6.0 * @return bool */ public static function requires_elementor_pro() { return true; } /** * Register Skins * * @since 1.6.0 * @return void */ protected function register_skins() { $this->add_skin( new Skins\Skin_Classic( $this ) ); $this->add_skin( new Skins\Skin_Carousel( $this ) ); } /** * Set filters * * Set the filter terms * * @since 1.6.0 * @param taxonomy The taxonomy for the terms * @return void */ public function set_filters( $taxonomy = null ) { if ( ! $taxonomy ) return; if ( 'yes' === $this->get_skin_setting( 'filters_show_all' ) && 'yes' === $this->get_skin_setting( 'infinite_scroll' ) ) { $this->set_all_filters( $taxonomy ); } else { $this->set_query_filters( $taxonomy ); } } /** * Set all Filters * * Set filters to all available for this taxonomy * * @since 1.6.0 * @param taxonomy The taxonomy for the terms * @return void */ public function set_all_filters( $taxonomy ) { $terms = get_terms( array( 'taxonomy' => $taxonomy, 'exclude' => $this->get_skin_setting( 'filters_taxonomy_exclude_' . str_replace( '-', '_', $taxonomy ) ), 'orderby' => $this->get_skin_setting( 'filters_orderby' ), 'order' => $this->get_skin_setting( 'filters_order' ), ) ); // Set filters for filter menu foreach ($terms as $term) { $this->_filters[ $term->term_id ] = $term; } $this->set_posts_filters( $taxonomy ); } /** * Set Query Filters * * Set filters to those corresponding to queries posts * * @since 1.6.0 * @param taxonomy The taxonomy for the terms * @return void */ public function set_query_filters( $taxonomy ) { $taxonomy_terms = get_terms([ 'taxonomy' => $taxonomy, 'exclude' => $this->get_skin_setting( 'filters_taxonomy_exclude_' . str_replace( '-', '_', $taxonomy ) ), 'orderby' => $this->get_skin_setting( 'filters_orderby' ), 'order' => $this->get_skin_setting( 'filters_order' ), ]); $posts_filters = array(); // Populate our filters with all terms foreach ( $taxonomy_terms as $key => $term ) { $this->_filters[ $term->term_id ] = $term; } // Create an array of query filters foreach ( $this->_query->posts as $post ) { $terms = wp_get_post_terms( $post->ID, $taxonomy ); foreach ($terms as $term) { if ( ! array_key_exists( $term->term_id, $posts_filters ) ) { $posts_filters[ $term->term_id ] = $term; } } } // Filter the terms to include only our filters foreach ( $this->_filters as $key => $_filter ) { if ( ! array_key_exists( $key, $posts_filters ) ) { unset( $this->_filters[ $key ] ); } } $this->set_posts_filters( $taxonomy ); } /** * Set Posts Filters * * Get terms from posts * * @since 1.6.0 * @param taxonomy The taxonomy for the terms * @return void */ public function set_posts_filters( $taxonomy ) { // Set filters for each post foreach ( $this->_query->posts as $post ) { $filters = []; // Get post terms $post_terms = wp_get_post_terms( $post->ID, $taxonomy, array( 'orderby' => $this->get_skin_setting( 'filters_orderby' ), 'order' => $this->get_skin_setting( 'filters_order' ), ) ); // Populate array with post terms foreach ( $post_terms as $post_term ) { $filters[ $post_term->term_id ] = $post_term; } // Set pot filters $post->filters = $filters; } } /** * Get Filters * * @since 1.6.0 * @return _filters|array */ public function get_filters() { return $this->_filters; } /** * Get Terms * * @since 1.6.0 * @return array */ public function get_terms() { $settings = $this->get_settings(); $taxonomies = $settings['post_terms_taxonomy']; $_terms = Utils::get_terms( $taxonomies ); return $_terms; } /** * Register Widget Controls * * @since 1.6.0 * @return void */ protected function _register_controls() { $this->register_layout_content_controls(); $this->register_query_content_controls(); $this->register_media_content_controls(); $this->register_terms_content_controls(); $this->register_title_content_controls(); $this->register_metas_content_controls(); $this->register_excerpt_content_controls(); $this->register_button_content_controls(); $this->register_order_content_controls(); $this->register_post_style_controls(); $this->register_header_style_controls(); $this->register_media_style_controls(); $this->register_body_style_controls(); $this->register_footer_style_controls(); $this->register_terms_style_controls(); $this->register_metas_style_controls(); $this->register_title_style_controls(); $this->register_excerpt_style_controls(); $this->register_button_style_controls(); $this->register_hover_animation_controls(); $this->register_advanced_controls(); } /** * Register Layout Content Controls * * @since 1.6.0 * @return void */ protected function register_layout_content_controls() { $this->start_controls_section( 'section_layout', [ 'label' => __( 'Layout', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'skin_source', [ 'label' => __( 'Post Skin', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Default', 'elementor-extras' ), 'template' => __( 'Template', 'elementor-extras' ), ], ] ); $this->add_control( 'skin_template', [ 'label' => __( 'Post Template', 'elementor-extras' ), 'placeholder' => __( 'Search...', 'elementor-extras' ), 'type' => 'ee-query', 'query_type' => 'templates', 'label_block' => false, 'multiple' => false, 'condition' => [ 'skin_source' => 'template', ], ] ); $this->add_responsive_control( 'columns', [ 'label' => __( 'Columns', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '3', 'tablet_default' => '2', 'mobile_default' => '1', 'options' => [ '' => __( 'Default', 'elementor-extras' ), '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', ], 'prefix_class' => 'ee-grid-columns%s-', 'frontend_available' => true, 'condition' => [ '_skin!' => 'carousel', ], ] ); $this->add_control( 'posts_per_page', [ 'label' => __( 'Posts Per Page', 'elementor-extras' ), 'title' => __( 'Important: This won\'t have any effect on archive pages and will be replaced by the default Wordpress setting.', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 6, 'condition' => [ 'posts_post_type!' => 'current_query', ], ] ); $this->end_controls_section(); } /** * Register Order Content Controls * * @since 1.6.0 * @return void */ protected function register_order_content_controls() { $this->start_controls_section( 'section_order', [ 'label' => __( 'Order', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, 'condition' => [ 'skin_source' => '', ], ] ); $this->add_control( 'post_areas_order_heading', [ 'label' => __( 'Areas', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'order_areas_description', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Give each area an order number to define the order in which they appear in the post.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', ] ); $this->add_responsive_control( 'post_header_order', [ 'label' => __( 'Header', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'selectors' => [ '{{WRAPPER}} .ee-post__header' => 'order: {{VALUE}};', ], ] ); $this->add_responsive_control( 'post_media_order', [ 'label' => __( 'Media', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'selectors' => [ '{{WRAPPER}} .ee-post__media' => 'order: {{VALUE}};', ], ] ); $this->add_responsive_control( 'post_body_order', [ 'label' => __( 'Body', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'selectors' => [ '{{WRAPPER}} .ee-post__body, {{WRAPPER}} .ee-post--horizontal .ee-post__content' => 'order: {{VALUE}};', ], ] ); $this->add_responsive_control( 'post_footer_order', [ 'label' => __( 'Footer', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'selectors' => [ '{{WRAPPER}} .ee-post__footer' => 'order: {{VALUE}};', ], ] ); $this->add_control( 'post_parts_order_heading', [ 'label' => __( 'Parts', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'order_parts_description', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Give each post part an order number to define the order in which they appear in post areas.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', ] ); $this->add_control( 'post_terms_order', [ 'label' => __( 'Terms', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'condition' => [ 'post_terms_position!' => '', ], ] ); $this->add_control( 'post_title_order', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'condition' => [ 'post_title_position!' => '', ], ] ); $this->add_control( 'post_excerpt_order', [ 'label' => __( 'Excerpt', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'condition' => [ 'post_excerpt_position!' => '', ], ] ); $this->add_control( 'post_button_order', [ 'label' => __( 'Button', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'condition' => [ 'post_button_position!' => '', ], ] ); $this->add_control( 'post_metas_order', [ 'label' => __( 'Metas', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, ] ); $this->add_control( 'post_metas_order_heading', [ 'label' => __( 'Metas', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'post_metas_order_description', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Order each meta inside any list of metas', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', ] ); $this->add_control( 'post_author_order', [ 'label' => __( 'Author', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'condition' => [ 'post_author_position!' => '', ], ] ); $this->add_control( 'post_date_order', [ 'label' => __( 'Date', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'condition' => [ 'post_date_position!' => '', ], ] ); if ( is_woocommerce_active() ) { $this->add_control( 'post_price_order', [ 'label' => __( 'Price', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'condition' => [ 'post_price_position!' => '', 'posts_post_type' => ['product', 'current_query'], ], ] ); } $this->add_control( 'post_comments_order', [ 'label' => __( 'Comments', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'condition' => [ 'post_comments_position!' => '', ], ] ); $this->end_controls_section(); } /** * Register Advanced Controls * * @since 1.6.0 * @return void */ protected function register_advanced_controls() { $this->start_controls_section( 'section_advanced', [ 'label' => __( 'Advanced', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'nothing_found_type', [ 'label' => __( 'Show', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Text', 'elementor-extras' ), 'template' => __( 'Template', 'elementor-extras' ), ], ] ); $this->add_control( 'nothing_found_message', [ 'label' => __( 'Nothing Found Message', 'elementor-extras' ), 'type' => Controls_Manager::TEXTAREA, 'default' => __( 'It seems we can\'t find what you\'re looking for.', 'elementor-extras' ), 'dynamic' => [ 'active' => true, ], 'condition' => [ 'nothing_found_type' => '', ], ] ); $this->add_control( 'nothing_found_template', [ 'label' => __( 'Template', 'elementor-extras' ), 'placeholder' => __( 'Search...', 'elementor-extras' ), 'type' => 'ee-query', 'query_type' => 'templates', 'label_block' => false, 'multiple' => false, 'condition' => [ 'nothing_found_type' => 'template', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_advanced', [ 'tab' => Controls_Manager::TAB_STYLE, 'label' => __( 'Advanced', 'elementor-extras' ), 'condition' => [ 'nothing_found_message!' => '', ], ] ); $this->add_control( 'nothing_found_style_heading', [ 'label' => __( 'Nothing Found Message', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'nothing_found_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_TEXT, ], 'selectors' => [ '{{WRAPPER}} .ee-posts__nothing-found' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'nothing_found_typography', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-posts__nothing-found', ] ); $this->end_controls_section(); } /** * Register Media Content Controls * * @since 1.6.0 * @return void */ protected function register_media_content_controls() { $this->start_controls_section( 'section_media', [ 'label' => __( 'Media', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, 'condition' => [ 'skin_source' => '', ], ] ); $this->add_control( 'post_media', [ 'label' => __( 'Show', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', ] ); $this->add_control( 'image', [ 'label' => __( 'Placeholder Image', 'elementor-extras' ), 'description' => __( 'An image to be used for all posts that DO NOT have a featured image set.', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true, ], 'default' => [ 'url' => '', ], 'condition' => [ 'post_media!' => '', ], ] ); $this->add_control( 'post_media_link', [ 'label' => __( 'Enable Link', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', 'condition' => [ 'post_media!' => '', ], ] ); $this->add_control( 'post_media_blank', [ 'label' => __( 'Open in New Tab', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'condition' => [ 'post_media!' => '', 'post_media_link!' => '', ], ] ); $this->add_control( 'post_media_custom_height', [ 'label' => __( 'Custom Height', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'ratio', 'prefix_class' => 'ee-posts-thumbnail-', 'condition' => [ 'post_media!' => '', ], ] ); $this->add_control( 'post_media_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], '' => [ 'title' => __( 'Block', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'label_block' => false, 'condition' => [ 'post_media!' => '', ], ] ); $this->add_control( 'post_media_collapse', [ 'label' => __( 'Collapse on', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'mobile', 'options' => [ 'none' => __( 'None', 'elementor-extras' ), 'tablet' => __( 'Tablet', 'elementor-extras' ), 'mobile' => __( 'Mobile', 'elementor-extras' ), ], 'prefix_class' => 'ee-posts-layout-collapse--', 'condition' => [ 'post_media!' => '', 'post_media_position!' => '', ], ] ); $this->add_responsive_control( 'post_media_align', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'stretch', 'options' => [ 'flex-start' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'center' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'flex-end' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], ], 'label_block' => false, 'condition' => [ 'post_media!' => '', 'post_media_position' => [ 'left', 'right' ], 'post_media_custom_height' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-post--horizontal' => 'align-items: {{VALUE}};', ], ] ); $this->add_control( 'post_media_align_flex', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'stretch', 'options' => [ 'flex-start' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'center' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'flex-end' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], 'stretch' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-v-align-stretch', ], ], 'label_block' => false, 'condition' => [ 'post_media!' => '', 'post_media_position' => [ 'left', 'right' ], 'post_media_custom_height!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-post--horizontal' => 'align-items: {{VALUE}};', ], ] ); $this->add_responsive_control( 'post_media_width', [ 'label' => __( 'Width (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 20, 'max' => 80, ], ], 'default' => [ 'size' => 30, 'unit' => 'px', ], 'selectors' => [ '{{WRAPPER}} .ee-post--horizontal .ee-post__media' => 'flex-basis: {{SIZE}}%; -ms-flex-preferred-size: {{SIZE}}%;', '{{WRAPPER}} .ee-post--horizontal .ee-post__content' => 'flex-basis: calc( 100% - {{SIZE}}% );', ], 'condition' => [ 'post_media!' => '', 'post_media_position!' => '', ], ] ); $this->add_responsive_control( 'post_media_height', [ 'label' => __( 'Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 200, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__media:before' => 'padding-bottom: {{SIZE}}%', ], 'condition' => [ 'post_media!' => '', 'post_media_custom_height!' => '', ], ] ); $this->add_control( 'post_media_thumbnail_heading', [ 'label' => __( 'Thumbnail', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'post_media!' => '', ], ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'post_media_thumbnail_size', 'label' => __( 'Thumbnail Size', 'elementor-extras' ), 'default' => 'large', 'exclude' => [ 'custom' ], 'condition' => [ 'post_media!' => '', ], ] ); $this->end_controls_section(); } /** * Register Terms Content Controls * * @since 1.6.0 * @return void */ protected function register_terms_content_controls() { $this->start_controls_section( 'section_terms', [ 'label' => __( 'Terms', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, 'condition' => [ 'skin_source' => '', ], ] ); $this->add_control( 'post_terms_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'header', 'label_block' => false, 'options' => [ 'header' => [ 'title' => __( 'Header', 'elementor-extras' ), 'icon' => 'nicon nicon-position-header', ], 'media' => [ 'title' => __( 'Media', 'elementor-extras' ), 'icon' => 'nicon nicon-position-media', ], 'body' => [ 'title' => __( 'Body', 'elementor-extras' ), 'icon' => 'nicon nicon-position-body', ], 'footer' => [ 'title' => __( 'Footer', 'elementor-extras' ), 'icon' => 'nicon nicon-position-footer', ], '' => [ 'title' => __( 'Hide', 'elementor-extras' ), 'icon' => 'eicon eicon-close', ], ], ] ); $this->add_control( 'post_terms_link', [ 'label' => __( 'Link to term', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', 'condition' => [ 'post_terms_position!' => '', ], ] ); $this->add_control( 'post_terms_taxonomy', [ 'label' => __( 'Taxonomies', 'elementor-extras' ), 'type' => Controls_Manager::SELECT2, 'label_block' => true, 'default' => 'category', 'multiple' => true, 'options' => Utils::get_taxonomies_options(), 'condition' => [ 'post_terms_position!' => '', ], ] ); $this->add_control( 'post_terms_count', [ 'label' => __( 'Count', 'elementor-extras' ), 'description' => __( 'How many terms to show (enter -1 to show all terms)', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'condition' => [ 'post_terms_position!' => '', ], ] ); $this->add_control( 'post_terms_prefix', [ 'label' => __( 'Prefix', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'placeholder' => __( 'Posted in', 'elementor-extras' ), 'condition' => [ 'post_terms_position!' => '' ], ] ); $this->add_control( 'post_terms_separator', [ 'label' => __( 'Separator', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '·', 'condition' => [ 'post_terms_position!' => '' ], ] ); $this->end_controls_section(); } /** * Register Title Content Controls * * @since 1.6.0 * @return void */ protected function register_title_content_controls() { $this->start_controls_section( 'section_title', [ 'label' => __( 'Title', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, 'condition' => [ 'skin_source' => '', ], ] ); $this->add_control( 'post_title_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'body', 'label_block' => false, 'options' => [ 'header' => [ 'title' => __( 'Header', 'elementor-extras' ), 'icon' => 'nicon nicon-position-header', ], 'media' => [ 'title' => __( 'Media', 'elementor-extras' ), 'icon' => 'nicon nicon-position-media', ], 'body' => [ 'title' => __( 'Body', 'elementor-extras' ), 'icon' => 'nicon nicon-position-body', ], '' => [ 'title' => __( 'Hide', 'elementor-extras' ), 'icon' => 'eicon eicon-close', ], ], ] ); $this->add_control( 'post_title_link', [ 'label' => __( 'Link to post', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', 'condition' => [ 'post_title_position!' => '', ], ] ); $this->add_control( 'post_title_link_blank', [ 'label' => __( 'Open in New Tab', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'condition' => [ 'post_title_position!' => '', 'post_title_link!' => '', ], ] ); $this->add_control( 'post_title_element', [ 'label' => __( 'HTML Element', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => __( 'H1', 'elementor-extras' ), 'h2' => __( 'H2', 'elementor-extras' ), 'h3' => __( 'H3', 'elementor-extras' ), 'h4' => __( 'H4', 'elementor-extras' ), 'h5' => __( 'H5', 'elementor-extras' ), 'h6' => __( 'H6', 'elementor-extras' ), 'div' => __( 'div', 'elementor-extras' ), 'span' => __( 'span', 'elementor-extras' ), ], 'default' => 'h2', ] ); $this->end_controls_section(); } /** * Register Excerpt Content Controls * * @since 1.6.0 * @return void */ protected function register_excerpt_content_controls() { $this->start_controls_section( 'section_excerpt', [ 'label' => __( 'Excerpt', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, 'condition' => [ 'skin_source' => '', ], ] ); $this->add_control( 'post_excerpt_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'body', 'label_block' => false, 'options' => [ 'media' => [ 'title' => __( 'Media', 'elementor-extras' ), 'icon' => 'nicon nicon-position-media', ], 'body' => [ 'title' => __( 'Body', 'elementor-extras' ), 'icon' => 'nicon nicon-position-body', ], 'footer' => [ 'title' => __( 'Footer', 'elementor-extras' ), 'icon' => 'nicon nicon-position-footer', ], '' => [ 'title' => __( 'Hide', 'elementor-extras' ), 'icon' => 'eicon eicon-close', ], ], ] ); $this->add_control( 'post_excerpt_trim_custom', [ 'label' => __( 'Trim Custom Excerpts', 'elementor-extras' ), 'description' => __( 'Custom excerpts are set manually in the Excerpt field for each post. Enable this if you want to trim those down to the above length as well.' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'condition' => [ 'post_excerpt_position!' => '', ], ] ); $this->add_control( 'post_excerpt_length', [ 'label' => __( 'Excerpt Length', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => apply_filters( 'excerpt_length', 25 ), 'condition' => [ 'post_excerpt_position!' => '', ], ] ); $this->add_control( 'post_excerpt_more', [ 'label' => __( 'Trimmed Suffix', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '…', 'condition' => [ 'post_excerpt_position!' => '', ], ] ); $this->end_controls_section(); } /** * Register Button Content Controls * * @since 1.6.0 * @return void */ protected function register_button_content_controls() { $this->start_controls_section( 'section_button', [ 'label' => __( 'Button', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, 'condition' => [ 'skin_source' => '', ], ] ); $this->add_control( 'post_button_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'label_block' => false, 'options' => [ 'media' => [ 'title' => __( 'Media', 'elementor-extras' ), 'icon' => 'nicon nicon-position-media', ], 'body' => [ 'title' => __( 'Body', 'elementor-extras' ), 'icon' => 'nicon nicon-position-body', ], 'footer' => [ 'title' => __( 'Footer', 'elementor-extras' ), 'icon' => 'nicon nicon-position-footer', ], '' => [ 'title' => __( 'Hide', 'elementor-extras' ), 'icon' => 'eicon eicon-close', ], ], ] ); if ( is_woocommerce_active() ) { $this->add_control( 'post_add_to_cart_media_warning', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Add to Cart button is not supported in Media area when when Media area link is enabled.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'condition' => [ 'post_media_link!' => '', 'posts_post_type' => 'product', 'post_button_position' => 'media', ], ] ); $this->add_control( 'post_button_type', [ 'label' => __( 'Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'add_to_cart', 'options' => [ '' => __( 'Read More', 'elementor-extras' ), 'add_to_cart' => __( 'Add to Cart', 'elementor-extras' ), ], 'condition' => [ 'post_button_position!' => '', 'posts_post_type' => 'product', ], ] ); $this->add_control( 'post_button_add_to_cart_text', [ 'label' => __( 'Add To Cart Label', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'condition' => [ 'post_button_position!' => '', 'post_button_type' => 'add_to_cart', 'posts_post_type' => 'product', ], ] ); } $this->add_control( 'post_read_more_text', [ 'label' => __( 'Read More Label', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Read more', 'elementor-extras' ), 'condition' => [ 'post_button_position!' => '', ], ] ); $this->add_control( 'post_button_blank', [ 'label' => __( 'Open in New Tab', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'condition' => [ 'post_button_position!' => '', ], ] ); $this->end_controls_section(); } /** * Register Metas Content Controls * * @since 1.6.0 * @return void */ protected function register_metas_content_controls() { $this->start_controls_section( 'section_metas', [ 'label' => __( 'Metas', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, 'condition' => [ 'skin_source' => '', ], ] ); $post_metas_options = [ 'avatar' => __( 'Avatar', 'elementor-extras' ), 'author' => __( 'Author', 'elementor-extras' ), 'date' => __( 'Date', 'elementor-extras' ), 'comments' => __( 'Comments', 'elementor-extras' ), // 'custom_fields' => __( 'Custom Fields', 'elementor-extras' ), ]; $post_metas_defaults = [ 'avatar', 'author', 'date', 'comments', // 'custom_fields', ]; if ( is_woocommerce_active() ) { $post_metas_options['price'] = __( 'Price', 'elementor-extras' ); $post_metas_defaults[] = 'price'; } $this->add_control( 'post_metas_separator', [ 'label' => __( 'Separator', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '·', ] ); $this->add_control( 'post_metas', [ 'label' => __( 'Metas', 'elementor-extras' ), 'type' => Controls_Manager::SELECT2, 'multiple' => true, 'label_block' => true, 'default' => $post_metas_defaults, 'options' => $post_metas_options, ] ); $this->register_author_content_controls(); $this->register_date_content_controls(); $this->register_comments_content_controls(); if ( is_woocommerce_active() ) { $this->register_price_content_controls(); } $this->end_controls_section(); } /** * Register Author Content Controls * * @since 1.6.0 * @return void */ protected function register_author_content_controls() { $this->add_control( 'post_avatar_heading', [ 'label' => __( 'Avatar', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'post_metas' => 'avatar', ], ] ); $this->add_control( 'post_avatar_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'footer', 'label_block' => false, 'options' => [ 'header' => [ 'title' => __( 'Header', 'elementor-extras' ), 'icon' => 'nicon nicon-position-header', ], 'media' => [ 'title' => __( 'Media', 'elementor-extras' ), 'icon' => 'nicon nicon-position-media', ], 'body' => [ 'title' => __( 'Body', 'elementor-extras' ), 'icon' => 'nicon nicon-position-body', ], 'footer' => [ 'title' => __( 'Footer', 'elementor-extras' ), 'icon' => 'nicon nicon-position-footer', ], '' => [ 'title' => __( 'Hide', 'elementor-extras' ), 'icon' => 'eicon eicon-close', ], ], 'condition' => [ 'post_metas' => 'avatar', ], ] ); $this->add_control( 'post_avatar_link', [ 'label' => __( 'Link to Author', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'condition' => [ 'post_metas' => 'avatar', 'post_avatar_position!' => [ '', 'media' ], ], ] ); $this->add_control( 'post_author_heading', [ 'label' => __( 'Author', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'post_metas' => 'author', ], ] ); $this->add_control( 'post_author_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'footer', 'label_block' => false, 'options' => [ 'header' => [ 'title' => __( 'Header', 'elementor-extras' ), 'icon' => 'nicon nicon-position-header', ], 'media' => [ 'title' => __( 'Media', 'elementor-extras' ), 'icon' => 'nicon nicon-position-media', ], 'body' => [ 'title' => __( 'Body', 'elementor-extras' ), 'icon' => 'nicon nicon-position-body', ], 'footer' => [ 'title' => __( 'Footer', 'elementor-extras' ), 'icon' => 'nicon nicon-position-footer', ], '' => [ 'title' => __( 'Hide', 'elementor-extras' ), 'icon' => 'eicon eicon-close', ], ], 'condition' => [ 'post_metas' => 'author', ], ] ); $this->add_control( 'post_author_link', [ 'label' => __( 'Link to Author', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'condition' => [ 'post_metas' => 'author', 'post_author_position!' => [ '', 'media' ], ], ] ); $this->add_control( 'post_author_prefix', [ 'label' => __( 'Prefix', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'placeholder' => __( 'Posted by', 'elementor-extras' ), 'condition' => [ 'post_metas' => 'author', 'post_author_position!' => '' ], ] ); } /** * Register Price Content Controls * * @since 1.6.0 * @return void */ protected function register_price_content_controls() { $this->add_control( 'post_price_heading', [ 'label' => __( 'Price', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'posts_post_type' => [ 'product', 'current_query', 'related' ], 'post_metas' => 'price', ], ] ); $this->add_control( 'post_price_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'footer', 'label_block' => false, 'options' => [ 'header' => [ 'title' => __( 'Header', 'elementor-extras' ), 'icon' => 'nicon nicon-position-header', ], 'media' => [ 'title' => __( 'Media', 'elementor-extras' ), 'icon' => 'nicon nicon-position-media', ], 'body' => [ 'title' => __( 'Body', 'elementor-extras' ), 'icon' => 'nicon nicon-position-body', ], 'footer' => [ 'title' => __( 'Footer', 'elementor-extras' ), 'icon' => 'nicon nicon-position-footer', ], '' => [ 'title' => __( 'Hide', 'elementor-extras' ), 'icon' => 'eicon eicon-close', ], ], 'condition' => [ 'posts_post_type' => ['product', 'current_query'], 'post_metas' => 'price', ], ] ); } /** * Register Date Content Controls * * @since 1.6.0 * @return void */ protected function register_date_content_controls() { $this->add_control( 'post_date_heading', [ 'label' => __( 'Date', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'post_metas' => 'date', ], ] ); $this->add_control( 'post_date_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'footer', 'label_block' => false, 'options' => [ 'header' => [ 'title' => __( 'Header', 'elementor-extras' ), 'icon' => 'nicon nicon-position-header', ], 'media' => [ 'title' => __( 'Media', 'elementor-extras' ), 'icon' => 'nicon nicon-position-media', ], 'body' => [ 'title' => __( 'Body', 'elementor-extras' ), 'icon' => 'nicon nicon-position-body', ], 'footer' => [ 'title' => __( 'Footer', 'elementor-extras' ), 'icon' => 'nicon nicon-position-footer', ], '' => [ 'title' => __( 'Hide', 'elementor-extras' ), 'icon' => 'eicon eicon-close', ], ], 'condition' => [ 'post_metas' => 'date', ], ] ); $this->add_control( 'post_date_format', [ 'label' => __( 'Date Format', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), '' => __( 'None', 'elementor-extras' ), 'F j, Y' => date( 'F j, Y' ), 'Y-m-d' => date( 'Y-m-d' ), 'm/d/Y' => date( 'm/d/Y' ), 'd/m/Y' => date( 'd/m/Y' ), 'custom' => __( 'Custom', 'elementor-extras' ), ], 'condition' => [ 'post_metas' => 'date', 'post_date_position!' => '' ], 'default' => 'default', ] ); $this->add_control( 'post_time_format', [ 'label' => __( 'Time Format', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), '' => __( 'None', 'elementor-extras' ), 'g:i a' => date( 'g:i a' ), 'g:i A' => date( 'g:i A' ), 'H:i' => date( 'H:i' ), ], 'default' => 'default', 'condition' => [ 'post_metas' => 'date', 'post_date_position!' => '', 'post_date_format!' => 'custom', ], ] ); $this->add_control( 'post_date_custom_format', [ 'label' => __( 'Custom Format', 'elementor-extras' ), 'default' => get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), 'description' => sprintf( '<a href="https://codex.wordpress.org/Formatting_Date_and_Time" target="_blank">%s</a>', __( 'Documentation on date and time formatting', 'elementor-extras' ) ), 'condition' => [ 'post_metas' => 'date', 'post_date_position!' => '', 'post_date_format' => 'custom', ], ] ); $this->add_control( 'post_date_prefix', [ 'label' => __( 'Date Prefix', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'placeholder' => __( 'on', 'elementor-extras' ), 'condition' => [ 'post_metas' => 'date', 'post_date_position!' => '' ], ] ); } /** * Register Comments Content Controls * * @since 1.6.0 * @return void */ protected function register_comments_content_controls() { $this->add_control( 'post_comments_heading', [ 'label' => __( 'Comments', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'post_metas' => 'comments', ], ] ); $this->add_control( 'post_comments_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'footer', 'label_block' => false, 'options' => [ 'header' => [ 'title' => __( 'Header', 'elementor-extras' ), 'icon' => 'nicon nicon-position-header', ], 'media' => [ 'title' => __( 'Media', 'elementor-extras' ), 'icon' => 'nicon nicon-position-media', ], 'body' => [ 'title' => __( 'Body', 'elementor-extras' ), 'icon' => 'nicon nicon-position-body', ], 'footer' => [ 'title' => __( 'Footer', 'elementor-extras' ), 'icon' => 'nicon nicon-position-footer', ], '' => [ 'title' => __( 'Hide', 'elementor-extras' ), 'icon' => 'eicon eicon-close', ], ], 'condition' => [ 'post_metas' => 'comments', ], ] ); $this->add_control( 'post_comments_prefix', [ 'label' => __( 'Prefix', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'placeholder' => __( 'Comments:', 'elementor-extras' ), 'condition' => [ 'post_metas' => 'comments', 'post_comments_position!' => '', ], ] ); $this->add_control( 'post_comments_suffix', [ 'label' => __( 'Suffix', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'placeholder' => __( 'comments', 'elementor-extras' ), 'condition' => [ 'post_metas' => 'comments', 'post_comments_position!' => '', ], ] ); } /** * Register Post Style Controls * * @since 1.6.0 * @return void */ public function register_post_style_controls() { $this->start_controls_section( 'section_style_posts', [ 'label' => __( 'Posts', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'posts_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post' => 'text-align: {{VALUE}};', ] ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'posts', 'selector' => '{{WRAPPER}} .ee-post', ] ); $this->add_control( 'post_overflow', [ 'label' => __( 'Overflow', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Default', 'elementor-extras' ), 'hidden' => __( 'Hidden', 'elementor-extras' ), ], 'selectors' => [ '{{WRAPPER}} .ee-post' => 'overflow: {{VALUE}};', ], ] ); $this->add_control( 'post_border_radius', [ 'type' => Controls_Manager::DIMENSIONS, 'label' => __( 'Border Radius', 'elementor-extras' ), 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->start_controls_tabs( 'posts_tabs_hover' ); $this->start_controls_tab( 'posts_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'post_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'post_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-post', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'post_box_shadow', 'selector' => '{{WRAPPER}} .ee-post', 'separator' => '', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'posts_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'post_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'post_border_color_hover', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post:hover' => 'border-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'post_box_shadow_hover', 'selector' => '{{WRAPPER}} .ee-post:hover', 'separator' => '', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'posts_tab_sticky', [ 'label' => __( 'Sticky', 'elementor-extras' ), 'condition' => [ 'sticky_posts!' => '', ], ] ); $this->add_control( 'post_background_color_sticky', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post.sticky' => 'background-color: {{VALUE}};', ], 'condition' => [ 'sticky_posts!' => '', ], ] ); $this->add_control( 'post_border_color_sticky', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post.sticky' => 'border-color: {{VALUE}};', ], 'condition' => [ 'sticky_posts!' => '', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'post_box_shadow_sticky', 'selector' => '{{WRAPPER}} .ee-post.sticky', 'condition' => [ 'sticky_posts!' => '', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Register Header Style Controls * * @since 1.6.0 * @return void */ public function register_header_style_controls() { $this->start_controls_section( 'section_style_header', [ 'label' => __( 'Header', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'conditions' => [ 'relation' => 'and', 'terms' => [ $this->get_empty_area_condition( 'header' ), [ 'name' => 'skin_source', 'operator' => '==', 'value' => '', ], ], ], ] ); $this->add_responsive_control( 'header_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__header' => 'text-align: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'header' ), ] ); $this->add_responsive_control( 'header_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__header' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $this->get_empty_area_condition( 'header' ), ] ); $this->add_control( 'header_border_radius', [ 'type' => Controls_Manager::DIMENSIONS, 'label' => __( 'Border Radius', 'elementor-extras' ), 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__header' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $this->get_empty_area_condition( 'header' ), ] ); $this->start_controls_tabs( 'header_tabs_hover' ); $this->start_controls_tab( 'header_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'header_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__header' => 'background-color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'header' ), ] ); $this->add_control( 'header_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__header' => 'color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'header' ), ] ); $this->end_controls_tab(); $this->start_controls_tab( 'header_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'header_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post:hover .ee-post__header' => 'background-color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'header' ), ] ); $this->add_control( 'header_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post:hover .ee-post__header' => 'color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'header' ), ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'header_separator_heading', [ 'separator' => 'before', 'label' => __( 'Separator', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'post_media' => '' ] ] ); $this->add_control( 'header_separator_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__header' => 'border-color: {{VALUE}};', ], 'condition' => [ 'post_media' => '' ] ] ); $this->add_responsive_control( 'header_separator_size', [ 'label' => __( 'Separator Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 10, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__header' => 'border-bottom-width: {{SIZE}}px', ], 'condition' => [ 'post_media' => '' ] ] ); $header_metas_condition = $this->get_area_metas_controls_conditions( 'header' ); $this->add_control( 'header_metas', [ 'separator' => 'before', 'label' => __( '↳ Header Metas', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'conditions' => $header_metas_condition, ] ); $this->add_control( 'header_metas_description', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Use these to style metas that appear only in the Header area', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'conditions' => $header_metas_condition, ] ); $this->add_control( 'header_metas_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__header .ee-post__metas__list' => 'margin-left: -{{SIZE}}px', '{{WRAPPER}} .ee-post__header .ee-post__meta, {{WRAPPER}} .ee-post__header .ee-post__meta__separator' => 'margin-left: {{SIZE}}px', ], 'conditions' => $header_metas_condition, ] ); $this->add_control( 'header_metas_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__header .ee-post__metas' => 'margin-bottom: {{SIZE}}px', ], 'conditions' => $header_metas_condition, ] ); $this->add_responsive_control( 'header_metas_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__header .ee-post__metas--has-metas' => 'text-align: {{VALUE}};', ], 'conditions' => $header_metas_condition, ] ); $this->add_responsive_control( 'header_metas_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__header .ee-post__metas--has-metas' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $header_metas_condition, ] ); $this->add_control( 'header_metas_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__header .ee-post__metas--has-metas' => 'color: {{VALUE}};', ], 'conditions' => $header_metas_condition, ] ); $this->add_control( 'header_metas_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__header .ee-post__metas--has-metas' => 'background-color: {{VALUE}};', ], 'conditions' => $header_metas_condition, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'header_metas_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-post__header .ee-post__metas--has-metas .ee-post__meta', 'conditions' => $header_metas_condition, ] ); $this->end_controls_section(); } /** * Register Media Style Controls * * @since 1.6.0 * @return void */ public function register_media_style_controls() { $this->start_controls_section( 'section_style_media', [ 'label' => __( 'Media', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'post_media!' => '', 'skin_source' => '', ] ] ); $this->add_responsive_control( 'media_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__media' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'post_media!' => '' ] ] ); $this->add_control( 'media_border_radius', [ 'type' => Controls_Manager::DIMENSIONS, 'label' => __( 'Border Radius', 'elementor-extras' ), 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__media' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'media_z_index', [ 'label' => __( 'Z-Index', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'selectors' => [ '{{WRAPPER}} .ee-post__media' => 'z-index: {{VALUE}};' ] ] ); $this->add_control( 'media_content_vertical_aligment', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'label_block' => false, 'type' => Controls_Manager::CHOOSE, 'options' => [ 'top' => [ 'title' => __( 'Initial', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'middle' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'bottom' => [ 'title' => __( 'Opposite', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], 'stretch' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-v-align-stretch', ], ], 'default' => 'top', 'prefix_class' => 'ee-posts-align-', ] ); $this->add_responsive_control( 'media_content_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'label_block' => false, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__media__content' => 'text-align: {{VALUE}};', ] ] ); $this->add_responsive_control( 'media_content_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__media__content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); // $this->add_control( // 'media_thumbnail_style_heading', // [ // 'label' => __( 'Thumbnail', 'elementor-extras' ), // 'type' => Controls_Manager::HEADING, // 'separator' => 'before', // ] // ); // $this->add_control( // 'media_thumbnail_effect', // [ // 'separator' => 'after', // 'label' => __( 'Effect', 'elementor-extras' ), // 'type' => Controls_Manager::SELECT, // 'default' => '', // 'options' => [ // '' => __( 'None', 'elementor-extras' ), // 'rotate-to-left' => __( 'Rotate To Left', 'elementor-extras' ), // 'rotate-to-right' => __( 'Rotate To Right', 'elementor-extras' ), // 'rotate-from-left' => __( 'Rotate From Left', 'elementor-extras' ), // 'rotate-from-right' => __( 'Rotate From Right', 'elementor-extras' ), // ], // 'prefix_class' => 'ee-posts-effect__thumbnail--', // ] // ); $media_metas_conditions = $this->get_area_metas_controls_conditions( 'media' ); $this->add_control( 'media_metas', [ 'separator' => 'before', 'label' => __( '↳ Media Metas', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'conditions' => $media_metas_conditions, ] ); $this->add_control( 'media_metas_description', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Use these to style metas that appear only in the Media area', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'conditions' => $media_metas_conditions, ] ); $this->add_control( 'media_metas_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__media .ee-post__metas__list' => 'margin-left: -{{SIZE}}px', '{{WRAPPER}} .ee-post__media .ee-post__meta, {{WRAPPER}} .ee-post__media .ee-post__meta__separator' => 'margin-left: {{SIZE}}px', ], 'conditions' => $media_metas_conditions, ] ); $this->add_control( 'media_metas_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__media .ee-post__metas' => 'margin-bottom: {{SIZE}}px', ], 'conditions' => $media_metas_conditions, ] ); $this->add_responsive_control( 'media_metas_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__media .ee-post__metas--has-metas' => 'text-align: {{VALUE}};', ], 'conditions' => $media_metas_conditions, ] ); $this->add_responsive_control( 'media_metas_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__media .ee-post__metas--has-metas' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $media_metas_conditions, ] ); $this->add_control( 'media_metas_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__media .ee-post__metas--has-metas .ee-post__meta' => 'color: {{VALUE}};', ], 'conditions' => $media_metas_conditions, ] ); $this->add_control( 'media_metas_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__media .ee-post__metas--has-metas' => 'background-color: {{VALUE}};', ], 'conditions' => $media_metas_conditions, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'media_metas_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-post__media .ee-post__metas--has-metas .ee-post__meta', 'conditions' => $media_metas_conditions, ] ); $this->end_controls_section(); } public function register_body_style_controls() { $this->start_controls_section( 'section_style_body', [ 'label' => __( 'Body', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'conditions' => [ 'relation' => 'and', 'terms' => [ $this->get_empty_area_condition( 'body' ), [ 'name' => 'skin_source', 'operator' => '==', 'value' => '', ], ], ], ] ); $this->add_responsive_control( 'body_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__body' => 'text-align: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'body' ), ] ); $this->add_responsive_control( 'body_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__body' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $this->get_empty_area_condition( 'body' ), ] ); $this->add_responsive_control( 'body_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__body' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $this->get_empty_area_condition( 'body' ), ] ); $this->add_control( 'body_border_radius', [ 'type' => Controls_Manager::DIMENSIONS, 'label' => __( 'Border Radius', 'elementor-extras' ), 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__body' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $this->get_empty_area_condition( 'body' ), ] ); $this->start_controls_tabs( 'body_tabs_hover' ); $this->start_controls_tab( 'body_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'body_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__body' => 'background-color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'body' ), ] ); $this->add_control( 'body_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__body' => 'color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'body' ), ] ); $this->end_controls_tab(); $this->start_controls_tab( 'body_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'body_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post:hover .ee-post__body' => 'background-color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'body' ), ] ); $this->add_control( 'body_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post:hover .ee-post__body' => 'color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'body' ), ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $body_metas_condition = $this->get_area_metas_controls_conditions( 'body' ); $this->add_control( 'body_metas', [ 'separator' => 'before', 'label' => __( '↳ Body Metas', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'conditions' => $body_metas_condition, ] ); $this->add_control( 'body_metas_description', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Use these to style metas that appear only in the Body area', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'conditions' => $body_metas_condition, ] ); $this->add_control( 'body_metas_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__body .ee-post__metas__list' => 'margin-left: -{{SIZE}}px', '{{WRAPPER}} .ee-post__body .ee-post__meta, {{WRAPPER}} .ee-post__body .ee-post__meta__separator' => 'margin-left: {{SIZE}}px', ], 'conditions' => $body_metas_condition, ] ); $this->add_control( 'body_metas_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__body .ee-post__metas' => 'margin-bottom: {{SIZE}}px', ], 'conditions' => $body_metas_condition, ] ); $this->add_responsive_control( 'body_metas_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__body .ee-post__metas--has-metas' => 'text-align: {{VALUE}};', ], 'conditions' => $body_metas_condition, ] ); $this->add_responsive_control( 'body_metas_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__body .ee-post__metas--has-metas' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $body_metas_condition, ] ); $this->add_control( 'body_metas_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__body .ee-post__metas--has-metas' => 'color: {{VALUE}};', ], 'conditions' => $body_metas_condition, ] ); $this->add_control( 'body_metas_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__body .ee-post__metas--has-metas' => 'background-color: {{VALUE}};', ], 'conditions' => $body_metas_condition, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'body_metas_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-post__body .ee-post__metas--has-metas .ee-post__meta', 'conditions' => $body_metas_condition, ] ); $this->end_controls_section(); } /** * Register Footer Style Controls * * @since 1.6.0 * @return void */ public function register_footer_style_controls() { $this->start_controls_section( 'section_style_footer', [ 'label' => __( 'Footer', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'conditions' => [ 'relation' => 'and', 'terms' => [ $this->get_empty_area_condition( 'footer' ), [ 'name' => 'skin_source', 'operator' => '==', 'value' => '', ], ], ], ] ); $this->add_responsive_control( 'footer_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__footer' => 'text-align: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'footer' ), ] ); $this->add_responsive_control( 'footer_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__footer' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $this->get_empty_area_condition( 'footer' ), ] ); $this->add_responsive_control( 'footer_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__footer' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $this->get_empty_area_condition( 'footer' ), ] ); $this->add_control( 'footer_border_radius', [ 'type' => Controls_Manager::DIMENSIONS, 'label' => __( 'Border Radius', 'elementor-extras' ), 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__footer' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $this->get_empty_area_condition( 'footer' ), ] ); $this->start_controls_tabs( 'footer_tabs_hover' ); $this->start_controls_tab( 'footer_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'footer_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__footer' => 'background-color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'footer' ), ] ); $this->add_control( 'footer_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__footer' => 'color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'footer' ), ] ); $this->add_control( 'footer_separator_heading', [ 'label' => __( 'Separator', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'conditions' => $this->get_empty_area_condition( 'footer' ), ] ); $this->add_control( 'footer_separator_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__footer' => 'border-color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'footer' ), ] ); $this->end_controls_tab(); $this->start_controls_tab( 'footer_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'footer_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post:hover .ee-post__footer' => 'background-color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'footer' ), ] ); $this->add_control( 'footer_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post:hover .ee-post__footer' => 'color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'footer' ), ] ); $this->add_control( 'footer_separator_heading_hover', [ 'label' => __( 'Separator', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'conditions' => $this->get_empty_area_condition( 'footer' ), ] ); $this->add_control( 'footer_separator_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post:hover .ee-post__footer' => 'border-color: {{VALUE}};', ], 'conditions' => $this->get_empty_area_condition( 'footer' ), ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_responsive_control( 'footer_separator_size', [ 'separator' => 'before', 'label' => __( 'Separator Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 10, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__footer' => 'border-width: {{SIZE}}px', ], 'conditions' => $this->get_empty_area_condition( 'footer' ), ] ); $footer_metas_condition = $this->get_area_metas_controls_conditions( 'footer' ); $this->add_control( 'footer_metas', [ 'separator' => 'before', 'label' => __( '↳ Footer Metas', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'conditions' => $footer_metas_condition, ] ); $this->add_control( 'footer_metas_description', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Use these to style metas that appear only in the Footer area', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'conditions' => $footer_metas_condition, ] ); $this->add_control( 'footer_metas_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__footer .ee-post__metas__list' => 'margin-left: -{{SIZE}}px', '{{WRAPPER}} .ee-post__footer .ee-post__meta, {{WRAPPER}} .ee-post__footer .ee-post__meta__separator' => 'margin-left: {{SIZE}}px', ], 'conditions' => $footer_metas_condition, ] ); $this->add_control( 'footer_metas_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__footer .ee-post__metas' => 'margin-bottom: {{SIZE}}px', ], 'conditions' => $footer_metas_condition, ] ); $this->add_responsive_control( 'footer_metas_text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__footer .ee-post__metas--has-metas' => 'text-align: {{VALUE}};', ], 'conditions' => $footer_metas_condition, ] ); $this->add_responsive_control( 'footer_metas_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__footer .ee-post__metas--has-metas' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'conditions' => $footer_metas_condition, ] ); $this->add_control( 'footer_metas_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__footer .ee-post__metas--has-metas' => 'color: {{VALUE}};', ], 'conditions' => $footer_metas_condition, ] ); $this->add_control( 'footer_metas_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__footer .ee-post__metas--has-metas' => 'background-color: {{VALUE}};', ], 'conditions' => $footer_metas_condition, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'footer_metas_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-post__footer .ee-post__metas--has-metas .ee-post__meta', 'conditions' => $footer_metas_condition, ] ); $this->end_controls_section(); } /** * Register Metas Style Controls * * @since 1.6.0 * @return void */ public function register_metas_style_controls() { $this->start_controls_section( 'section_style_metas', [ 'label' => __( 'Metas', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'relation' => 'or', 'terms' => [ [ 'name' => 'post_avatar_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_author_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_date_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_comments_position', 'operator' => '!=', 'value' => '', ] ] ], [ 'name' => 'skin_source', 'operator' => '==', 'value' => '', ], ] ], ] ); $this->add_control( 'metas_description', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'The effects of the controls below can be overriden at an area level by using the options inside each separate area.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'post_author_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_date_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_comments_position', 'operator' => '!=', 'value' => '', ] ] ] ] ); $this->add_control( 'metas_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__metas__list' => 'margin-left: -{{SIZE}}px', '{{WRAPPER}} .ee-post__meta, {{WRAPPER}} .ee-post__meta__separator' => 'margin-left: {{SIZE}}px', ], 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'post_author_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_date_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_comments_position', 'operator' => '!=', 'value' => '', ] ] ] ] ); $this->add_control( 'author_avatar_heading', [ 'separator' => 'before', 'label' => __( 'Avatar', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'post_avatar_position!' => '', ] ] ); $this->add_control( 'author_avatar_display', [ 'label' => __( 'Display', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'left', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'condition' => [ 'post_avatar_position!' => '', ], 'prefix_class' => 'ee-posts-avatar-position-', 'label_block' => false, ] ); $this->add_control( 'author_avatar_vertical_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => [ 'flex-start'=> [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'flex-end' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__metas--has-metas.ee-post__metas--has-avatar' => 'align-items: {{VALUE}};', ], 'label_block' => false, 'condition' => [ 'post_avatar_position!' => '', 'author_avatar_display!' => 'top', ] ] ); $this->add_responsive_control( 'author_avatar_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 12, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__metas__avatar' => 'max-width: {{SIZE}}px !important;', ], 'condition' => [ 'post_avatar_position!' => '', ], ] ); $this->add_control( 'author_avatar_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}}.ee-posts-avatar-position-top .ee-post__metas--has-metas .ee-post__metas__avatar' => 'margin: 0 0 {{SIZE}}px 0', '{{WRAPPER}}.ee-posts-avatar-position-right .ee-post__metas--has-metas .ee-post__metas__avatar' => 'margin: 0 0 0 {{SIZE}}px', '{{WRAPPER}} .ee-post__metas--has-metas .ee-post__metas__avatar' => 'margin: 0 {{SIZE}}px 0 0', ], 'condition' => [ 'post_avatar_position!' => '', ], ] ); $this->add_control( 'author_avatar_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ '%' => [ 'min' => 0, 'max' => 100, 'step'=> 1, ], 'px' => [ 'min' => 0, 'max' => 100, 'step'=> 1, ], ], 'size_units' => [ '%', 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-post__metas__avatar' => 'border-radius: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'post_avatar_position!' => '', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'author_avatar_box_shadow', 'selector' => '{{WRAPPER}} .ee-post__metas__avatar', 'separator' => '', 'condition' => [ 'post_avatar_position!' => '', ], ] ); $this->add_control( 'author_name_heading', [ 'separator' => 'before', 'label' => __( 'Author', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'post_author_position!' => '', ], ] ); $this->add_control( 'author_name_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__meta--author' => 'color: {{VALUE}};', ], 'condition' => [ 'post_author_position!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'author_name_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-post__meta--author', 'exclude' => [ 'font_family', 'font_size', 'line_height', 'letter_spacing', ], 'condition' => [ 'post_author_position!' => '', ], ] ); $this->add_control( 'date_heading', [ 'separator' => 'before', 'label' => __( 'Date', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'post_date_position!' => '', ], ] ); $this->add_control( 'date_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__meta--date' => 'color: {{VALUE}};', ], 'condition' => [ 'post_date_position!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'date_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-post__meta--date', 'exclude' => [ 'font_family', 'font_size', 'line_height', 'letter_spacing', ], 'condition' => [ 'post_date_position!' => '', ], ] ); if ( is_woocommerce_active() ) { $this->add_control( 'price_heading', [ 'separator' => 'before', 'label' => __( 'Price', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'post_price_position!' => '', 'posts_post_type' => ['product', 'current_query'], ], ] ); $this->add_control( 'price_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__meta--price' => 'color: {{VALUE}};', ], 'condition' => [ 'post_price_position!' => '', 'posts_post_type' => ['product', 'current_query'], ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'price_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-post__meta--price', 'exclude' => [ 'font_family', 'font_size', 'line_height', 'letter_spacing', ], 'condition' => [ 'post_price_position!' => '', 'posts_post_type' => ['product', 'current_query'], ], ] ); } $this->add_control( 'comments_heading', [ 'separator' => 'before', 'label' => __( 'Comments', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'post_comments_position!' => '', ], ] ); $this->add_control( 'comments_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__meta--comments' => 'color: {{VALUE}};', ], 'condition' => [ 'post_comments_position!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'comments_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-post__meta--comments', 'exclude' => [ 'font_family', 'font_size', 'line_height', 'letter_spacing', ], 'condition' => [ 'post_comments_position!' => '', ], ] ); $this->end_controls_section(); } /** * Register Terms Style Controls * * @since 1.6.0 * @return void */ public function register_terms_style_controls() { $this->start_controls_section( 'section_style_terms', [ 'label' => __( 'Terms', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'post_terms_position!' => '', ] ] ); $this->add_control( 'terms_terms_heading', [ 'separator' => 'before', 'label' => __( 'Terms', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'post_terms_position!' => '', ] ] ); $this->add_responsive_control( 'terms_terms_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__terms' => 'text-align: {{VALUE}};', ], 'condition' => [ 'post_terms_position!' => '', ] ] ); $this->add_responsive_control( 'terms_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__terms' => 'margin-bottom: {{SIZE}}px', ], 'condition' => [ 'post_terms_position!' => '', ] ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'terms_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-post__terms__term', 'fields_options' => [ 'font_size' => [ 'size_units' => [ 'px', 'vw' ], ], ], 'condition' => [ 'post_terms_position!' => '', ] ] ); $this->add_control( 'terms_term_heading', [ 'separator' => 'before', 'label' => __( 'Term', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'post_terms_position!' => '', ], ] ); $this->add_responsive_control( 'terms_spacing', [ 'label' => __( 'Horzontal Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__terms' => 'margin-left: -{{SIZE}}px', '{{WRAPPER}} .ee-post__terms__term' => 'margin-left: {{SIZE}}px', '{{WRAPPER}} .ee-post__terms__separator' => 'margin-left: {{SIZE}}px', ], 'condition' => [ 'post_terms_count!' => '1', 'post_terms_position!' => '', ], ] ); $this->add_responsive_control( 'terms_vertical_spacing', [ 'label' => __( 'Vertical Spacing', 'elementor-extras' ), 'description' => __( 'If you have multuple lines of terms, this will help you distance them from one another', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__terms__term' => 'margin-bottom: {{SIZE}}px', ], 'condition' => [ 'post_terms_count!' => '1', 'post_terms_position!' => '', ], ] ); $this->add_responsive_control( 'terms_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__terms__link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'post_terms_position!' => '', ], ] ); $this->add_control( 'terms_border_radius', [ 'type' => Controls_Manager::DIMENSIONS, 'label' => __( 'Border Radius', 'elementor-extras' ), 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__terms__link' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'post_terms_position!' => '', ], ] ); $this->start_controls_tabs( 'terms_tabs_hover' ); $this->start_controls_tab( 'terms_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ 'post_terms_position!' => '', ], ] ); $this->add_control( 'terms_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__terms__link' => 'color: {{VALUE}};', ], 'condition' => [ 'post_terms_position!' => '', ], ] ); $this->add_control( 'terms_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__terms__link' => 'background-color: {{VALUE}};', ], 'condition' => [ 'post_terms_position!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'terms_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'name' => 'post_terms_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_terms_position', 'operator' => '!=', 'value' => 'media', ], ] ], ] ); $this->add_control( 'terms_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__terms__link:hover' => 'color: {{VALUE}};', ], 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'name' => 'post_terms_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_terms_position', 'operator' => '!=', 'value' => 'media', ], ] ], ] ); $this->add_control( 'terms_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__terms__link:hover' => 'background-color: {{VALUE}};', ], 'conditions' => [ 'relation' => 'and', 'terms' => [ [ 'name' => 'post_terms_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_terms_position', 'operator' => '!=', 'value' => 'media', ], ] ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'terms_separator_heading', [ 'separator' => 'before', 'label' => __( 'Separator', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'post_terms_position!' => '', ], ] ); $this->add_control( 'terms_separator_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__terms__separator' => 'color: {{VALUE}};', ], 'condition' => [ 'post_terms_position!' => '', ], ] ); $this->end_controls_section(); } /** * Register Title Style Controls * * @since 1.6.0 * @return void */ public function register_title_style_controls() { $this->start_controls_section( 'section_style_title', [ 'label' => __( 'Title', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'post_title_position!' => '', 'skin_source' => '', ] ] ); $this->add_responsive_control( 'title_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__title' => 'text-align: {{VALUE}};', ], 'condition' => [ 'post_title_position!' => '', ] ] ); $this->add_control( 'title_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__title__heading' => 'color: {{VALUE}};', ], 'condition' => [ 'post_title_position!' => '', ] ] ); $this->add_control( 'title_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__title' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'title_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'post_title_position!' => '', ] ] ); $this->add_responsive_control( 'title_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'post_title_position!' => '', ] ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_SECONDARY, ], 'selector' => '{{WRAPPER}} .ee-post__title__heading', 'condition' => [ 'post_title_position!' => '', ] ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'title_shadow', 'selector' => '{{WRAPPER}} .ee-post__title__heading', 'condition' => [ 'post_title_position!' => '', ] ] ); $this->end_controls_section(); } /** * Register Excerpt Style Controls * * @since 1.6.0 * @return void */ public function register_excerpt_style_controls() { $this->start_controls_section( 'section_style_excerpt', [ 'label' => __( 'Excerpt', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'post_excerpt_position!' => '', 'skin_source' => '', ] ] ); $this->add_responsive_control( 'excerpt_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__excerpt' => 'text-align: {{VALUE}};', ], 'condition' => [ 'post_excerpt_position!' => '', ] ] ); $this->add_responsive_control( 'excerpt_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__excerpt' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'post_excerpt_position!' => '', ] ] ); $this->add_responsive_control( 'excerpt_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__excerpt' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'post_excerpt_position!' => '', ] ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'excerpt_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-post__excerpt', ] ); $this->end_controls_section(); } /** * Register Button Style Controls * * @since 1.6.0 * @return void */ public function register_button_style_controls() { $this->start_controls_section( 'section_style_button', [ 'label' => __( 'Button', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'post_button_position!' => '', ] ] ); $this->add_responsive_control( 'button_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__read-more' => 'text-align: {{VALUE}};', ], 'condition' => [ 'post_button_position!' => '', ] ] ); $this->add_responsive_control( 'button_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__read-more > *' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'post_button_position!' => '', ] ] ); $this->add_responsive_control( 'button_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__read-more > *' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'post_button_position!' => '', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-post__read-more > *', ] ); $this->add_control( 'button_border_radius', [ 'type' => Controls_Manager::DIMENSIONS, 'label' => __( 'Border Radius', 'elementor-extras' ), 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-post__read-more > *' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'post_button_position!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-post__read-more > *', ] ); $this->add_responsive_control( 'read_more_distance', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__read-more' => 'margin-top: {{SIZE}}px;', ], 'condition' => [ 'post_button_position!' => '', ] ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'button', 'selector' => '{{WRAPPER}} .ee-post__read-more > *', ] ); $this->start_controls_tabs( 'button_tabs' ); $this->start_controls_tab( 'button_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'read_more_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__read-more > *' => 'color: {{VALUE}};', ], 'condition' => [ 'post_button_position!' => '', ] ] ); $this->add_control( 'read_more_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__read-more > *' => 'background-color: {{VALUE}};', ], 'condition' => [ 'post_button_position!' => '', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'button_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'read_more_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__read-more > *:hover' => 'color: {{VALUE}};', ], 'condition' => [ 'post_button_position!' => '', ] ] ); $this->add_control( 'read_more_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__read-more > *:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ 'post_button_position!' => '', ] ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Register Hover Animation Controls * * @since 1.6.0 * @return void */ public function register_hover_animation_controls() { $media_not_empty = [ 'relation' => 'or', 'terms' => [ [ 'name' => 'post_avatar_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_author_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_date_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_comments_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_title_position', 'operator' => '!=', 'value' => '', ], [ 'name' => 'post_terms_position', 'operator' => '!=', 'value' => '', ] ], ]; $this->start_controls_section( 'section_style_hover_animation', [ 'label' => __( 'Hover Effects', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'skin_source' => '', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'media', 'selector' => '{{WRAPPER}} .ee-post__media, {{WRAPPER}} .ee-post__media__content, {{WRAPPER}} .ee-post__media__content > *, {{WRAPPER}} .ee-post__media__overlay, {{WRAPPER}} .ee-post__media__thumbnail, {{WRAPPER}} .ee-post__media__header, {{WRAPPER}} .ee-post__media__body, {{WRAPPER}} .ee-post__media__footer', ] ); $this->update_control( 'media_transition', array( 'default' => 'custom', )); $this->add_control( 'media_content_style_heading', [ 'label' => __( 'Content', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'conditions' => $media_not_empty, ] ); $this->add_control( 'media_content_effect', [ 'label' => __( 'Effect', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'fade-in' => __( 'Fade In', 'elementor-extras' ), 'fade-out' => __( 'Fade Out', 'elementor-extras' ), 'from-top' => __( 'From Top', 'elementor-extras' ), 'from-right' => __( 'From Right', 'elementor-extras' ), 'from-bottom' => __( 'From Bottom', 'elementor-extras' ), 'from-left' => __( 'From Left', 'elementor-extras' ), 'fade-from-top' => __( 'Fade From Top', 'elementor-extras' ), 'fade-from-right' => __( 'Fade From Right', 'elementor-extras' ), 'fade-from-bottom' => __( 'Fade From Bottom', 'elementor-extras' ), 'fade-from-left' => __( 'Fade From Left', 'elementor-extras' ), 'to-top' => __( 'To Top', 'elementor-extras' ), 'to-right' => __( 'To Right', 'elementor-extras' ), 'to-bottom' => __( 'To Bottom', 'elementor-extras' ), 'to-left' => __( 'To Left', 'elementor-extras' ), 'fade-to-top' => __( 'Fade To Top', 'elementor-extras' ), 'fade-to-right' => __( 'Fade To Right', 'elementor-extras' ), 'fade-to-bottom' => __( 'Fade To Bottom', 'elementor-extras' ), 'fade-to-left' => __( 'Fade To Left', 'elementor-extras' ), ], 'conditions' => $media_not_empty, 'prefix_class' => 'ee-media-effect__content--', ] ); $this->add_control( 'media_area_heading', [ 'label' => __( 'Media', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->start_controls_tabs( 'media_tabs_hover' ); $this->start_controls_tab( 'media_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_responsive_control( 'media_area_scale', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0.7, 'max' => 1.3, 'step'=> 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__media' => 'transform: scale({{SIZE}});', ], ] ); $this->add_control( 'media_area_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__media__content *' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'media_area_box_shadow', 'selector' => '{{WRAPPER}} .ee-post__media', 'separator' => '', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'media_area_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-post__media', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'media_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'media_area_heading_hover', [ 'label' => __( 'Area', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_responsive_control( 'media_area_scale_hover', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0.7, 'max' => 1.3, 'step'=> 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__media:hover' => 'transform: scale({{SIZE}});', ], ] ); $this->add_control( 'media_area_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__media:hover .ee-post__media__content *' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'media_area_box_shadow_hover', 'selector' => '{{WRAPPER}} .ee-post__media:hover', 'separator' => '', ] ); $this->add_control( 'media_area_border_color_hover', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-post__media:hover' => 'border-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'media_thumbnail_heading', [ 'label' => __( 'Thumbnail', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->start_controls_tabs( 'thumbnail_tabs_hover' ); $this->start_controls_tab( 'thumbnail_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_responsive_control( 'media_thumbnail_scale', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 1.3, 'step'=> 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__media__thumbnail' => 'transform: scale({{SIZE}});', ], ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'media_thumbnail_css_filters', 'selector' => '{{WRAPPER}} .ee-post__media__thumbnail', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'thumbnail_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_responsive_control( 'media_thumbnail_scale_hover', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 1.3, 'step'=> 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__media:hover .ee-post__media__thumbnail' => 'transform: scale({{SIZE}});', ], ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'media_thumbnail_css_filters_hover', 'selector' => '{{WRAPPER}} .ee-post__media:hover .ee-post__media__thumbnail', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'media_overlay_heading', [ 'label' => __( 'Overlay', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->start_controls_tabs( 'overlay_tabs_hover' ); $this->start_controls_tab( 'overlay_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'media_overlay_background_color', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .ee-post__media__overlay', 'default' => 'classic', 'exclude' => [ 'image', ] ] ); $this->add_control( 'media_overlay_blend', [ 'label' => __( 'Blend mode', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'normal', 'options' => [ 'normal' => __( 'Normal', 'elementor-extras' ), 'multiply' => __( 'Multiply', 'elementor-extras' ), 'screen' => __( 'Screen', 'elementor-extras' ), 'overlay' => __( 'Overlay', 'elementor-extras' ), 'darken' => __( 'Darken', 'elementor-extras' ), 'lighten' => __( 'Lighten', 'elementor-extras' ), 'color' => __( 'Color', 'elementor-extras' ), 'color-dodge' => __( 'Color Dodge', 'elementor-extras' ), 'hue' => __( 'Hue', 'elementor-extras' ), ], 'selectors' => [ '{{WRAPPER}} .ee-post__media__overlay' => 'mix-blend-mode: {{VALUE}};', ], ] ); $this->add_control( 'media_overlay_blend_notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => sprintf( __( 'Please check blend mode support for your browser %1$s here %2$s', 'elementor-extras' ), '<a href="https://caniuse.com/#search=mix-blend-mode" target="_blank">', '</a>' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'condition' => [ 'media_overlay_blend!' => 'normal' ], ] ); $this->add_responsive_control( 'media_overlay_opacity', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__media__overlay' => 'opacity: {{SIZE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'overlay_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'media_overlay_background_color_hover', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .ee-post__media:hover .ee-post__media__overlay', 'default' => 'classic', 'exclude' => [ 'image', ] ] ); $this->add_responsive_control( 'media_overlay_opacity_hover', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-post__media:hover .ee-post__media__overlay' => 'opacity: {{SIZE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Get Areas Metas Controls Conditions * * @since 1.6.0 * @return void */ protected function get_area_metas_controls_conditions( $area ) { if ( ! $area ) return; $conditions = [ 'relation' => 'or', 'terms' => [], ]; $metas = Module::get_meta_parts(); foreach ( $metas as $meta ) { if ( in_array( $meta, ['price'] ) ) { $conditions['terms'][] = [ 'relation' => 'and', 'terms' => [ [ 'name' => 'post_' . $meta . '_position', 'operator' => '==', 'value' => $area, ], [ 'name' => 'posts_post_type', 'operator' => '==', 'value' => 'product', ], ] ]; } else { $conditions['terms'][] = [ 'name' => 'post_' . $meta . '_position', 'operator' => '==', 'value' => $area, ]; } } return $conditions; } /** * Get Empty Area Condition * * @since 1.6.0 * @return void */ protected function get_empty_area_condition( $area, $other_conditions = [] ) { if ( ! $area ) return; $conditions = $this->get_area_metas_controls_conditions( $area ); $parts = Module::get_content_post_parts(); foreach( $parts as $part ) { $conditions['terms'][] = [ 'name' => 'post_' . $part . '_position', 'operator' => '==', 'value' => $area, ]; } $conditions = array_merge( $conditions, $other_conditions ); return $conditions; } /** * Get Ordered Posts Parts * * @since 1.6.0 * @return void */ public function get_ordered_post_parts( $parts ) { if ( ! $parts ) return; $_parts = []; $settings = $this->get_settings(); foreach ( $parts as $part ) { $order = $settings['post_' . $part . '_order']; if ( ! $order ) $order = 0; $_parts[$part] = $order; } asort( $_parts ); return $_parts; } /** * Get Post Classes * * @since 2.1.0 * @return array */ public function get_post_classes() { global $post; $settings = $this->get_settings(); $post_classes = [ 'ee-post' ]; if ( 'yes' === $settings['post_media'] && in_array( $settings[ 'post_media_position' ], array( 'left', 'right' ) ) ) { $post_classes[] = 'ee-post--horizontal'; $post_classes[] = 'ee-post--horizontal__' . $settings[ 'post_media_position' ]; } if ( is_sticky( $post->ID ) ) { $post_classes[] = 'sticky'; } /** * Post Classes Filter * * Filters the post classes * * @since 2.2.28 * @param string $post_classes The array of classes * @param object|WP_Post $post The current post * @param object|WP_Post $settings The widget settings */ return apply_filters( 'elementor_extras/widgets/posts/post_classes', $post_classes, $post, $this->get_settings() ); } /** * In in area * * @since 1.6.0 * @return void */ public function is_in_area( $part, $area ) { if ( empty( $part ) || empty( $area ) ) return; $settings = $this->get_settings(); if ( $settings[ 'post_' . $part . '_position' ] === $area ) { if ( $this->is_meta_part( $part ) || 'avatar' === $part ) { if ( in_array( $part, $settings[ 'post_metas' ] ) ) { return true; } } else { return true; } } return false; } /** * In Meta Part * * @since 2.2.0 * @return void */ public function is_meta_part( $part ) { if ( empty( $part ) ) return; if ( in_array( $part, Module::get_meta_parts() ) ) { return true; } return false; } /** * Checks if a particular area of the layout has any content * * @since 1.6.0 * @return bool * */ public function is_empty_area( $area ) { if ( empty( $area ) ) return; $settings = $this->get_settings(); $content_parts = Module::get_content_parts(); foreach ( $content_parts as $part ) { if ( $this->is_in_area( $part, $area ) ) { // Additional check to see if we have any terms in this area if ( 'terms' === $part ) { if ( false !== $this->get_terms() ) return false; } else if ( 'price' === $part ) { if ( 'product' === $settings['posts_post_type'] ) { return false; } } else { return false; } } } return true; } /** * Checks if any metas are in a specific area * * @since 1.6.0 * @return bool */ public function metas_in_area( $area ) { foreach ( Module::get_meta_parts() as $part ) { if ( $this->is_in_area( $part, $area ) ) { return true; } } return false; } /** * Render * * Render widget contents on frontend * * @since 1.6.0 * @return void */ public function render() { $this->add_inline_editing_attributes( 'classic_filters_all_text', 'none' ); } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 1.6.0 * @return void */ protected function content_template() {} } posts/widgets/timeline.php 0000644 00000233040 15112147616 0011707 0 ustar 00 <?php namespace ElementorExtras\Modules\Posts\Widgets; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Group_Control_Transition; use ElementorExtras\Modules\Posts\Widgets\Posts_Base; use ElementorExtras\Modules\Posts\Module as PostsModule; use ElementorExtras\Modules\TemplatesControl\Module as TemplatesControl; // Elementor Classes use Elementor\Repeater; use Elementor\Icons_Manager; use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Box_Shadow; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; // Elementor Pro Classes use ElementorPro\Modules\QueryControl\Module as Module_Query; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Timeline * * @since 0.1.0 */ class Timeline extends Posts_Base { /** * Get Name * * Get the name of the widget * * @since 0.1.0 * @return string */ public function get_name() { return 'timeline'; } /** * Get Title * * Get the title of the widget * * @since 0.1.0 * @return string */ public function get_title() { return __( 'Timeline', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 0.1.0 * @return string */ public function get_icon() { return 'nicon nicon-timeline'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 0.1.0 * @return array */ public function get_script_depends() { return [ 'ee-timeline', 'gsap-js', ]; } /** * Get Current Page * * @since 2.2.0 * @return array */ public function get_current_page() { return 1; } protected function register_items_controls() { $this->start_controls_section( 'section_timeline', [ 'label' => __( 'Timeline', 'elementor-extras' ), 'condition' => [ 'source!' => 'posts', ] ] ); $repeater = new Repeater(); $repeater->start_controls_tabs( 'items_repeater' ); $repeater->start_controls_tab( 'tab_content', [ 'label' => __( 'Content', 'elementor-extras' ) ] ); $repeater->add_control( 'date', [ 'label' => __( 'Date', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'placeholder' => __( '19 January 2000', 'elementor-extras' ), ] ); $repeater->add_control( 'link', [ 'label' => __( 'Link', 'elementor-extras' ), 'description' => __( 'Enable linking the whole card. If you have links inside the content of this card, make sure you have this disabled. Links within links are not allowed.', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'dynamic' => [ 'active' => true ], 'placeholder' => esc_url( home_url( '/' ) ), 'default' => [ 'url' => '', ], ] ); $default_title = '<h2>' . _x( 'The birth of mankind', 'Default title for the content of a hotspot.', 'elementor-extras' ) . '</h2>'; $default_paragraph = '<p>' . _x( 'Something really big happened around this period of time. It affected all of humanity. That explains everything.', 'Default title for the content of a hotspot.', 'elementor-extras' ) . '</p>'; $repeater->add_control( 'content', [ 'label' => '', 'type' => Controls_Manager::WYSIWYG, 'dynamic' => [ 'active' => true ], 'default' => $default_title . $default_paragraph, ] ); $repeater->end_controls_tab(); $repeater->start_controls_tab( 'tab_media', [ 'label' => __( 'Media', 'elementor-extras' ) ] ); $repeater->add_control( 'image', [ 'label' => __( 'Choose Image', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'type' => Controls_Manager::MEDIA, ] ); $repeater->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'image', // Actually its `image_size` 'label' => __( 'Image Size', 'elementor-extras' ), 'default' => 'large', ] ); $repeater->end_controls_tab(); $repeater->start_controls_tab( 'tab_style', [ 'label' => __( 'Style', 'elementor-extras' ) ] ); $repeater->add_control( 'custom_style', [ 'label' => __( 'Custom', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'description' => __( 'Set custom styles that will only affect this specific item.', 'elementor-extras' ), ] ); $repeater->add_control( 'point_content_type', [ 'label' => __( 'Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Global', 'elementor-extras' ), 'icons' => __( 'Icon', 'elementor-extras' ), 'numbers' => __( 'Number', 'elementor-extras' ), 'letters' => __( 'Letter', 'elementor-extras' ), ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ] ], ], ] ); $repeater->add_control( 'selected_icon', [ 'label' => __( 'Point Icon', 'elementor-extras' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'icon', 'default' => [ 'value' => 'fas fa-calendar-alt', 'library' => 'fa-solid', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], [ 'name' => 'point_content_type', 'operator' => '==', 'value' => 'icons', ], ], ], ] ); $repeater->add_control( 'point_content', [ 'label' => __( 'Point Content', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], [ 'name' => 'point_content_type', 'operator' => '!==', 'value' => 'icons', ], [ 'name' => 'point_content_type', 'operator' => '!==', 'value' => '', ], ], ], ] ); $repeater->add_control( 'item_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'icon_color', [ 'label' => __( 'Point Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .timeline-item__point' => 'color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'point_background', [ 'label' => __( 'Point Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-timeline {{CURRENT_ITEM}} .timeline-item__point' => 'background-color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'card_foreground', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item .timeline-item__content *' => 'color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'card_background', [ 'label' => __( 'Card Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item .timeline-item__content-wrapper' => 'background-color: {{VALUE}};', '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item .timeline-item__card__arrow::after' => 'border-left-color: {{VALUE}}; border-right-color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'date_color', [ 'label' => __( 'Date Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item .timeline-item__meta' => 'color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'point_size', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0.5, 'max' => 2, 'step' => 0.01 ], ], 'selectors' => [ // Item '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item .timeline-item__point' => 'transform: scale({{SIZE}})', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'item_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'icon_color_hover', [ 'label' => __( 'Hovered Point Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item:hover .timeline-item__point, {{WRAPPER}} {{CURRENT_ITEM}}.timeline-item.is--focused:hover .timeline-item__point' => 'color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'point_background_hover', [ 'label' => __( 'Hovered Point Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item:hover .timeline-item__point, {{WRAPPER}} {{CURRENT_ITEM}}.timeline-item.is--focused:hover .timeline-item__point' => 'background-color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'card_foreground_hover', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item:hover .timeline-item__content *' => 'color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'card_background_hover', [ 'label' => __( 'Hovered Card Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item:hover .timeline-item__content-wrapper, {{WRAPPER}} {{CURRENT_ITEM}}.timeline-item.is--focused:hover .timeline-item__content-wrapper' => 'background-color: {{VALUE}};', '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item:hover .timeline-item__card__arrow::after, {{WRAPPER}} {{CURRENT_ITEM}}.timeline-item.is--focused:hover .timeline-item__card__arrow::after' => 'border-left-color: {{VALUE}}; border-right-color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'date_color_hover', [ 'label' => __( 'Hovered Date Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item:hover .timeline-item__meta, {{WRAPPER}} {{CURRENT_ITEM}}.timeline-item.is--focused:hover .timeline-item__meta' => 'color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'point_size_hover', [ 'label' => __( 'Hovered Point Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0.5, 'max' => 2, 'step' => 0.01 ], ], 'selectors' => [ // Item '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item:hover .timeline-item__point, {{WRAPPER}} {{CURRENT_ITEM}}.timeline-item.is--focused:hover .timeline-item__point' => 'transform: scale({{SIZE}})', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'item_focused', [ 'label' => __( 'Focused', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'icon_color_focused', [ 'label' => __( 'Focused Point Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item.is--focused .timeline-item__point' => 'color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'point_background_focused', [ 'label' => __( 'Focused Point Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-timeline {{CURRENT_ITEM}}.timeline-item.is--focused .timeline-item__point' => 'background-color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'card_foreground_focused', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item.is--focused .timeline-item__content *' => 'color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'card_background_focused', [ 'label' => __( 'Focused Card Background', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item.is--focused .timeline-item__content-wrapper' => 'background-color: {{VALUE}};', '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item.is--focused .timeline-item__card__arrow::after' => 'border-left-color: {{VALUE}}; border-right-color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'date_color_focused', [ 'label' => __( 'Focused Date Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item.is--focused .timeline-item__meta' => 'color: {{VALUE}};', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->add_control( 'point_size_focused', [ 'label' => __( 'Focused Point Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0.5, 'max' => 2, 'step' => 0.01 ], ], 'selectors' => [ // Item '{{WRAPPER}} {{CURRENT_ITEM}}.timeline-item.is--focused .timeline-item__point' => 'transform: scale({{SIZE}})', ], 'conditions' => [ 'terms' => [ [ 'name' => 'custom_style', 'operator' => '==', 'value' => 'yes', ], ], ], ] ); $repeater->end_controls_tab(); $repeater->end_controls_tabs(); $this->add_control( 'items', [ 'label' => __( 'Items', 'elementor-extras' ), 'type' => Controls_Manager::REPEATER, 'default' => [ [ 'date' => __( 'February 2, 2014', 'elementor-extras' ) ], [ 'date' => __( 'May 10, 2015', 'elementor-extras' ) ], [ 'date' => __( 'June 21, 2016', 'elementor-extras' ) ], ], 'fields' => $repeater->get_controls(), 'title_field' => '{{{ date }}}', 'condition' => [ 'source' => 'custom' ] ] ); $this->end_controls_section(); } protected function _register_controls() { $posts_control_settings = [ 'label' => __( 'Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'custom', 'options' => [ 'custom' => __( 'Custom', 'elementor-extras' ), ], ]; if ( is_elementor_pro_active() ) { $posts_control_settings[ 'options' ][ 'posts' ] = __( 'Posts', 'elementor-extras' ); } $this->start_controls_section( 'section_settings', [ 'label' => __( 'Settings', 'elementor-extras' ), ] ); $this->add_control( 'source', $posts_control_settings ); if ( ! is_elementor_pro_active() ) { $this->add_control( 'posts_go_pro', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => Utils::get_elementor_pro_locked_html(), 'condition' => [ 'source' => 'posts' ] ] ); } else if ( is_elementor_pro_active() ) { $this->add_control( 'post_skin', [ 'label' => __( 'Post Skin', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), 'template' => __( 'Template', 'elementor-extras' ), ], 'condition' => [ 'source' => 'posts', ], ] ); $this->add_control( 'post_skin_template', [ 'label' => __( 'Post Template', 'elementor-extras' ), 'type' => 'ee-query', 'query_type' => 'templates', 'label_block' => false, 'multiple' => false, 'condition' => [ 'post_skin' => 'template', 'source' => 'posts', ], ] ); $this->add_control( 'posts_per_page', [ 'label' => __( 'Posts Per Page', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 6, 'condition' => [ 'source' => 'posts' ] ] ); } $this->add_control( 'card_links', [ 'label' => __( 'Enable Links', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'description' => __( 'Enable links at card level. If you have links inside the content of a card, make sure you have this disabled. Links within links are not allowed.', 'elementor-extras' ), 'condition' => [ 'source' => 'posts', ] ] ); $this->end_controls_section(); $this->register_items_controls(); if ( is_elementor_pro_active() ) { $this->register_query_content_controls([ 'source' => 'posts', ]); } $this->start_controls_section( 'section_posts', [ 'label' => __( 'Posts', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, 'condition' => [ 'source' => 'posts', ] ] ); $this->add_control( 'date_heading', [ 'label' => __( 'Date', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'source' => 'posts', ] ] ); $this->add_control( 'date_source', [ 'label' => __( 'Date Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => __( 'Post Date', 'elementor-extras' ), 'custom' => __( 'Custom', 'elementor-extras' ), ], 'condition' => [ 'source' => 'posts', ], 'default' => '', ] ); $this->add_control( 'date_custom', [ 'label' => __( 'Date', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'label_block' => false, 'dynamic' => [ 'active' => true, 'loop' => true, ], 'condition' => [ 'source' => 'posts', 'date_source' => 'custom', ], ] ); $this->add_control( 'date_format', [ 'label' => __( 'Date Format', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), '' => __( 'None', 'elementor-extras' ), 'F j, Y' => date( 'F j, Y' ), 'Y-m-d' => date( 'Y-m-d' ), 'm/d/Y' => date( 'm/d/Y' ), 'd/m/Y' => date( 'd/m/Y' ), 'custom' => __( 'Custom', 'elementor-extras' ), ], 'condition' => [ 'source' => 'posts', 'date_source' => '', ], 'default' => 'default', ] ); $this->add_control( 'time_format', [ 'label' => __( 'Time Format', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), '' => __( 'None', 'elementor-extras' ), 'g:i a' => date( 'g:i a' ), 'g:i A' => date( 'g:i A' ), 'H:i' => date( 'H:i' ), ], 'default' => 'default', 'condition' => [ 'source' => 'posts', 'date_source' => '', 'date_format!' => 'custom', ], ] ); $this->add_control( 'date_custom_format', [ 'label' => __( 'Custom Format', 'elementor-extras' ), 'default' => get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), 'description' => sprintf( '<a href="https://codex.wordpress.org/Formatting_Date_and_Time" target="_blank">%s</a>', __( 'Documentation on date and time formatting', 'elementor-extras' ) ), 'condition' => [ 'source' => 'posts', 'date_format' => 'custom', ], ] ); $this->add_control( 'post_title_heading', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'source' => 'posts', 'post_skin' => 'default', ] ] ); $this->add_control( 'post_title', [ 'label' => __( 'Show Title', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'source' => 'posts', 'post_skin' => 'default', ] ] ); $this->add_control( 'post_title_source', [ 'label' => __( 'Title Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => __( 'Post Title', 'elementor-extras' ), 'custom' => __( 'Custom', 'elementor-extras' ), ], 'condition' => [ 'source' => 'posts', 'post_skin' => 'default', 'post_title!' => '', ], 'default' => '', ] ); $this->add_control( 'post_title_custom', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'label_block' => false, 'dynamic' => [ 'active' => true, 'loop' => true, ], 'condition' => [ 'source' => 'posts', 'post_skin' => 'default', 'post_title!' => '', 'post_title_source' => 'custom', ], ] ); $this->add_control( 'post_title_element', [ 'label' => __( 'HTML Element', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => __( 'H1', 'elementor-extras' ), 'h2' => __( 'H2', 'elementor-extras' ), 'h3' => __( 'H3', 'elementor-extras' ), 'h4' => __( 'H4', 'elementor-extras' ), 'h5' => __( 'H5', 'elementor-extras' ), 'h6' => __( 'H6', 'elementor-extras' ), 'div' => __( 'div', 'elementor-extras' ), 'span' => __( 'span', 'elementor-extras' ), ], 'default' => 'h2', 'condition' => [ 'source' => 'posts', 'post_skin' => 'default', 'post_title!' => '', ], ] ); $this->add_control( 'post_excerpt_heading', [ 'label' => __( 'Excerpt', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'source' => 'posts', 'post_skin' => 'default', ] ] ); $this->add_control( 'post_excerpt', [ 'label' => __( 'Excerpt Source', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => __( 'Hide', 'elementor-extras' ), 'yes' => __( 'Post Excerpt', 'elementor-extras' ), 'content' => __( 'Post Content', 'elementor-extras' ), 'custom' => __( 'Custom', 'elementor-extras' ), ], 'default' => 'yes', 'condition' => [ 'source' => 'posts', 'post_skin' => 'default', ], ] ); $this->add_control( 'post_excerpt_custom', [ 'label' => __( 'Excerpt', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'label_block' => false, 'dynamic' => [ 'active' => true, 'loop' => true, ], 'condition' => [ 'source' => 'posts', 'post_skin' => 'default', 'post_excerpt' => 'custom', ], ] ); $this->add_control( 'post_excerpt_trim_custom', [ 'label' => __( 'Trim Custom Excerpts', 'elementor-extras' ), 'description' => __( 'Custom excerpts are set manually in the Excerpt field for each post. Enable this if you want to trim those down to the above length as well.' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'condition' => [ 'post_excerpt' => 'yes', 'post_skin' => 'default', ], ] ); $this->add_control( 'post_excerpt_length', [ 'label' => __( 'Excerpt Length', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => apply_filters( 'excerpt_length', 25 ), 'condition' => [ 'post_excerpt' => 'yes', 'post_skin' => 'default', ], ] ); $this->add_control( 'post_excerpt_more', [ 'label' => __( 'Trimmed Suffix', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '…', 'condition' => [ 'post_excerpt' => 'yes', 'post_skin' => 'default', ], ] ); $this->add_control( 'post_thumbnail_heading', [ 'label' => __( 'Thumbnail', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'source' => 'posts', 'post_skin' => 'default', ] ] ); $this->add_control( 'post_thumbnail', [ 'label' => __( 'Show Image', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'source' => 'posts', 'post_skin' => 'default', ] ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'post_thumbnail_size', 'label' => __( 'Image Size', 'elementor-extras' ), 'default' => 'medium', 'prefix_class' => 'elementor-portfolio--thumbnail-size-', 'condition' => [ 'source' => 'posts', 'post_thumbnail' => 'yes', 'post_skin' => 'default', ] ] ); if ( is_woocommerce_active() ) { $this->add_control( 'post_product_heading', [ 'label' => __( 'Products', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'source' => 'posts', 'posts_post_type' => 'product', 'post_skin' => 'default', ] ] ); $this->add_control( 'post_buy', [ 'label' => __( 'Buy Button', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'card_links!' => 'yes', 'posts_post_type' => 'product', 'post_skin' => 'default', ] ] ); $this->add_control( 'post_product_attributes', [ 'label' => __( 'Show Attributes', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'source' => 'posts', 'posts_post_type' => 'product', 'post_skin' => 'default', ] ] ); $this->add_control( 'post_product_attributes_exclude', [ 'label' => __( 'Exclude attributes', 'elementor-extras' ), 'description' => __( 'Enter attribute slugs, names or ids, separated by commas', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'condition' => [ 'source' => 'posts', 'posts_post_type' => 'product', 'post_skin' => 'default', ] ] ); } $this->end_controls_section(); $this->start_controls_section( 'section_layout', [ 'label' => __( 'Layout', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'align', [ 'label' => __( 'Horizontal Align', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'label_block' => true, 'default' => 'center', 'tablet_default'=> 'left', 'mobile_default'=> 'left', 'options' => [ 'left' => __( 'Left', 'elementor-extras' ), 'center' => __( 'Center', 'elementor-extras' ), 'overlay' => __( 'Overlay', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'prefix_class' => 'ee-timeline-align%s--', ] ); $this->add_control( 'reverse', [ 'label' => __( 'Reverse Cards Positions', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'align' => [ 'center' ], ], ] ); $this->add_responsive_control( 'cards_align', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'label_block' => true, 'default' => 'top', 'tablet_default'=> 'top', 'mobile_default'=> 'top', 'options' => [ 'top' => __( 'Top', 'elementor-extras' ), 'middle' => __( 'Middle', 'elementor-extras' ), 'bottom' => __( 'Bottom', 'elementor-extras' ), ], 'prefix_class' => 'ee-timeline-cards-align%s--', ] ); $this->add_responsive_control( 'horizontal_spacing', [ 'label' => __( 'Horizontal Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item .timeline-item__point' => 'margin-left: {{SIZE}}px; margin-right: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'vertical_spacing', [ 'label' => __( 'Vertical Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-timeline .ee-timeline__item, {{WRAPPER}}.ee-timeline-align--overlay .timeline-item__point' => 'margin-bottom: {{SIZE}}px;', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_images', [ 'label' => __( 'Images', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'post_skin' => 'default', ], ] ); $this->add_control( 'cards_images_align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'left', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item .timeline-item__img' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'cards_images_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item .timeline-item__img' => 'margin-bottom: {{SIZE}}px;', ], ] ); $this->add_control( 'images_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item__img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_posts_style', [ 'label' => __( 'Posts', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'source' => 'posts', 'post_skin' => 'default', ] ] ); $this->add_control( 'titles_heading', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'source' => 'posts', 'post_title!' => '', ] ] ); $this->add_control( 'title_color', [ 'label' => __( 'Title Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item__title a' => 'color: {{VALUE}};', ], 'condition' => [ 'source' => 'posts', 'post_title!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'titles_typography', 'selector' => '{{WRAPPER}} .ee-timeline .timeline-item__title', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_SECONDARY, ], 'condition' => [ 'source' => 'posts', 'post_title!' => '', ], ] ); $this->add_control( 'titles_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item__title' => 'margin-bottom: {{SIZE}}px;', ], 'condition' => [ 'source' => 'posts', 'post_title!' => '', ], ] ); $this->add_control( 'excerpt_heading', [ 'label' => __( 'Excerpt', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'source' => 'posts', 'post_excerpt!' => '', ] ] ); $this->add_control( 'excerpt_color', [ 'label' => __( 'Excerpt Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item__excerpt' => 'color: {{VALUE}};', ], 'condition' => [ 'source' => 'posts', 'post_excerpt!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'excerpt_typography', 'selector' => '{{WRAPPER}} .ee-timeline .timeline-item__excerpt', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'condition' => [ 'source' => 'posts', 'post_excerpt!' => '', ] ] ); $this->add_responsive_control( 'excerpt_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item__excerpt' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'source' => 'posts', 'post_excerpt!' => '', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_cards', [ 'label' => __( 'Cards', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'cards_padding', [ 'label' => __( 'Card Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item__content-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'cards_margin', [ 'label' => __( 'Card Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item__card' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'cards_content_padding', [ 'label' => __( 'Content Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item__content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'cards_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item__content-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'animate_in', [ 'label' => __( 'Animate Cards', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'animate', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'animate', 'prefix_class' => 'ee-timeline%s-' ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'cards', 'selector' => '{{WRAPPER}} .timeline-item__content-wrapper, {{WRAPPER}} .timeline-item__content__wysiwyg *, {{WRAPPER}} .timeline-item__title, {{WRAPPER}} .timeline-item__meta, {{WRAPPER}} .timeline-item__excerpt, {{WRAPPER}} .timeline-item__card__arrow::after', 'separator' => '', ] ); $this->start_controls_tabs( 'tabs_cards' ); $this->start_controls_tab( 'tab_cards_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_responsive_control( 'cards_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .timeline-item__content-wrapper, {{WRAPPER}} .timeline-item__content-wrapper *' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'cards_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .timeline-item__content-wrapper' => 'background-color: {{VALUE}};', '{{WRAPPER}} .timeline-item__card .timeline-item__card__arrow::after' => 'border-left-color: {{VALUE}}; border-right-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'cards_box_shadow', 'selector' => '{{WRAPPER}} .timeline-item__content-wrapper', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_cards_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_responsive_control( 'cards_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .timeline-item:hover .timeline-item__content-wrapper, {{WRAPPER}} .timeline-item:hover .timeline-item__content-wrapper *' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'cards_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .timeline-item:not(.is--focused):hover .timeline-item__content-wrapper' => 'background-color: {{VALUE}};', '{{WRAPPER}} .timeline-item:not(.is--focused):hover .timeline-item__card .timeline-item__card__arrow::after' => 'border-left-color: {{VALUE}}; border-right-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'cards_box_shadow_hover', 'selector' => '{{WRAPPER}} .timeline-item:hover .timeline-item__content-wrapper', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_cards_focused', [ 'label' => __( 'Focused', 'elementor-extras' ) ] ); $this->add_responsive_control( 'cards_color_focused', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .timeline-item.is--focused .timeline-item__content-wrapper, {{WRAPPER}} .timeline-item.is--focused .timeline-item__content-wrapper *' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'cards_background_color_focused', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .timeline-item.is--focused .timeline-item__content-wrapper' => 'background-color: {{VALUE}};', '{{WRAPPER}} .timeline-item.is--focused .timeline-item__card__arrow::after' => 'border-left-color: {{VALUE}}; border-right-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'cards_box_shadow_focused', 'selector' => '{{WRAPPER}} .timeline-item.is--focused .timeline-item__content-wrapper', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'cards_text_shadow', 'selector' => '{{WRAPPER}} .ee-timeline .timeline-item__content-wrapper', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'cards_typography', 'selector' => '{{WRAPPER}} .ee-timeline .timeline-item__content-wrapper', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'condition' => [ 'post_skin' => 'default', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_dates', [ 'label' => __( 'Dates', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'dates_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item__meta' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'dates_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item__meta' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'dates_text_shadow', 'selector' => '{{WRAPPER}} .ee-timeline .timeline-item__meta', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'dates_typography', 'selector' => '{{WRAPPER}} .ee-timeline .timeline-item__meta', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_ACCENT, ], ] ); $this->start_controls_tabs( 'tabs_dates_style' ); $this->start_controls_tab( 'tab_dates_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_responsive_control( 'dates_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-timeline .timeline-item__meta' => 'color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_dates_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_responsive_control( 'dates_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-timeline .ee-timeline__item:hover .timeline-item__meta' => 'color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_dates_focused', [ 'label' => __( 'Focused', 'elementor-extras' ) ] ); $this->add_responsive_control( 'dates_color_focused', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-timeline .ee-timeline__item.is--focused .timeline-item__meta' => 'color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_points', [ 'label' => __( 'Points', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'points_content', [ 'label' => __( 'Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'icons', 'options' => [ 'icons' => __( 'Icons', 'elementor-extras' ), 'numbers' => __( 'Numbers', 'elementor-extras' ), 'letters' => __( 'Letters', 'elementor-extras' ), ], ] ); $this->add_control( 'selected_global_icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'global_icon', 'default' => [ 'value' => 'fas fa-calendar-alt', 'library' => 'fa-solid', ], 'condition' => [ 'points_content' => 'icons', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'points_typography', 'selector' => '{{WRAPPER}} .ee-timeline .timeline-item__point', 'exclude' => [ 'font_size' ], 'condition' => [ 'points_content!' => 'icons', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'points', 'selector' => '{{WRAPPER}} .timeline-item__point', 'separator' => '', ] ); $this->start_controls_tabs( 'tabs_points' ); $this->start_controls_tab( 'points_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_responsive_control( 'points_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 40, ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 80, ], ], 'selectors' => [ '{{WRAPPER}} .timeline-item__point' => 'width: {{SIZE}}px; height: {{SIZE}}px', '{{WRAPPER}} .timeline-item__card__arrow' => 'height: {{SIZE}}px;', '{{WRAPPER}} .ee-timeline-align--left .ee-timeline__line' => 'margin-left: calc( {{SIZE}}px / 2 );', '{{WRAPPER}} .ee-timeline-align--right .ee-timeline__line' => 'margin-right: calc( {{SIZE}}px / 2 );', '(tablet){{WRAPPER}} .ee-timeline-align--center .ee-timeline__line' => 'margin-left: calc( {{points_size_tablet.SIZE}}px / 2 );', '(mobile){{WRAPPER}} .ee-timeline-align--center .ee-timeline__line' => 'margin-left: calc( {{points_size_mobile.SIZE}}px / 2 );', ], ] ); $this->add_responsive_control( 'icons_size', [ 'label' => __( 'Icon Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'step' => 0.1, 'min' => 1, 'max' => 4, ], ], 'selectors' => [ '{{WRAPPER}} .timeline-item__point' => 'font-size: {{SIZE}}em', ], 'condition' => [ 'points_content' => 'icons' ] ] ); $this->add_responsive_control( 'content_size', [ 'label' => __( 'Content Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 4, ], ], 'selectors' => [ '{{WRAPPER}} .timeline-item__point__text' => 'font-size: {{SIZE}}em', ], 'condition' => [ 'points_content!' => 'icons' ] ] ); $this->add_control( 'points_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_SECONDARY, ], 'selectors' => [ '{{WRAPPER}} .timeline-item .timeline-item__point' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'icons_color', [ 'label' => __( 'Points Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .timeline-item .timeline-item__point' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'points_text_shadow', 'selector' => '{{WRAPPER}} .timeline-item .timeline-item__point', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'points_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'points_size_hover', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'min' => 0.5, 'max' => 2, 'step' => 0.01 ], ], 'selectors' => [ // General '{{WRAPPER}} .timeline-item:not(.is--focused):hover .timeline-item__point, {{WRAPPER}} .timeline-item:not(.is--focused):hover .timeline-item__point' => 'transform: scale({{SIZE}})', ], ] ); $this->add_control( 'points_background_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .timeline-item:not(.is--focused):hover .timeline-item__point, {{WRAPPER}} .timeline-item:not(.is--focused):hover .timeline-item__point' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'icons_color_hover', [ 'label' => __( 'Points Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .timeline-item:not(.is--focused):hover .timeline-item__point, {{WRAPPER}} .timeline-item:not(.is--focused):hover .timeline-item__point' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'points_text_shadow_hover', 'selector' => '{{WRAPPER}} .timeline-item:not(.is--focused):hover .timeline-item__point, {{WRAPPER}} .timeline-item:hover .timeline-item__point' ] ); $this->end_controls_tab(); $this->start_controls_tab( 'points_focused', [ 'label' => __( 'Focused', 'elementor-extras' ) ] ); $this->add_control( 'points_size_focused', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 1, ], 'range' => [ 'px' => [ 'min' => 0.5, 'max' => 2, 'step' => 0.01 ], ], 'selectors' => [ '{{WRAPPER}} .timeline-item.is--focused .timeline-item__point' => 'transform: scale({{SIZE}})', ], ] ); $this->add_control( 'points_background_focused', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .timeline-item.is--focused .timeline-item__point' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'icons_color_focused', [ 'label' => __( 'Points Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} .timeline-item.is--focused .timeline-item__point' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'points_text_shadow_focused', 'selector' => '{{WRAPPER}} .timeline-item.is--focused .timeline-item__point', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_line', [ 'label' => __( 'Line', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'line_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_SECONDARY, ], 'selectors' => [ '{{WRAPPER}} .ee-timeline__line' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'progress_background', [ 'label' => __( 'Progress Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-timeline__line__inner' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'line_thickness', [ 'label' => __( 'Thickness', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 4, ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 8, ], ], 'selectors' => [ '{{WRAPPER}} .ee-timeline__line' => 'width: {{SIZE}}px;', ], ] ); $this->add_control( 'line_location', [ 'label' => __( 'Location', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 50, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'frontend_available' => true, ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'line_border', 'label' => __( 'Image Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-timeline__line', ] ); $this->add_control( 'line_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-timeline__line' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); } protected function add_global_render_attributes() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'wrapper' => [ 'class' => [ 'ee-timeline', 'ee-timeline--vertical', ], ], 'item' => [ 'class' => [ 'ee-timeline__item', 'timeline-item', ], ], 'icon-wrapper' => [ 'class' => [ 'ee-icon', 'ee-icon-support--svg', 'ee-timeline__item__icon', ], ], 'line' => [ 'class' => 'ee-timeline__line', ], 'line-inner' => [ 'class' => 'ee-timeline__line__inner', ], 'card-wrapper' => [ 'class' => 'timeline-item__card-wrapper', ], 'point' => [ 'class' => 'timeline-item__point', ], 'meta' => [ 'class' => 'timeline-item__meta', ], 'image' => [ 'class' => [ 'timeline-item__img', 'ee-post__thumbnail', ], ], 'content-wrapper' => [ 'class' => 'timeline-item__content-wrapper', ], 'content' => [ 'class' => 'timeline-item__content', ], 'post-title' => [ 'class' => 'timeline-item__title', ], 'post-excerpt' => [ 'class' => 'timeline-item__excerpt', ], 'arrow' => [ 'class' => 'timeline-item__card__arrow', ], 'meta-wrapper' => [ 'class' => 'timeline-item__meta-wrapper', ], ] ); if ( 'posts' === $settings['source'] && 'content' === $settings['post_excerpt'] ) { $this->add_render_attribute( 'post-excerpt', 'class', 'timeline-item__excerpt--content' ); } } /** * Render * * Render widget contents on frontend * * @since 1.9.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); $this->add_global_render_attributes(); ?><section <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>><?php $this->render_line(); if ( 'yes' === $settings['reverse'] ) { ?><span></span><?php } call_user_func( [ $this, 'render_' . $settings['source'] . '_cards' ] ); ?></section><?php } /** * Render Custom Cards * * Renders markup for custom cards * * @since 1.9.0 * @return void */ protected function render_custom_cards() { $settings = $this->get_settings_for_display(); foreach ( $settings['items'] as $index => $item ) { $card_tag = 'div'; $item_key = $this->get_repeater_setting_key( 'item', 'items', $index ); $card_key = $this->get_repeater_setting_key( 'card', 'items', $index ); $point_content = ''; $this->add_render_attribute( [ $item_key => [ 'class' => [ 'elementor-repeater-item-' . $item['_id'], 'ee-timeline__item', 'timeline-item', ], ], $card_key => [ 'class' => 'timeline-item__card', ], ] ); if ( ! empty( $item['link']['url'] ) ) { $card_tag = 'a'; $this->add_render_attribute( $card_key, 'href', $item['link']['url'] ); if ( $item['link']['is_external'] ) { $this->add_render_attribute( $card_key, 'target', '_blank' ); } if ( $item['link']['nofollow'] ) { $this->add_render_attribute( $card_key, 'rel', 'nofollow' ); } } if ( ( 'yes' === $item['custom_style'] && '' !== $item['point_content_type'] ) ) { $point_content_type = $item['point_content_type']; } else { $point_content_type = $settings['points_content']; } switch( $point_content_type ) { case 'numbers' : case 'letters' : $point_content = $this->get_point_text( $point_content_type, $index, $item ); break; default: $point_content = $this->get_point_icon( $item ); } ?><div <?php echo $this->get_render_attribute_string( $item_key ); ?>> <div <?php echo $this->get_render_attribute_string( 'point' ); ?>><?php echo $point_content; ?></div> <div <?php echo $this->get_render_attribute_string( 'card-wrapper' ); ?>> <<?php echo $card_tag; ?> <?php echo $this->get_render_attribute_string( $card_key ); ?>> <div <?php echo $this->get_render_attribute_string( 'content-wrapper' ); ?>><?php $this->render_image( $item ); $this->render_custom_card_content( $index, $item ); ?></div><?php $this->render_card_arrow(); ?></<?php echo $card_tag; ?>> </div> <div <?php echo $this->get_render_attribute_string( 'meta-wrapper' ); ?>><?php $this->render_custom_card_meta( $index, $item ); ?></div> </div><?php } } /** * Render Custom Card Content * * @since 2.5.0 * @return void */ protected function render_custom_card_content( $index, $item ) { $wysiwyg_key = $this->get_repeater_setting_key( 'content', 'items', $index ); $this->add_inline_editing_attributes( $wysiwyg_key, 'advanced' ); $this->add_render_attribute([ $wysiwyg_key => [ 'class' => 'timeline-item__content__wysiwyg', ], ]); if ( '' !== $item['content'] ) { ?><div <?php echo $this->get_render_attribute_string( 'content' ); ?>><?php $this->render_custom_card_meta( $index, $item ); ?><div <?php echo $this->get_render_attribute_string( $wysiwyg_key ); ?>> <?php echo $this->parse_text_editor( $item['content'] ); ?> </div> </div><?php } } /** * Render Custom Card Meta * * @since 2.5.0 * @return void */ protected function render_custom_card_meta( $index, $item ) { $meta_key = $this->get_repeater_setting_key( 'date', 'items', $index ); $this->add_inline_editing_attributes( $meta_key, 'basic' ); $this->add_render_attribute([ $meta_key => [ 'class' => [ 'timeline-item__meta', 'meta', ], ], ]); ?><!-- meta --> <div <?php echo $this->get_render_attribute_string( $meta_key ); ?>> <?php echo $this->parse_text_editor( $item['date'] ); ?> </div><?php } /** * Render Posts Cards * * Loops through the posts and renders markup for each post card * * @since 2.1.0 */ protected function render_posts_cards() { $this->query_posts(); $wp_query = $this->get_query(); if ( ! $wp_query->found_posts ) return; // Set the dynamic settings for the loop $this->set_settings_for_loop( $wp_query ); add_filter( 'excerpt_more', [ $this, 'custom_excerpt_more_filter' ], 999 ); add_filter( 'excerpt_length', [ $this, 'custom_excerpt_length' ], 999 ); while ( $wp_query->have_posts() ) { $wp_query->the_post(); $this->render_post_card( $wp_query->current_post ); } remove_filter( 'excerpt_more', [ $this, 'custom_excerpt_more_filter' ], 999 ); remove_filter( 'excerpt_length', [ $this, 'custom_excerpt_length' ], 99 ); wp_reset_postdata(); } /** * Render Post Card * * @since 1.9.0 * @param int $index */ protected function render_post_card( $index ) { $post_id = get_the_ID(); $settings = $this->get_settings(); $card_tag = 'div'; $point_content = ''; $card_key = $this->get_repeater_setting_key( 'card', 'content', $index ); $this->add_render_attribute( [ $card_key => [ 'class' => [ 'timeline-item__card', implode( ' ', get_post_class() ), ], ], ] ); if ( 'yes' === $settings['card_links'] ) { $card_tag = 'a'; $this->add_render_attribute( $card_key, 'href', get_permalink() ); } switch ( $settings['points_content'] ) { case 'numbers' : case 'letters' : $point_content = $this->get_point_text( $settings['points_content'], $index ); break; default: $point_content = $this->get_point_icon(); } ?><div <?php echo $this->get_render_attribute_string( 'item' ); ?>> <div <?php echo $this->get_render_attribute_string( 'point' ); ?>> <?php echo $point_content; ?> </div> <div <?php echo $this->get_render_attribute_string( 'card-wrapper' ); ?>> <<?php echo $card_tag; ?> <?php echo $this->get_render_attribute_string( $card_key ); ?>> <div <?php echo $this->get_render_attribute_string( 'content-wrapper' ); ?>><?php call_user_func( [ $this, 'render_post_' . $settings['post_skin'] . '_card_content' ] ); $this->render_card_arrow(); ?></div> </<?php echo $card_tag; ?>> </div> <div <?php echo $this->get_render_attribute_string( 'meta-wrapper' ); ?>> <div <?php echo $this->get_render_attribute_string( 'meta' ); ?>> <?php $this->render_date( true, $post_id ); ?> </div> </div> </div> <?php } /** * Render Posts Template Card Content * * @since 2.2.0 */ protected function render_post_template_card_content() { TemplatesControl::render_template_content( $this->get_settings( 'post_skin_template' ), $this, true ); } /** * Render Post Default Card Content * * @since 2.2.0 */ protected function render_post_default_card_content() { $settings = $this->get_settings(); $this->render_image(); ?><div <?php echo $this->get_render_attribute_string( 'content' ); ?>><?php if ( 'product' !== $settings['posts_post_type'] ) { ?><div <?php echo $this->get_render_attribute_string( 'meta' ); ?>> <?php echo $this->render_date( false ); ?> </div><?php } if ( $settings['post_title'] === 'yes' ) { $this->render_title( 'yes' !== $settings['card_links'] ); } if ( is_woocommerce_active() && $settings['post_product_attributes'] === 'yes' && $settings['card_links'] !== 'yes' ) { $this->render_product_attributes(); } if ( '' !== $settings['post_excerpt'] ) { ?><div <?php echo $this->get_render_attribute_string( 'post-excerpt' ); ?>><?php switch ( $settings['post_excerpt'] ) { case 'content': the_content(); break; default: $this->render_post_excerpt(); break; } ?></div><?php } if ( is_woocommerce_active() && $settings['post_buy'] === 'yes' && $settings['card_links'] !== 'yes' ) { echo do_shortcode('[add_to_cart id="' . get_the_ID() . '" style="border:0px;padding:0px"]'); } ?></div><?php } /** * Render Point Text * * @since 1.9.0 */ protected function get_point_text( $type, $index = false, $item = false ) { $settings = $this->get_settings(); $letters = range('A', 'Z'); $point_key = ( $item ) ? $this->get_repeater_setting_key( 'icon', 'items', $index ) : 'point-text'; $text = 0; $text = ( $type === 'numbers' ) ? $index + 1 : $letters[ $index ]; if ( $item ) { if ( $item['custom_style'] === 'yes' && '' !== $item['point_content'] ) { $text = $item['point_content']; } } $this->add_render_attribute( $point_key, 'class', 'timeline-item__point__text' ); $output = '<div ' . $this->get_render_attribute_string( $point_key ) . '>' . $text . '</div>'; return $output; } /** * Render Point Icon * * @since 1.9.0 */ protected function get_point_icon( $item = false ) { $settings = $this->get_settings(); $global_icon_migrated = isset( $item['__fa4_migrated']['selected_global_icon'] ); $global_icon_is_new = empty( $item['global_icon'] ) && Icons_Manager::is_migration_allowed(); $has_global_icon = ! empty( $settings['global_icon'] ) || ! empty( $settings['selected_global_icon']['value'] ); if ( $item ) { $has_item_icon = ! empty( $item['icon'] ) || ! empty( $item['selected_icon']['value'] ); $item_icon_migrated = isset( $item['__fa4_migrated']['selected_icon'] ); $item_icon_is_new = empty( $item['icon'] ) && Icons_Manager::is_migration_allowed(); } $output = '<span ' .$this->get_render_attribute_string( 'icon-wrapper' ) . '>'; $icon_markup = '<i class="%s timeline-item__point__icon" aria-hidden="true"></i>'; if ( $item && '' !== $item['custom_style'] && $has_item_icon && '' !== $item['point_content_type'] ) { if ( $item_icon_is_new || $item_icon_migrated ) { $output .= $this->get_library_point_icon( $item['selected_icon'] ); } else { $output .= sprintf( $icon_markup, $item['icon'] ); } } else if ( $has_global_icon ) { if ( $global_icon_is_new || $global_icon_migrated ) { $output .= $this->get_library_point_icon( $settings['selected_global_icon'] ); } else { $output .= sprintf( $icon_markup, $settings['global_icon'] ); } } $output .= '</span>'; return $output; } /** * Render Line * * @since 2.1.5 */ protected function get_library_point_icon( $setting ) { ob_start(); Icons_Manager::render_icon( $setting, [ 'aria-hidden' => 'true' ] ); return ob_get_clean(); } /** * Render Line * * @since 1.9.0 */ protected function render_line() { ?><div <?php echo $this->get_render_attribute_string( 'line' ); ?>> <div <?php echo $this->get_render_attribute_string( 'line-inner' ); ?>></div> </div><?php } /** * Render Card Arrow * * @since 1.9.0 */ protected function render_card_arrow() { ?><div <?php echo $this->get_render_attribute_string( 'arrow' ); ?>></div><?php } /** * Render Product Attributes * * @since 1.9.0 */ protected function render_product_attributes() { global $post; $product = wc_get_product( get_the_ID() ); if ( ! $product ) return; if ( ! $product->has_attributes() ) return; echo '<table class="shop_attributes">'; echo '<tbody>'; $attributes = $product->get_attributes(); $excluded_attributes = $this->get_settings( 'post_product_attributes_exclude' ); $excluded_attributes = array_map( 'trim', explode(',', strtolower( $excluded_attributes ) ) ); foreach ($attributes as $attribute) { $label = wc_attribute_label( $attribute->get_name() ); $id = $attribute->get_id(); if ( ! empty( $excluded_attributes ) && ( in_array( strtolower( $label ), $excluded_attributes ) || in_array( strtolower( $id ), $excluded_attributes ) || ( ! empty( $id ) && in_array( $id, $excluded_attributes ) ) ) ) continue; $values = array(); if ( $attribute->is_taxonomy() ) { $attribute_taxonomy = $attribute->get_taxonomy_object(); $attribute_values = wc_get_product_terms( $product->get_id(), $attribute->get_name(), array( 'fields' => 'all' ) ); foreach ( $attribute_values as $attribute_value ) { $value_name = esc_html( $attribute_value->name ); $values[] = $value_name; } } else { $values = $attribute->get_options(); foreach ( $values as &$value ) { $value = make_clickable( esc_html( $value ) ); } } echo '<tr>'; echo '<th>' . $label . '</th>'; echo '<td>' . apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values ) . '</td>'; echo '</tr>'; } echo '</tbody>'; echo '</table>'; } /** * Render Image * * @since 2.1.0 */ protected function render_image( $item = false ) { call_user_func( [ $this, 'render_' . $this->get_settings('source') . '_thumbnail' ], $item ); } /** * Render Custom Thumbnail * * @since 2.1.0 */ protected function render_custom_thumbnail( $item ) { if ( '' === $item['image']['url'] ) return; ?><div <?php echo $this->get_render_attribute_string( 'image' ); ?>><?php echo Group_Control_Image_Size::get_attachment_image_html( $item ); ?></div><?php } /** * Render Thumbnail * * @since 1.9.0 */ protected function render_posts_thumbnail() { global $post; $settings = $this->get_settings_for_display(); if ( ! has_post_thumbnail() || '' === $settings['post_thumbnail'] ) return; $settings['post_thumbnail_size'] = [ 'id' => get_post_thumbnail_id(), ]; ?><div <?php echo $this->get_render_attribute_string( 'image' ); ?>><?php if ( '' === $settings['card_links'] ) { ?><a href="<?php echo the_permalink(); ?>"><?php } echo Group_Control_Image_Size::get_attachment_image_html( $settings, 'post_thumbnail_size' ); if ( '' === $settings['card_links'] ) { ?></a><?php } ?></div><?php } /** * Render Post Excerpt * * @since 1.9.0 */ protected function render_post_excerpt() { $settings = $this->get_settings_for_display(); $loop_settings = $this->get_settings_for_loop_display( get_the_ID() ); $post_excerpt = 'custom' === $settings['post_excerpt'] ? $loop_settings['post_excerpt_custom'] : get_the_excerpt(); if ( 'yes' === $this->get_settings( 'post_excerpt_trim_custom' ) ) { $post_excerpt = wp_trim_words( $post_excerpt, $this->custom_excerpt_length(), $this->custom_excerpt_more() ); } echo $post_excerpt; } /** * Applies the custom excerpt length * * @since 1.9.0 */ public function custom_excerpt_length() { return $this->get_settings( 'post_excerpt_length' ); } /** * Custom Excerpt More Filter * * Filter for setting the custom more suffix * * @since 2.2.0 */ public function custom_excerpt_more_filter( $more ) { return $this->get_settings( 'post_excerpt_more' ); } /** * Custom Excerpt More * * Returns the post excerpt more suffix text * * @since 1.9.0 */ public function custom_excerpt_more() { return $this->get_settings( 'post_excerpt_more' ); } /** * Render Title * * @since 1.9.0 */ protected function render_title( $link = true, $echo = true ) { global $post; $settings = $this->get_settings_for_display(); $loop_settings = $this->get_settings_for_loop_display( get_the_ID() ); $title_before = ( $link ) ? '<a href="' . get_permalink() . '">' : ''; $title_after = ( $link ) ? '</a>' : ''; $title = 'custom' === $settings['post_title_source'] ? $loop_settings['post_title_custom'] : $post->post_title; ob_start(); ?><<?php echo $settings['post_title_element']; ?> <?php echo $this->get_render_attribute_string( 'post-title' ); ?>> <?php echo $title_before . $title . $title_after; ?> </<?php echo $settings['post_title_element']; ?>><?php $title = ob_get_clean(); if ( ! $echo ) { return $title; } echo $title; } /** * Render Date * * Outputs the date of the post * * @since 1.9.0 */ protected function render_date( $echo = true, $post_id = null ) { $settings = $this->get_settings_for_display(); $loop_settings = $this->get_settings_for_loop_display( $post_id ); if ( 'custom' === $settings['date_source'] ) { $date = $loop_settings[ 'date_custom' ]; } else { $custom = 'custom' === $settings['date_format']; $date = $this->get_date_formatted( $custom, $settings['date_custom_format'], $settings['date_format'], $settings['time_format'], $post_id ); } if ( ! $echo ) { return $date; } echo $date; } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 0.1.0 * @return void */ protected function content_template() {} } posts/module.php 0000644 00000006733 15112147616 0007727 0 ustar 00 <?php namespace ElementorExtras\Modules\Posts; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; use ElementorExtras\Modules\Posts\Widgets\Posts_Base; use ElementorPro\Modules\ThemeBuilder\Module as ThemeBuilder; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Posts\Module * * @since 1.6.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.6.0 * @return string */ public function get_name() { return 'posts'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.6.0 * @return array */ public function get_widgets() { return [ 'Posts', 'Timeline', ]; } /** * Get Content Parts * * Get the content parts * * @since 1.6.0 * @return array */ public static function get_content_parts() { $content_parts = [ 'terms', 'title', 'avatar', 'author', 'date', 'comments', // 'custom_fields', 'excerpt', 'button', ]; if ( is_woocommerce_active() ) { $content_parts[] = 'price'; } return $content_parts; } /** * Get Post Parts * * Get the post parts * * @since 1.6.0 * @return array */ public static function get_post_parts() { $post_parts = [ 'terms', 'title', 'excerpt', 'button', 'metas', ]; return $post_parts; } /** * Get Content Parts * * Get the post content parts * * @since 1.6.0 * @return array */ public static function get_content_post_parts() { $post_parts = [ 'terms', 'title', 'excerpt', 'button', ]; return $post_parts; } /** * Get Meta Parts * * Get the available metas * * @since 1.6.0 * @return array */ public static function get_meta_parts() { $meta_parts = [ 'author', 'date', 'comments', // 'custom_fields', ]; if ( is_woocommerce_active() ) { $meta_parts[] = 'price'; } return $meta_parts; } /** * Checks if current page applies for custom pagination handling * * @since 2.2.38 * @return array */ public static function is_custom_pagination() { return is_singular() && ! is_front_page() && ! is_singular('page'); } /** * Bypass WP 404 on singular custom pagination where * Wordpress is using the 'page' query var and * post content paging is not being used * * @since 2.2.38 * @return bool */ public function handle_pagination_404( $preempt, $wp_query ) { // Conditions leave our posts built with Elementor // since widgets can also be present on theme builder if ( ! $preempt && ! empty( $wp_query->query_vars['ee-page'] ) && self::is_custom_pagination() ) { $preempt = true; } return $preempt; } /** * Use our our query var and match it with * the single pagination 'page' query var * * @since 2.2.38 * @return array */ public function add_pagination_query_var( $request ) { if ( ! empty( $request['page'] ) && intval( $request['page'] ) > 1 ) { $request['ee-page'] = $request['page']; } return $request; } /** * Register custom pagination query var * * @since 2.2.38 * @return array */ public function register_pagination_query_var( $vars ) { $vars[] = 'ee-page'; return $vars; } public function __construct() { parent::__construct(); add_filter( 'query_vars', [ $this, 'register_pagination_query_var' ], 10, 1 ); add_filter( 'request', [ $this, 'add_pagination_query_var' ] ); add_filter( 'pre_handle_404', [ $this, 'handle_pagination_404' ], 10, 2 ); } } query-control/types/acf.php 0000644 00000012224 15112147616 0012002 0 ustar 00 <?php namespace ElementorExtras\Modules\QueryControl\Types; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Modules\QueryControl\Types\Meta_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\QueryControl\Types\Acf * * @since 2.2.0 */ class Acf extends Meta_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'acf'; } /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_title() { return __( 'ACF', 'elementor-extras' ); } /** * Gets autocomplete values * * @since 2.2.0 * @return array */ public function get_autocomplete_values( array $data ) { $results = []; $options = $data['query_options']; $options_pages = Utils::get_acf_options_pages_ids(); $query_params = [ 'post_type' => 'acf-field', 'post_status' => 'publish', 'search_title_name' => $data['q'], 'posts_per_page' => -1, ]; if ( empty( $options['include_option'] ) || ! $options['include_option'] ) { $query_params['post_parent__not_in'] = $options_pages; } add_filter( 'posts_where', ['\ElementorExtras\Utils', 'posts_where_by_title_name'], 10, 2 ); $query = new \WP_Query( $query_params ); remove_filter( 'posts_where', ['\ElementorExtras\Utils', 'posts_where_by_title_name'], 10, 2 ); $query_results = $this->get_query_results( $query, $options ); foreach ( $query_results as $query_result ) { $results[] = [ 'id' => $query_result[0], 'text' => $query_result[1], ]; } return $results; } /** * Gets control values titles * * @since 2.2.0 * @return array */ public function get_value_titles( array $request ) { $values = (array)$request['id']; $keys = []; $results = []; $options = $request['query_options']; if ( ! empty( $options['include_option'] ) && true == $options['include_option'] ) { foreach ( $values as $value ) { list( $name, $key ) = explode( ':', $value ); $keys[] = $key; } } else { $keys = $values; } $query = new \WP_Query( [ 'post_type' => 'acf-field', 'post_name__in' => $keys, 'posts_per_page' => -1, ] ); $query_results = $this->get_query_results( $query, $options ); foreach ( $query_results as $query_result ) { $results[ $query_result[0] ] = $query_result[1]; } return $results; } protected function get_query_results( $query, $options ) { $results = []; $show_type = ! empty( $options['show_type'] ) && $options['show_type']; $show_field_type = ! empty( $options['show_field_type'] ) && $options['show_field_type']; $show_group = ! empty( $options['show_group'] ) && $options['show_group']; foreach ( $query->posts as $post ) { $field_settings = unserialize( $post->post_content ); $field_type = $field_settings['type']; if ( ! $this->is_valid_field_type( $options['field_type'], $field_type ) ) { continue; } $display = $post->post_title; $display_type = $show_type ? $this->get_title() : ''; $display_field_type = $show_field_type ? $this->get_acf_field_type_label( $field_type ) : ''; $display_group = $show_group ? '(' . get_the_title( $post->post_parent ) . ')' : ''; $display = $show_type || $show_field_type ? ': ' . $display : $display; $result_key = $this->get_results_field_key( $post, $options ); $result_label = sprintf( '%1$s %2$s %3$s %4$s', $display_type, $display_field_type, $display, $display_group ); $results[] = [ $result_key, $result_label ]; } return $results; } /** * Get key for query control results * * @since 2.2.33 * @param $post WP_Post The ACF field post * @param $option array The control query options * @return string */ protected function get_results_field_key( $post, $options ) { if ( ! $post ) { return []; } $key = $post->post_name; $options_pages = Utils::get_acf_options_pages_ids(); if ( ! empty( $options['include_option'] ) && true == $options['include_option'] ) { if ( in_array( $post->post_parent, $options_pages ) ) { $key = 'option:' . $key; } else { $key = $post->post_excerpt . ':' . $key; } } return $key; } /** * Gets the acf control type label by field type * * @since 2.2.0 * @return array */ public function get_acf_field_type_label( $field_type ) { if ( ! function_exists( 'acf_get_field_type' ) ) return; $field_type_object = acf_get_field_type( $field_type ); if ( $field_type_object ) return $field_type_object->label; return false; } /** * Returns array of acf field types organized * by category * * @since 2.2.5 * @return array */ public function get_field_types() { return [ 'textual' => [ 'text', 'textarea', 'number', 'range', 'email', 'url', 'password', 'wysiwyg', ], 'date' => [ 'date_picker', 'date_time_picker', ], 'option' => [ 'select', 'checkbox', 'radio', ], 'boolean' => [ 'true_false', ], 'post' => [ 'post_object', 'relationship', ], 'taxonomy' => [ 'taxonomy', ], ]; } } query-control/types/authors.php 0000644 00000003175 15112147616 0012743 0 ustar 00 <?php namespace ElementorExtras\Modules\QueryControl\Types; // Extras for Elementor Classes use ElementorExtras\Modules\QueryControl\Types\Type_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\QueryControl\Types\Authors * * @since 2.2.0 */ class Authors extends Type_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'authors'; } /** * Gets autocomplete values * * @since 2.2.0 * @return array */ public function get_autocomplete_values( array $data ) { $results = []; $query_params = [ 'who' => 'authors', 'has_published_posts' => true, 'fields' => [ 'ID', 'display_name', ], 'search' => '*' . $data['q'] . '*', 'search_columns' => [ 'user_login', 'user_nicename', ], ]; $user_query = new \WP_User_Query( $query_params ); foreach ( $user_query->get_results() as $author ) { $results[] = [ 'id' => $author->ID, 'text' => $author->display_name, ]; } return $results; } /** * Gets control values titles * * @since 2.2.0 * @return array */ public function get_value_titles( array $request ) { $ids = (array) $request['id']; $results = []; $query_params = [ 'who' => 'authors', 'has_published_posts' => true, 'fields' => [ 'ID', 'display_name', ], 'include' => $ids, ]; $user_query = new \WP_User_Query( $query_params ); foreach ( $user_query->get_results() as $author ) { $results[ $author->ID ] = $author->display_name; } return $results; } } query-control/types/meta-base.php 0000644 00000002550 15112147616 0013110 0 ustar 00 <?php namespace ElementorExtras\Modules\QueryControl\Types; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Modules\QueryControl\Types\Type_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\QueryControl\Types\Meta_Base * * @since 2.2.5 */ class Meta_Base extends Type_Base { /** * Returns array of component field types organized * based on categories * * @since 2.2.5 * @return array */ public function get_field_types() { return []; } /** * Checks if given control field types match * component field types * * @since 2.2.5 * @param array $valid_types Sets of valid control field types * @param array $types Component field type to check against * @return bool */ protected function is_valid_field_type( $valid_types, $type ) { if ( ! $valid_types || ! $type ) { return false; } $field_types = $this->get_field_types(); if ( is_array( $valid_types ) ) { foreach ( $valid_types as $valid_type ) { if ( is_array( $field_types[ $valid_type ] ) ) { if ( in_array( $type, $field_types[ $valid_type ] ) ) { return true; } } else { if ( $type === $field_types[ $valid_type ] ) { return true; } } } } else if ( in_array( $type, $field_types[ $valid_types ] ) ) { return true; } return false; } } query-control/types/pods.php 0000644 00000007035 15112147616 0012222 0 ustar 00 <?php namespace ElementorExtras\Modules\QueryControl\Types; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Modules\QueryControl\Types\Meta_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\QueryControl\Types\Pods * * @since 2.2.5 */ class Pods extends Meta_Base { /** * Get Name * * Get the name of the module * * @since 2.2.5 * @return string */ public function get_name() { return 'pods'; } /** * Get Name * * Get the name of the module * * @since 2.2.5 * @return string */ public function get_title() { return __( 'Pods', 'elementor-extras' ); } /** * Gets autocomplete values * * @since 2.2.5 * @return array */ public function get_autocomplete_values( array $data ) { $results = []; $utils = new Utils(); $options = $data['query_options']; $query_params = [ 'post_type' => '_pods_field', 'post_status' => 'publish', 'search_title_name' => $data['q'], 'posts_per_page' => -1, ]; add_filter( 'posts_where', [ $utils, 'posts_where_by_title_name' ], 10, 2 ); $query = new \WP_Query( $query_params ); foreach ( $query->posts as $field_post ) { $pod = get_post( $field_post->post_parent ); $field = pods_api()->load_field( [ 'pod' => $pod->post_name, 'pod_id' => $pod->ID, 'name' => $field_post->post_name, 'id' => $field_post->ID, 'table_info' => false, ] ); if ( ! is_array( $field ) || empty( $field['type'] ) ) { continue; } if ( ! $this->is_valid_field_type( $options['field_type'], $field['type'] ) ) { continue; } $display = $field['label']; $display_type = ( $options['show_type'] ) ? $this->get_title() : ''; $display_field_type = ( $options['show_field_type'] ) ? $field['type'] : ''; $display = ( $options['show_type'] || $options['show_field_type'] ) ? ': ' . $display : $display; $results[] = [ 'id' => $pod->post_name . ':' . $pod->ID . ':' . $field['name'] . ':' . $field['id'], 'text' => sprintf( '%1$s %2$s %3$s', $display_type, $display_field_type, $display ), ]; } remove_filter( 'posts_where', [ $utils, 'posts_where_by_title_name' ], 10, 2 ); return $results; } /** * Gets control values titles * * @since 2.2.5 * @return array */ public function get_value_titles( array $request ) { $keys = (array)$request['id']; $results = []; $options = $request['query_options']; foreach ( $keys as $key ) { list( $pod_name, $pod_id, $field_name, $field_id ) = explode( ':', $key ); $field = pods_api()->load_field( [ 'pod' => $pod_name, 'pod_id' => $pod_id, 'name' => $field_name, 'id' => $field_id, 'table_info' => false, ] ); if ( ! is_array( $field ) || empty( $field['type'] ) ) { continue; } if ( ! $this->is_valid_field_type( $options['field_type'], $field['type'] ) ) { continue; } $display = $field['label']; $display_type = ( $options['show_type'] ) ? $this->get_title() : ''; $display_field_type = ( $options['show_field_type'] ) ? $field['type'] : ''; $display = ( $options['show_type'] || $options['show_field_type'] ) ? ': ' . $display : $display; $results[ $key ] = sprintf( '%1$s %2$s %3$s', $display_type, $display_field_type, $display ); } return $results; } /** * Returns array of pods field types organized * by category * * @since 2.2.5 * @return array */ public function get_field_types() { return [ 'date' => [ 'datetime', 'date', ], ]; } } query-control/types/posts.php 0000644 00000002664 15112147616 0012430 0 ustar 00 <?php namespace ElementorExtras\Modules\QueryControl\Types; // Extras for Elementor Classes use ElementorExtras\Modules\QueryControl\Types\Type_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\QueryControl\Types\Posts * * @since 2.2.0 */ class Posts extends Type_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'posts'; } /** * Gets autocomplete values * * @since 2.2.0 * @return array */ public function get_autocomplete_values( array $data ) { $results = []; $query_params = [ 'post_type' => $data['object_type'], 's' => $data['q'], 'posts_per_page' => -1, ]; if ( 'attachment' === $query_params['post_type'] ) { $query_params['post_status'] = 'inherit'; } $query = new \WP_Query( $query_params ); foreach ( $query->posts as $post ) { $results[] = [ 'id' => $post->ID, 'text' => $post->post_title, ]; } return $results; } /** * Gets control values titles * * @since 2.2.0 * @return array */ public function get_value_titles( array $request ) { $ids = (array) $request['id']; $results = []; $query = new \WP_Query( [ 'post_type' => 'any', 'post__in' => $ids, 'posts_per_page' => -1, ] ); foreach ( $query->posts as $post ) { $results[ $post->ID ] = $post->post_title; } return $results; } } query-control/types/templates.php 0000644 00000004111 15112147616 0013243 0 ustar 00 <?php namespace ElementorExtras\Modules\QueryControl\Types; // Extras for Elementor Classes use ElementorExtras\Modules\QueryControl\Types\Type_Base; use ElementorExtras\Utils; // Elementor Classes use Elementor\Core\Base\Document; use Elementor\TemplateLibrary\Source_Local; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\QueryControl\Types\Templates * * @since 2.2.0 */ class Templates extends Type_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'templates'; } /** * Gets autocomplete values * * @since 2.2.0 * @return array */ public function get_autocomplete_values( array $data ) { $results = []; $document_types = Utils::elementor()->documents->get_document_types( [ 'show_in_library' => true, ] ); $query_params = [ 's' => $data['q'], 'post_type' => Source_Local::CPT, 'posts_per_page' => -1, 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => [ [ 'key' => Document::TYPE_META_KEY, 'value' => array_keys( $document_types ), 'compare' => 'IN', ], ], ]; $query = new \WP_Query( $query_params ); foreach ( $query->posts as $post ) { $document = Utils::elementor()->documents->get( $post->ID ); if ( ! $document ) continue; $results[] = [ 'id' => $post->ID, 'text' => $post->post_title . ' (' . $document->get_post_type_title() . ')', ]; } return $results; } /** * Gets control values titles * * @since 2.2.0 * @return array */ public function get_value_titles( array $request ) { $ids = (array) $request['id']; $results = []; $query = new \WP_Query( [ 'post_type' => Source_Local::CPT, 'post__in' => $ids, 'posts_per_page' => -1, ]); foreach ( $query->posts as $post ) { $document = Utils::elementor()->documents->get( $post->ID ); if ( ! $document ) continue; $results[ $post->ID ] = $post->post_title . ' (' . $document->get_post_type_title() . ')'; } return $results; } } query-control/types/terms.php 0000644 00000002633 15112147616 0012406 0 ustar 00 <?php namespace ElementorExtras\Modules\QueryControl\Types; // Extras for Elementor Classes use ElementorExtras\Modules\QueryControl\Types\Type_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\QueryControl\Types\Terms * * @since 2.2.0 */ class Terms extends Type_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'terms'; } /** * Gets autocomplete values * * @since 2.2.0 * @return array */ public function get_autocomplete_values( array $data ) { $results = []; $taxonomies = get_object_taxonomies(''); $query_params = [ 'taxonomy' => $taxonomies, 'search' => $data['q'], 'hide_empty' => false, ]; $terms = get_terms( $query_params ); foreach ( $terms as $term ) { $taxonomy = get_taxonomy( $term->taxonomy ); $results[] = [ 'id' => $term->term_id, 'text' => $taxonomy->labels->singular_name . ': ' . $term->name, ]; } return $results; } /** * Gets control values titles * * @since 2.2.0 * @return array */ public function get_value_titles( array $request ) { $ids = (array) $request['id']; $results = []; $query_params = [ 'include' => $ids, ]; $terms = get_terms( $query_params ); foreach ( $terms as $term ) { $results[ $term->term_id ] = $term->name; } return $results; } } query-control/types/toolset.php 0000644 00000006221 15112147616 0012742 0 ustar 00 <?php namespace ElementorExtras\Modules\QueryControl\Types; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Modules\QueryControl\Types\Meta_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\QueryControl\Types\Toolset * * @since 2.2.5 */ class Toolset extends Meta_Base { /** * Get Name * * Get the name of the module * * @since 2.2.5 * @return string */ public function get_name() { return 'toolset'; } /** * Get Name * * Get the name of the module * * @since 2.2.5 * @return string */ public function get_title() { return __( 'Toolset', 'elementor-extras' ); } /** * Gets autocomplete values * * @since 2.2.5 * @return array */ public function get_autocomplete_values( array $data ) { $results = []; $utils = new Utils(); $options = $data['query_options']; $toolset_groups = wpcf_admin_fields_get_groups(); foreach ( $toolset_groups as $group ) { $fields = wpcf_admin_fields_get_fields_by_group( $group['id'] ); if ( ! is_array( $fields ) ) { continue; } foreach ( $fields as $field_key => $field ) { if ( strpos( strtolower( $field['name'] ), strtolower( $data['q'] ) ) === false || strpos( strtolower( $field['slug'] ), strtolower( $data['q'] ) ) ) { continue; } if ( ! is_array( $field ) || empty( $field['type'] ) ) { continue; } if ( ! $this->is_valid_field_type( $options['field_type'], $field['type'] ) ) { continue; } $display = $field['name']; $display_type = ( $options['show_type'] ) ? $this->get_title() : ''; $display_field_type = ( $options['show_field_type'] ) ? $field['slug'] : ''; $display = ( $options['show_type'] || $options['show_field_type'] ) ? ': ' . $display : $display; $results[] = [ 'id' => $group['slug'] . ':' . $field['slug'], 'text' => sprintf( '%1$s %2$s %3$s', $display_type, $display_field_type, $display ), ]; } } return $results; } /** * Gets control values titles * * @since 2.2.5 * @return array */ public function get_value_titles( array $request ) { $keys = (array)$request['id']; $results = []; $options = $request['query_options']; foreach ( $keys as $key ) { list( $field_group, $field_key ) = explode( ':', $key ); $field = wpcf_admin_fields_get_field( $field_key ); if ( ! is_array( $field ) || empty( $field['type'] ) ) { continue; } if ( ! $this->is_valid_field_type( $options['field_type'], $field['type'] ) ) { continue; } $display = $field['name']; $display_type = ( $options['show_type'] ) ? $this->get_title() : ''; $display_field_type = ( $options['show_field_type'] ) ? $field['slug'] : ''; $display = ( $options['show_type'] || $options['show_field_type'] ) ? ': ' . $display : $display; $results[ $key ] = sprintf( '%1$s %2$s %3$s', $display_type, $display_field_type, $display ); } return $results; } /** * Returns array of pods field types organized * by category * * @since 2.2.5 * @return array */ public function get_field_types() { return [ 'date' => [ 'date', ], ]; } } query-control/types/type-base.php 0000644 00000001314 15112147616 0013140 0 ustar 00 <?php namespace ElementorExtras\Modules\QueryControl\Types; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\QueryControl\Types\Base * * @since 2.2.0 */ class Type_Base extends Module_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() {} /** * Gets autocomplete values * * @since 2.2.0 * @return array */ protected function get_autocomplete_values( array $data ) {} /** * Gets control values titles * * @since 2.2.0 * @return array */ protected function get_value_titles( array $request ) {} } query-control/types/users.php 0000644 00000002773 15112147616 0012422 0 ustar 00 <?php namespace ElementorExtras\Modules\QueryControl\Types; // Extras for Elementor Classes use ElementorExtras\Modules\QueryControl\Types\Type_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\QueryControl\Types\Authors * * @since 2.2.0 */ class Users extends Type_Base { /** * Get Name * * Get the name of the module * * @since 2.2.0 * @return string */ public function get_name() { return 'users'; } /** * Gets autocomplete values * * @since 2.2.0 * @return array */ public function get_autocomplete_values( array $data ) { $results = []; $query_params = [ 'fields' => [ 'ID', 'display_name', ], 'search' => '*' . $data['q'] . '*', 'search_columns' => [ 'user_login', 'user_nicename', ], ]; $user_query = new \WP_User_Query( $query_params ); foreach ( $user_query->get_results() as $author ) { $results[] = [ 'id' => $author->ID, 'text' => $author->display_name, ]; } return $results; } /** * Gets control values titles * * @since 2.2.0 * @return array */ public function get_value_titles( array $request ) { $ids = (array) $request['id']; $results = []; $query_params = [ 'fields' => [ 'ID', 'display_name', ], 'include' => $ids, ]; $user_query = new \WP_User_Query( $query_params ); foreach ( $user_query->get_results() as $author ) { $results[ $author->ID ] = $author->display_name; } return $results; } } query-control/module.php 0000644 00000005446 15112147616 0011402 0 ustar 00 <?php namespace ElementorExtras\Modules\QueryControl; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Base\Module_Base; use ElementorExtras\Controls\Control_Query as Query; // Elementor Classes use Elementor\Widget_Base; use Elementor\Controls_Manager; use Elementor\Core\Common\Modules\Ajax\Module as Ajax; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\QueryControl\Module * * @since 2.0.0 */ class Module extends Module_Base { /** * Module constructor. * * @since 2.0.0 * @param array $args */ public function __construct() { parent::__construct(); // ACF 5 and up if ( class_exists( '\acf' ) && function_exists( 'acf_get_field_groups' ) ) { $this->add_component( 'acf', new Types\Acf() ); } // Pods if ( function_exists( 'pods' ) ) { $this->add_component( 'pods', new Types\Pods() ); } // Toolset if ( function_exists( 'wpcf_admin_fields_get_groups' ) ) { $this->add_component( 'toolset', new Types\Toolset() ); } $this->add_component( 'posts', new Types\Posts() ); $this->add_component( 'terms', new Types\Terms() ); $this->add_component( 'authors', new Types\Authors() ); $this->add_component( 'users', new Types\Users() ); $this->add_component( 'templates', new Types\Templates() ); $this->add_actions(); } /** * Get Name * * Get the name of the module * * @since 2.0.0 * @return string */ public function get_name() { return 'query-control'; } /** * Add Actions * * Registeres actions to Elementor hooks * * @since 2.0.0 * @return void */ protected function add_actions() { add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_actions' ] ); } /** * Calls function depending on ajax query data * * @since 2.0.0 * @return array */ public function ajax_call_filter_autocomplete( array $data ) { if ( empty( $data['query_type'] ) || empty( $data['q'] ) ) { throw new \Exception( 'Bad Request' ); } $results = $this->get_component( $data['query_type'] )->get_autocomplete_values( $data ); return [ 'results' => $results, ]; } /** * Calls function to get value titles depending on ajax query type * * @since 2.0.0 * @return array */ public function ajax_call_control_value_titles( array $request ) { $results = $this->get_component( $request['query_type'] )->get_value_titles( $request ); return $results; } /** * Register Elementor Ajax Actions * * @since 2.0.0 * @return array */ public function register_ajax_actions( $ajax_manager ) { $ajax_manager->register_ajax_action( 'ee_query_control_value_titles', [ $this, 'ajax_call_control_value_titles' ] ); $ajax_manager->register_ajax_action( 'ee_query_control_filter_autocomplete', [ $this, 'ajax_call_filter_autocomplete' ] ); } } scroll-indicator/skins/skin-bar.php 0000644 00000015570 15112147616 0013376 0 ustar 00 <?php namespace ElementorExtras\Modules\ScrollIndicator\Skins; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\ScrollIndicator\Skins * * @since 2.1.0 */ class Skin_Bar extends Skin_Base { /** * Get ID * * Gets the current skin ID * * @since 2.1.0 * @return string */ public function get_id() { return 'bar'; } /** * Get Title * * Gets the current skin title * * @since 2.1.0 * @return string */ public function get_title() { return __( 'Bar', 'elementor-extras' ); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.1.0 * @return void */ protected function _register_controls_actions() { parent::_register_controls_actions(); add_action( 'elementor/element/ee-scroll-indicator/section_settings/after_section_end', [ $this, 'register_settings_controls' ] ); add_action( 'elementor/element/ee-scroll-indicator/section_settings/after_section_end', [ $this, 'register_bar_style_controls' ] ); } /** * Register settings controls * * @since 2.1.0 * @return void */ public function register_settings_controls() { $this->parent->start_injection( [ 'type' => 'section', 'at' => 'start', 'of' => 'section_settings', ] ); $this->add_control( 'notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => sprintf( __( '%1$sImportant note:%2$s Use the Elementor or Extras sticky functionality to keep the bar in view.', 'elementor-extras' ), '<strong>', '</strong>' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', ] ); $this->parent->end_injection(); } /** * Register bar style controls * * @since 2.1.0 * @return void */ public function register_bar_style_controls() { $this->start_controls_section( 'section_bar_style', [ 'label' => __( 'Bar', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'height', [ 'label' => __( 'Height (px)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__wrapper' => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'spacing', [ 'label' => __( 'Spacing (px)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-scroll-indicator__menu' => 'margin-left: -{{SIZE}}{{UNIT}};', ], ] ); $this->start_controls_tabs( 'indicators' ); $this->start_controls_tab( 'indicators_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__wrapper' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'indicators_progress', [ 'label' => __( 'Progress', 'elementor-extras' ) ] ); $this->add_control( 'background_color_progress', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__progress' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'indicators_reading', [ 'label' => __( 'Reading', 'elementor-extras' ) ] ); $this->add_control( 'background_color_reading', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--reading .ee-scroll-indicator__element__wrapper' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'indicators_read', [ 'label' => __( 'Read', 'elementor-extras' ) ] ); $this->add_control( 'background_color_read', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_ACCENT, ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--read .ee-scroll-indicator__element__wrapper' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Register content controls * * @since 2.1.0 * @return void */ public function register_content_controls() { parent::register_content_controls(); } /** * Get default nav class * * @since 2.1.0 * @return void */ public function get_nav_class() { return 'ee-nav ee-nav--flush'; } /** * Render element item content * * @since 2.1.0 * @return void */ public function render_element_content( $index, $section ) { $settings = $this->parent->get_settings(); $wrapper_key = $this->parent->_get_repeater_setting_key( 'wrapper', 'sections', $index ); $link_key = $this->parent->_get_repeater_setting_key( 'link', 'sections', $index ); $progress_key = $this->parent->_get_repeater_setting_key( 'progress', 'sections', $index ); $this->parent->add_render_attribute( [ $wrapper_key => [ 'class' => [ 'ee-scroll-indicator__element__wrapper', ], ], $link_key => [ 'class' => [ 'ee-scroll-indicator__element__link', ], ], $progress_key => [ 'class' => [ 'ee-scroll-indicator__element__progress', 'ee-cover', ] ] ] ); if ( 'yes' === $settings['click'] ) { $this->parent->add_render_attribute( $link_key, 'class', 'has--cursor' ); } else { if ( '' !== $section['link'] && ! empty( $section['url'] ) ) { $this->parent->add_render_attribute( $link_key, 'href', $section['url'] ); if ( '' !== $section['link_new_window'] ) { $this->parent->add_render_attribute( $link_key, 'target', '_blank' ); } } } ?> <a <?php echo $this->parent->get_render_attribute_string( $link_key ); ?>> <div <?php echo $this->parent->get_render_attribute_string( $wrapper_key ); ?>> <div <?php echo $this->parent->get_render_attribute_string( $progress_key ); ?>></div> </div> </a> <?php } } scroll-indicator/skins/skin-base.php 0000644 00000044323 15112147616 0013542 0 ustar 00 <?php namespace ElementorExtras\Modules\ScrollIndicator\Skins; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Base\Extras_Widget; // Elementor Classes use Elementor\Repeater; use Elementor\Controls_Manager; use Elementor\Skin_Base as Elementor_Skin_Base; use Elementor\Group_Control_Border; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Css_Filter; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\ScrollIndicator\Skins * * @since 2.1.0 */ abstract class Skin_Base extends Elementor_Skin_Base { /** * Get Parent Widget * * @since 2.1.0 * @return $widget Extras_Widget */ public function get_widget() { return $this->parent; } /** * Register Container Class * * @since 2.1.0 * @return void */ public function get_container_class() { return 'ee-scroll-indicator--skin-' . $this->get_id(); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.1.0 * @return void */ protected function _register_controls_actions() { add_action( 'elementor/element/ee-scroll-indicator/section_settings/after_section_end', [ $this, 'register_controls' ] ); } /** * Register Controls * * @since 2.1.0 * @return void * @param $widget Extras_Widget */ public function register_controls( Extras_Widget $widget ) { $this->parent = $widget; $this->register_content_controls(); $this->register_style_controls(); } /** * Register Content Controls * * @since 2.1.0 * @return void */ public function register_content_controls() {} /** * Register Style Controls * * @since 2.1.0 * @return void */ public function register_style_controls() {} /** * Register Tooltip Content Controls * * @since 2.1.0 * @return void */ public function register_tooltip_content_controls() { $this->start_controls_section( 'section_tooltips', [ 'label' => __( 'Tooltips', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, 'condition' => [ $this->get_control_id( 'tooltips!' ) => '', ] ] ); $this->add_control( 'show_on_focus', [ 'label' => __( 'Show On Focus', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_responsive_control( 'trigger', [ 'label' => __( 'Trigger', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'mouseenter', 'tablet_default' => 'click_target', 'mobile_default' => 'click_target', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'mouseenter' => __( 'Mouse Over', 'elementor-extras' ), 'click_target' => __( 'Click Target', 'elementor-extras' ), 'load' => __( 'Page Load', 'elementor-extras' ), ], 'frontend_available' => true ] ); $this->add_responsive_control( '_hide', [ 'label' => __( 'Hide on', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'mouseleave', 'tablet_default' => 'click_out', 'mobile_default' => 'click_out', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'mouseleave' => __( 'Mouse Leave', 'elementor-extras' ), 'click_out' => __( 'Click Outside', 'elementor-extras' ), 'click_target' => __( 'Click Target', 'elementor-extras' ), 'click_any' => __( 'Click Anywhere', 'elementor-extras' ), ], 'frontend_available' => true ] ); $this->add_control( 'position', [ 'label' => __( 'Show to', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'left', 'options' => [ 'bottom' => __( 'Bottom', 'elementor-extras' ), 'left' => __( 'Left', 'elementor-extras' ), 'top' => __( 'Top', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'frontend_available' => true ] ); $this->add_control( 'arrow_position_h', [ 'label' => __( 'Show at', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Center', 'elementor-extras' ), 'left' => __( 'Left', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'condition' => [ $this->get_control_id( 'position' ) => [ 'top', 'bottom' ], ], 'frontend_available' => true ] ); $this->add_control( 'arrow_position_v', [ 'label' => __( 'Show at', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Center', 'elementor-extras' ), 'top' => __( 'Top', 'elementor-extras' ), 'bottom' => __( 'Bottom', 'elementor-extras' ), ], 'condition' => [ $this->get_control_id( 'position' ) => [ 'left', 'right' ], ], 'frontend_available' => true ] ); $this->add_control( 'css_position', [ 'label' => __( 'CSS Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'fixed', 'options' => [ '' => 'Absolute', 'fixed' => 'Fixed', ], 'frontend_available' => true, ] ); $this->add_control( 'disable', [ 'label' => __( 'Disable On', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'tablet' => __( 'Tablet & Mobile', 'elementor-extras' ), 'mobile' => __( 'Mobile', 'elementor-extras' ), ], 'frontend_available' => true ] ); $this->add_control( 'tooltips_arrow', [ 'label' => __( 'Arrow', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '""', 'options' => [ '""' => __( 'Show', 'elementor-extras' ), 'none' => __( 'Hide', 'elementor-extras' ), ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}:after' => 'content: {{VALUE}};', ], ] ); $this->add_control( 'delay_in', [ 'label' => __( 'Delay in (s)', 'elementor-extras' ), 'description' => __( 'Time until tooltips appear.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.1, ], ], 'frontend_available' => true ] ); $this->add_control( 'delay_out', [ 'label' => __( 'Delay out (s)', 'elementor-extras' ), 'description' => __( 'Time until tooltips dissapear.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step' => 0.1, ], ], 'frontend_available' => true ] ); $this->add_control( 'duration', [ 'label' => __( 'Duration', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 2, 'step' => 0.1, ], ], 'frontend_available' => true ] ); $this->add_control( 'tooltips_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'description' => __( 'The distance between the tooltip and the hotspot. Defaults to 6px', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}.to--top' => 'transform: translateY(-{{SIZE}}{{UNIT}});', '.ee-tooltip.ee-tooltip-{{ID}}.to--bottom' => 'transform: translateY({{SIZE}}{{UNIT}});', '.ee-tooltip.ee-tooltip-{{ID}}.to--left' => 'transform: translateX(-{{SIZE}}{{UNIT}});', '.ee-tooltip.ee-tooltip-{{ID}}.to--right' => 'transform: translateX({{SIZE}}{{UNIT}});', ] ] ); $this->add_control( 'tooltips_offset', [ 'label' => __( 'Offset', 'elementor-extras' ), 'description' => __( 'Adjust offset to align arrow with target.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => -100, 'max' => 100, ], ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}.to--top, .ee-tooltip.ee-tooltip-{{ID}}.to--bottom' => 'margin-left: {{SIZE}}{{UNIT}};', '.ee-tooltip.ee-tooltip-{{ID}}.to--left, .ee-tooltip.ee-tooltip-{{ID}}.to--right' => 'margin-top: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'tooltips_width', [ 'label' => __( 'Maximum Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 350, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, ], ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'max-width: {{SIZE}}{{UNIT}};', ] ] ); $this->add_control( 'tooltips_zindex', [ 'label' => __( 'zIndex', 'elementor-extras' ), 'description' => __( 'Adjust the z-index of the tooltips. Defaults to 999', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => '999', 'min' => -9999999, 'step' => 1, 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'z-index: {{SIZE}};', ] ] ); $this->end_controls_section(); } /** * Register Tooltip Style Controls * * @since 2.1.0 * @return void */ public function register_tooltip_style_controls() { $this->start_controls_section( 'section_tooltips_style', [ 'label' => __( 'Tooltips', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ $this->get_control_id( 'tooltips!' ) => '', ] ] ); $this->add_control( 'tooltips_align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'tooltips_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'tooltips_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'tooltips_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => Utils::get_tooltip_background_selectors(), ] ); $this->add_control( 'tooltips_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-tooltip.ee-tooltip-{{ID}}' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'tooltips_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '.ee-tooltip.ee-tooltip-{{ID}}', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'tooltips_typography', 'selector' => '.ee-tooltip.ee-tooltip-{{ID}}', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'separator' => '', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'tooltips_box_shadow', 'selector' => '.ee-tooltip.ee-tooltip-{{ID}}', 'separator' => '', ] ); $this->end_controls_section(); } /** * Render widget * * @since 2.1.0 * @return void */ public function render() { $this->parent->render(); $this->parent->add_render_attribute( [ 'wrapper' => [ 'class' => [ 'ee-scroll-indicator', $this->get_container_class(), ], ], ] ); ?><div <?php echo $this->parent->get_render_attribute_string('wrapper'); ?>> <?php $this->render_content(); ?> </div><?php } /** * Render content * * @since 2.1.0 * @return void */ public function render_content() { $this->render_elements(); } /** * Get default nav class * * @since 2.1.0 * @return void */ public function get_nav_class() {} /** * Render elements loop * * @since 2.1.0 * @return void */ public function render_elements() { $sections = $this->parent->get_settings_for_display( 'sections' ); $nav_class = $this->get_nav_class(); ?> <ul class="ee-scroll-indicator__menu ee-nav <?php echo $nav_class; ?>"> <?php foreach ( $sections as $index => $section ) { ?> <?php $this->render_element( $index, $section ); ?> <?php } ?> </ul> <?php } /** * Render element item * * @since 2.1.0 * @return void */ public function render_element( $index, $section ) { $section_key = $this->parent->_get_repeater_setting_key( 'element', 'sections', $index ); $this->parent->add_render_attribute( [ $section_key => [ 'class' => 'ee-scroll-indicator__element', 'data-selector' => $section['selector'], 'data-start' => $section['progress_start'], 'data-start-offset' => $section['progress_start_offset']['size'], 'data-end' => $section['progress_end'], 'data-end-offset' => $section['progress_end_offset']['size'], ], ] ); ?> <li <?php echo $this->parent->get_render_attribute_string( $section_key ); ?>> <?php $this->render_element_content( $index, $section ); ?> </li> <?php } /** * Render element item content * * @since 2.1.0 * @return void */ public function render_element_content( $index, $section ) { $settings = $this->parent->get_settings(); $link_key = $this->parent->_get_repeater_setting_key( 'link', 'sections', $index ); } /** * Render bullet markup * * @since 2.1.0 * @return void */ public function render_element_bullet( $index, $section ) { $skin = $this->parent->get_current_skin(); if ( ! in_array( $skin->get_instance_value( 'show' ), [ '', 'numbers' ] ) ) return; $bullet_key = $this->parent->_get_repeater_setting_key( 'bullet', 'sections', $index ); $number_key = $this->parent->_get_repeater_setting_key( 'number', 'sections', $index ); $circle_key = $this->parent->_get_repeater_setting_key( 'circle', 'sections', $index ); $this->parent->add_render_attribute( [ $bullet_key => [ 'class' => 'ee-scroll-indicator__element__bullet', ], $number_key => [ 'class' => 'ee-scroll-indicator__element__number ee-center', ], $circle_key => [ 'class' => 'ee-scroll-indicator__element__circle', ], ] ); ?> <div <?php echo $this->parent->get_render_attribute_string( $bullet_key ); ?>> <div <?php echo $this->parent->get_render_attribute_string( $number_key ); ?>> <?php echo $index + 1; ?> </div> <div <?php echo $this->parent->get_render_attribute_string( $circle_key ); ?>> <?php $this->render_svg(); ?> </div> </div> <?php } /** * Render text markup * * @since 2.1.0 * @return void */ public function render_element_text( $index, $section ) { $skin = $this->parent->get_current_skin(); if ( ! in_array( $skin->get_instance_value( 'show' ), [ '', 'text' ] ) || ( empty( $section['title'] ) && empty( $section['subtitle'] ) ) ) return; $text_key = $this->parent->_get_repeater_setting_key( 'text', 'sections', $index ); $title_key = $this->parent->_get_repeater_setting_key( 'title', 'sections', $index ); $subtitle_key = $this->parent->_get_repeater_setting_key( 'subtitle', 'sections', $index ); $title_tag = $skin->get_instance_value('title_html_tag'); $subtitle_tag = $skin->get_instance_value('subtitle_html_tag'); $this->parent->add_render_attribute( [ $text_key => [ 'class' => 'ee-scroll-indicator__element__text', ], ] ); if ( $section['title'] ) { $this->parent->add_render_attribute( [ $title_key => [ 'class' => 'ee-scroll-indicator__element__title', ], ] ); } if ( $section['subtitle'] ) { $this->parent->add_render_attribute( [ $subtitle_key => [ 'class' => 'ee-scroll-indicator__element__subtitle', ], ] ); } ?> <div <?php echo $this->parent->get_render_attribute_string( $text_key ); ?>> <?php if ( $section['title'] ) { ?> <<?php echo $title_tag; ?> <?php echo $this->parent->get_render_attribute_string( $title_key ); ?>><?php echo $section['title']; ?></<?php echo $title_tag; ?>> <?php } ?> <?php if ( $section['subtitle'] ) { ?> <<?php echo $subtitle_tag; ?> <?php echo $this->parent->get_render_attribute_string( $subtitle_key ); ?>><?php echo $section['subtitle']; ?></<?php echo $subtitle_tag; ?>> <?php } ?> </div> <?php } /** * Render circle svg * * @since 2.1.0 * @return void */ public function render_svg() { ?><svg x="0px" y="0px" width="36px" height="36px" viewBox="0 0 36 36"><circle fill="none" stroke-width="2" cx="18" cy="18" r="16" stroke-dasharray="100 100" stroke-dashoffset="100" transform="rotate(-90 18 18)"></circle></svg><?php } } scroll-indicator/skins/skin-bullets.php 0000644 00000045127 15112147616 0014305 0 ustar 00 <?php namespace ElementorExtras\Modules\ScrollIndicator\Skins; // Extras for Elementor Classes use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Controls_Stack; use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\ScrollIndicator\Skins * * @since 2.1.0 */ class Skin_Bullets extends Skin_Base { /** * Get ID * * Gets the current skin ID * * @since 2.1.0 * @return string */ public function get_id() { return 'bullets'; } /** * Get Title * * Gets the current skin title * * @since 2.1.0 * @return string */ public function get_title() { return __( 'Bullets', 'elementor-extras' ); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.1.0 * @return void */ protected function _register_controls_actions() { parent::_register_controls_actions(); add_action( 'elementor/element/ee-scroll-indicator/section_settings/after_section_end', [ $this, 'register_settings_controls' ] ); add_action( 'elementor/element/ee-scroll-indicator/section_elements/after_section_end', [ $this, 'register_tooltip_content_controls' ] ); } /** * Register content controls * * @since 2.1.0 * @return void */ public function register_content_controls() { parent::register_content_controls(); } /** * Register style controls * * @since 2.1.0 * @return void */ public function register_style_controls() { $this->register_position_style_controls(); $this->register_bullets_style_controls(); $this->register_tooltip_style_controls(); } /** * Register settings controls * * @since 2.1.0 * @return void */ public function register_settings_controls() { $this->parent->start_injection( [ 'type' => 'section', 'at' => 'start', 'of' => 'section_settings', ] ); $this->add_control( 'notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => sprintf( __( '%1$sImportant note:%2$s You can position the bullets as fixed on the page using the Elementor Custom Positioning controls.', 'elementor-extras' ), '<strong>', '</strong>' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', ] ); $this->parent->end_injection(); $this->parent->start_injection( [ 'type' => 'section', 'at' => 'end', 'of' => 'section_settings', ] ); $this->add_control( 'tooltips', [ 'label' => __( 'Enable Tooltips', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->parent->end_injection(); $this->parent->start_injection( [ 'of' => '_skin', ] ); $this->add_responsive_control( 'direction', [ 'label' => __( 'Direction', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'vertical', 'options' => [ 'vertical' => __( 'Vertical', 'elementor-extras' ), 'horizontal' => __( 'Horizontal', 'elementor-extras' ), ], 'prefix_class' => 'ee-scroll-indicator-direction%s--', ] ); $this->parent->end_injection(); } /** * Register height style controls * that depend on custom positioning * * @since 2.1.0 * @return void */ public function register_position_style_controls() { $this->start_controls_section( 'section_position', [ 'label' => __( 'Custom Positioning', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ '_position' => 'fixed', $this->get_control_id( 'direction' ) => 'vertical', ], ] ); $this->add_control( 'notice_fixed', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'You have chosen to set the position of the widget to fixed. Here you can modify the height of widget for better positioning.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', 'condition' => [ '_position' => 'fixed', $this->get_control_id( 'direction' ) => 'vertical', ], ] ); $this->add_responsive_control( 'wrapper_height', [ 'label' => __( 'Height', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Default', 'elementor-extras' ), 'inherit' => __( 'Full Height', 'elementor-extras' ) . ' (100%)', 'auto' => __( 'Inline', 'elementor-extras' ) . ' (auto)', 'initial' => __( 'Custom', 'elementor-extras' ), ], 'selectors_dictionary' => [ 'inherit' => '100%', ], 'prefix_class' => 'elementor-widget%s__height-', 'selectors' => [ '{{WRAPPER}}' => 'height: {{VALUE}}; max-height: {{VALUE}}', ], 'condition' => [ $this->get_control_id( 'direction' ) => 'vertical', '_position' => 'fixed', ] ] ); $this->add_responsive_control( 'custom_height', [ 'label' => __( 'Custom Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 1000, 'step' => 1, ], '%' => [ 'max' => 100, 'step' => 1, ], ], 'condition' => [ $this->get_control_id( 'direction' ) => 'vertical', $this->get_control_id( 'wrapper_height' ) => 'initial', '_position' => 'fixed', ], 'device_args' => [ Controls_Stack::RESPONSIVE_TABLET => [ 'condition' => [ 'height_tablet' => [ 'initial' ], ], ], Controls_Stack::RESPONSIVE_MOBILE => [ 'condition' => [ 'height_mobile' => [ 'initial' ], ], ], ], 'size_units' => [ 'px', '%', 'vh' ], 'selectors' => [ '{{WRAPPER}}' => 'height: {{SIZE}}{{UNIT}}; max-height: {{SIZE}}{{UNIT}}', ], ] ); $this->end_controls_section(); } /** * Register bullets style controls * * @since 2.1.0 * @return void */ public function register_bullets_style_controls() { $this->start_controls_section( 'section_bullets_style', [ 'label' => __( 'Bullets', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'square', [ 'label' => __( 'Square', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), ] ); $this->add_responsive_control( 'width', [ 'label' => __( 'Width (px)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__wrapper' => 'width: {{SIZE}}{{UNIT}};', ], 'condition' => [ $this->get_control_id( 'square' ) => '', ], ] ); $this->add_responsive_control( 'height', [ 'label' => __( 'Height (px)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__wrapper' => 'height: {{SIZE}}{{UNIT}};', ], 'condition' => [ $this->get_control_id( 'square' ) => '', ], ] ); $this->add_responsive_control( 'size', [ 'label' => __( 'Size (px)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 2, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__wrapper' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', ], 'condition' => [ $this->get_control_id( 'square!' ) => '', ], ] ); $this->add_control( 'border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'em' => [ 'min' => 0, 'max' => 5, 'step' => 0.1, ], 'rem' => [ 'min' => 0, 'max' => 5, 'step' => 0.1, ], 'px' => [ 'min' => 0, 'max' => 50, 'step' => 1, ], '%' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], ], 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__wrapper' => 'border-radius: {{SIZE}}{{UNIT}}', ], ] ); $this->add_control( 'spacing', [ 'label' => __( 'Spacing (px)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}}.ee-scroll-indicator-direction--vertical .ee-scroll-indicator__element:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};', '{{WRAPPER}}.ee-scroll-indicator-direction--horizontal .ee-scroll-indicator__element' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}}.ee-scroll-indicator-direction--horizontal .ee-scroll-indicator__menu' => 'margin-left: -{{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'padding', [ 'label' => __( 'Padding (px)', 'elementor-extras' ), 'description' => __( 'Padding makes the hoverable area bigger which is useful for smaller bullets', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link' => 'padding: {{SIZE}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'bullets', 'label' => __( 'Border', 'elementor-extras' ), 'exclude' => [ 'color' ], 'selector' => '{{WRAPPER}} .ee-scroll-indicator__element__wrapper', ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'bullets', 'selector' => '{{WRAPPER}} .ee-scroll-indicator__element__wrapper', 'separator' => '', ] ); $this->start_controls_tabs( 'indicators' ); $this->start_controls_tab( 'indicators_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__wrapper' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'border_color', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__wrapper' => 'border-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'bullets_border' ) . '!' => '', ] ] ); $this->end_controls_tab(); $this->start_controls_tab( 'indicators_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link:hover .ee-scroll-indicator__element__wrapper' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'border_color_hover', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link:hover .ee-scroll-indicator__element__wrapper' => 'border-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'bullets_border' ) . '!' => '', ] ] ); $this->add_control( 'scale_hover', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 2, 'step' => 10, ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link:hover .ee-scroll-indicator__element__wrapper' => 'transform: scale({{SIZE}});', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'indicators_reading', [ 'label' => __( 'Reading', 'elementor-extras' ) ] ); $this->add_control( 'background_color_reading', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--reading .ee-scroll-indicator__element__wrapper' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'border_color_reading', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--reading .ee-scroll-indicator__element__wrapper' => 'border-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'bullets_border' ) . '!' => '', ] ] ); $this->add_control( 'scale_reading', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 10, 'step' => 0.01, ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--reading .ee-scroll-indicator__element__wrapper' => 'transform: scale({{SIZE}});', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'indicators_read', [ 'label' => __( 'Read', 'elementor-extras' ) ] ); $this->add_control( 'background_color_read', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_ACCENT, ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--read .ee-scroll-indicator__element__wrapper' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'border_color_read', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--read .ee-scroll-indicator__element__wrapper' => 'border-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'bullets_border' ) . '!' => '', ] ] ); $this->add_control( 'scale_read', [ 'label' => __( 'Scale', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 2, 'step' => 10, ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--read .ee-scroll-indicator__element__wrapper' => 'transform: scale({{SIZE}});', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'progress_heading', [ 'label' => __( 'Progress', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'background_color_progress', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__progress' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_section(); } /** * Get default nav class * * @since 2.1.0 * @return void */ public function get_nav_class() { return 'ee-nav ee-nav--flush'; } /** * Render element item content * * @since 2.1.0 * @return void */ public function render_element_content( $index, $section ) { $settings = $this->parent->get_settings(); $wrapper_key = $this->parent->_get_repeater_setting_key( 'wrapper', 'sections', $index ); $link_key = $this->parent->_get_repeater_setting_key( 'link', 'sections', $index ); $progress_key = $this->parent->_get_repeater_setting_key( 'progress', 'sections', $index ); $tooltip_content_key = $this->parent->_get_repeater_setting_key( 'tooltip_content', 'sections', $index ); $content_id = $this->parent->get_id() . '_' . $section['_id']; $this->parent->add_render_attribute( [ $wrapper_key => [ 'class' => [ 'ee-scroll-indicator__element__wrapper', ], ], $link_key => [ 'class' => [ 'ee-scroll-indicator__element__link', ], ], $progress_key => [ 'class' => [ 'ee-scroll-indicator__element__progress', 'ee-cover', ] ] ] ); if ( '' !== $this->get_instance_value( 'tooltips' ) ) { $this->parent->add_render_attribute( [ $link_key => [ 'class' => 'hotip', 'data-hotips-content' => '#hotip-content-' . $content_id, 'data-hotips-class' => [ 'ee-global', 'ee-tooltip', 'ee-tooltip-' . $this->parent->get_id(), ], ], $tooltip_content_key => [ 'class' => 'hotip-content', 'id' => 'hotip-content-' . $content_id, ], ] ); } if ( 'yes' === $settings['click'] ) { $this->parent->add_render_attribute( $link_key, 'class', 'has--cursor' ); } else { if ( '' !== $section['link'] && ! empty( $section['url'] ) ) { $this->parent->add_render_attribute( $link_key, 'href', $section['url'] ); if ( '' !== $section['link_new_window'] ) { $this->parent->add_render_attribute( $link_key, 'target', '_blank' ); } } } ?> <a <?php echo $this->parent->get_render_attribute_string( $link_key ); ?>> <div <?php echo $this->parent->get_render_attribute_string( $wrapper_key ); ?>> <div <?php echo $this->parent->get_render_attribute_string( $progress_key ); ?>></div> <?php if ( '' !== $this->get_instance_value( 'tooltips' ) ) { ?> <span <?php echo $this->parent->get_render_attribute_string( $tooltip_content_key ); ?>> <?php echo $this->parent->_parse_text_editor( $section['title'] ); ?> </span> <?php } ?> </div> </a> <?php } } scroll-indicator/skins/skin-list.php 0000644 00000070520 15112147616 0013601 0 ustar 00 <?php namespace ElementorExtras\Modules\ScrollIndicator\Skins; // Extras for Elementor Classes use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Controls_Stack; use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Typography; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\ScrollIndicator\Skins * * @since 2.1.0 */ class Skin_List extends Skin_Base { /** * Get ID * * Gets the current skin ID * * @since 2.1.0 * @return string */ public function get_id() { return 'list'; } /** * Get Title * * Gets the current skin title * * @since 2.1.0 * @return string */ public function get_title() { return __( 'List', 'elementor-extras' ); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.1.0 * @return void */ protected function _register_controls_actions() { parent::_register_controls_actions(); add_action( 'elementor/element/ee-scroll-indicator/section_settings/after_section_end', [ $this, 'register_settings_controls' ] ); add_action( 'elementor/element/ee-scroll-indicator/section_settings/after_section_end', [ $this, 'register_elements_style_controls' ] ); add_action( 'elementor/element/ee-scroll-indicator/section_settings/after_section_end', [ $this, 'register_numbers_style_controls' ] ); add_action( 'elementor/element/ee-scroll-indicator/section_settings/after_section_end', [ $this, 'register_text_style_controls' ] ); } /** * Register settings controls * * @since 2.1.0 * @return void */ public function register_settings_controls() { $this->parent->start_injection( [ 'type' => 'section', 'at' => 'start', 'of' => 'section_settings', ] ); $this->add_control( 'notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => sprintf( __( '%1$sImportant note:%2$s Use the Elementor or Extras sticky functionality to keep the list in view.', 'elementor-extras' ), '<strong>', '</strong>' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', ] ); $this->parent->end_injection(); $this->parent->start_injection( [ 'of' => '_skin', ] ); $this->add_control( 'direction', [ 'label' => __( 'Direction', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'vertical', 'options' => [ 'vertical' => __( 'Vertical', 'elementor-extras' ), 'horizontal' => __( 'Horizontal', 'elementor-extras' ), ], 'prefix_class' => 'ee-scroll-indicator-direction--', ] ); $this->add_control( 'show', [ 'label' => __( 'Show', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Numbers & Text', 'elementor-extras' ), 'numbers' => __( 'Numbers', 'elementor-extras' ), 'text' => __( 'Text', 'elementor-extras' ), ], ] ); $this->add_control( 'title_html_tag', [ 'label' => __( 'Title HTML Tag', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'h4', 'options' => [ 'h1' => __( 'H1', 'elementor-extras' ), 'h2' => __( 'H2', 'elementor-extras' ), 'h3' => __( 'H3', 'elementor-extras' ), 'h4' => __( 'H4', 'elementor-extras' ), 'h5' => __( 'H5', 'elementor-extras' ), 'h6' => __( 'H6', 'elementor-extras' ), 'div' => __( 'div', 'elementor-extras' ), 'span' => __( 'span', 'elementor-extras' ), 'p' => __( 'p', 'elementor-extras' ), ], 'condition' <> [ $this->get_control_id( 'show!' ) => [ '', 'text' ], ], ] ); $this->add_control( 'subtitle_html_tag', [ 'label' => __( 'Subtitle HTML Tag', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'h6', 'options' => [ 'h1' => __( 'H1', 'elementor-extras' ), 'h2' => __( 'H2', 'elementor-extras' ), 'h3' => __( 'H3', 'elementor-extras' ), 'h4' => __( 'H4', 'elementor-extras' ), 'h5' => __( 'H5', 'elementor-extras' ), 'h6' => __( 'H6', 'elementor-extras' ), 'div' => __( 'div', 'elementor-extras' ), 'span' => __( 'span', 'elementor-extras' ), 'p' => __( 'p', 'elementor-extras' ), ], 'condition' <> [ $this->get_control_id( 'show!' ) => [ '', 'text' ], ], ] ); $this->parent->end_injection(); } /** * Register content controls * * @since 2.1.0 * @return void */ public function register_content_controls() { parent::register_content_controls(); } /** * Register elements style controls * * @since 2.1.0 * @return void */ public function register_elements_style_controls() { $this->start_controls_section( 'section_elements_style', [ 'label' => __( 'Elements', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'spacing', [ 'label' => __( 'Spacing (px)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}}:not(.ee-scroll-indicator-direction--horizontal) .ee-scroll-indicator__element:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};', '{{WRAPPER}}.ee-scroll-indicator-direction--horizontal .ee-scroll-indicator__element' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}}.ee-scroll-indicator-direction--horizontal .ee-scroll-indicator__menu' => 'margin-left: -{{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'items', 'selector' => '{{WRAPPER}} .ee-scroll-indicator__element__link, {{WRAPPER}} .ee-scroll-indicator__element__number, {{WRAPPER}} .ee-scroll-indicator__element__bullet, {{WRAPPER}} .ee-scroll-indicator__element__title, {{WRAPPER}} .ee-scroll-indicator__element__subtitle', 'separator' => '', ] ); $this->start_controls_tabs( 'items' ); $this->start_controls_tab( 'item_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'number_background_color', [ 'label' => __( 'Number Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link .ee-scroll-indicator__element__bullet' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], ], ] ); $this->add_control( 'number_border_color', [ 'label' => __( 'Number Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link .ee-scroll-indicator__element__bullet' => 'border-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], $this->get_control_id( 'numbers_border!' ) => '', ], ] ); $this->add_control( 'number_color', [ 'label' => __( 'Number Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__number' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], ], ] ); $this->add_control( 'title_color', [ 'label' => __( 'Title Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__title' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'text' ], ], ] ); $this->add_control( 'subtitle_color', [ 'label' => __( 'Subtitle Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__subtitle' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'text' ], ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'item_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link:hover' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], ], ] ); $this->add_control( 'number_background_color_hover', [ 'label' => __( 'Number Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link:hover .ee-scroll-indicator__element__bullet' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], ], ] ); $this->add_control( 'number_border_color_hover', [ 'label' => __( 'Number Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link:hover .ee-scroll-indicator__element__bullet' => 'border-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], $this->get_control_id( 'numbers_border!' ) => '', ], ] ); $this->add_control( 'number_color_hover', [ 'label' => __( 'Number Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link:hover .ee-scroll-indicator__element__number' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'title_color_hover', [ 'label' => __( 'Title Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link:hover .ee-scroll-indicator__element__title' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'text' ], ], ] ); $this->add_control( 'subtitle_color_hover', [ 'label' => __( 'Subtitle Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link:hover .ee-scroll-indicator__element__subtitle' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'text' ], ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'item_reading', [ 'label' => __( 'Reading', 'elementor-extras' ) ] ); $this->add_control( 'background_color_reading', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--reading' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'number_background_color_reading', [ 'label' => __( 'Number Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--reading .ee-scroll-indicator__element__bullet' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], ], ] ); $this->add_control( 'number_border_color_reading', [ 'label' => __( 'Number Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--reading .ee-scroll-indicator__element__bullet' => 'border-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], $this->get_control_id( 'numbers_border!' ) => '', ], ] ); $this->add_control( 'number_color_reading', [ 'label' => __( 'Number Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--reading .ee-scroll-indicator__element__number' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], ], ] ); $this->add_control( 'progress_color_reading', [ 'label' => __( 'Progress Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--reading .ee-scroll-indicator__element__circle circle' => 'stroke: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], ], ] ); $this->add_control( 'title_color_reading', [ 'label' => __( 'Title Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--reading .ee-scroll-indicator__element__title' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'text' ], ], ] ); $this->add_control( 'subtitle_color_reading', [ 'label' => __( 'Subtitle Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--reading .ee-scroll-indicator__element__subtitle' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'text' ], ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'item_read', [ 'label' => __( 'Read', 'elementor-extras' ) ] ); $this->add_control( 'background_color_read', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--read' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'number_background_color_read', [ 'label' => __( 'Number Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--read .ee-scroll-indicator__element__bullet' => 'background-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], ], ] ); $this->add_control( 'number_border_color_read', [ 'label' => __( 'Number Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--read .ee-scroll-indicator__element__bullet' => 'border-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], $this->get_control_id( 'numbers_border!' ) => '', ], ] ); $this->add_control( 'number_color_read', [ 'label' => __( 'Number Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_ACCENT, ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--read .ee-scroll-indicator__element__number' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], ], ] ); $this->add_control( 'progress_color_read', [ 'label' => __( 'Progress Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_ACCENT, ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--read .ee-scroll-indicator__element__circle circle' => 'stroke: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], ], ] ); $this->add_control( 'title_color_read', [ 'label' => __( 'Title Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_ACCENT, ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--read .ee-scroll-indicator__element__title' => 'color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'text' ], ], ] ); $this->add_control( 'subtitle_color_read', [ 'label' => __( 'Subtitle Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_ACCENT, ], 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'text' ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__link.is--read .ee-scroll-indicator__element__subtitle' => 'color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'separators', [ 'label' => __( 'Separators', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'separator' => 'before', ] ); $this->add_responsive_control( 'separator_thickness', [ 'label' => __( 'Separator Thickness', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 5, ], ], 'condition' => [ $this->get_control_id( 'separators' ) => 'yes', ], 'selectors' => [ '{{WRAPPER}}.ee-scroll-indicator-direction--vertical .ee-scroll-indicator__element:not(:last-child)' => 'border-bottom: {{SIZE}}px solid;', '{{WRAPPER}}.ee-scroll-indicator-direction--horizontal .ee-scroll-indicator__element:not(:last-child)' => 'border-right: {{SIZE}}px solid;', ], ] ); $this->add_control( 'separator_color', [ 'label' => __( 'Separators Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}.ee-scroll-indicator-direction--vertical .ee-scroll-indicator__element:not(:last-child)' => 'border-bottom-color: {{VALUE}};', '{{WRAPPER}}.ee-scroll-indicator-direction--horizontal .ee-scroll-indicator__element:not(:last-child)' => 'border-right-color: {{VALUE}};', ], 'condition' => [ $this->get_control_id( 'separators' ) => 'yes', ], ] ); $this->end_controls_section(); } /** * Register numbers style controls * * @since 2.1.0 * @return void */ public function register_numbers_style_controls() { $this->start_controls_section( 'section_numbers_style', [ 'label' => __( 'Numbers', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'numbers' ], ], ] ); $this->add_control( 'numbers_align', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'label_block' => false, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'top' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], 'bottom' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], ], 'prefix_class' => 'ee-scroll-indicator-numbers--', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'numbers', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, ], 'selector' => '{{WRAPPER}} .ee-scroll-indicator__element__number', ] ); $this->add_responsive_control( 'numbers_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 2, 'max' => 10, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__bullet' => 'width: {{SIZE}}em; height: {{SIZE}}em;', ], ] ); $this->add_control( 'numbers_spacing', [ 'label' => __( 'Spacing (px)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}}.ee-scroll-indicator-numbers--left .ee-scroll-indicator__element__bullet' => 'margin-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}}.ee-scroll-indicator-numbers--right .ee-scroll-indicator__element__bullet' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}}.ee-scroll-indicator-numbers--top .ee-scroll-indicator__element__bullet' => 'margin-bottom: {{SIZE}}{{UNIT}};', '{{WRAPPER}}.ee-scroll-indicator-numbers--bottom .ee-scroll-indicator__element__bullet' => 'margin-top: {{SIZE}}{{UNIT}};', ], 'condition' => [ $this->get_control_id( 'show' ) => '', ], ] ); $this->add_responsive_control( 'progress_thickness', [ 'label' => __( 'Progress Thickness', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 4, ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__circle circle' => 'stroke-width: {{SIZE}}px;', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'numbers', 'label' => __( 'Border', 'elementor-extras' ), 'exclude' => [ 'width', 'color' ], 'selector' => '{{WRAPPER}} .ee-scroll-indicator__element__bullet', ] ); $this->add_responsive_control( 'numbers_border_width', [ 'label' => __( 'Border Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 1, 'max' => 4, ], ], 'condition' => [ $this->get_control_id( 'numbers_border!' ) => '', ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__bullet' => 'border-width: {{SIZE}}px;', ], ] ); $this->end_controls_section(); } /** * Register text style controls * * @since 2.1.0 * @return void */ public function register_text_style_controls() { $this->start_controls_section( 'section_text_style', [ 'label' => __( 'Text', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ $this->get_control_id( 'show' ) => [ '', 'text' ], ], ] ); $this->add_responsive_control( 'text_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__text' => 'text-align: {{VALUE}};', ] ] ); $this->add_control( 'title_heading', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title', 'label' => __( 'Title', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_SECONDARY, ], 'selector' => '{{WRAPPER}} .ee-scroll-indicator__element__title', ] ); $this->add_responsive_control( 'title_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-scroll-indicator__element__title' => 'margin-bottom: {{SIZE}}px;', ], ] ); $this->add_control( 'subtitle_heading', [ 'label' => __( 'Subtitle', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'subtitle', 'label' => __( 'Subtitle', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_ACCENT, ], 'selector' => '{{WRAPPER}} .ee-scroll-indicator__element__subtitle', ] ); $this->end_controls_section(); } /** * Render widget content * * @since 2.1.0 * @return void */ public function render() { $this->parent->add_render_attribute( 'wrapper', 'class', 'ee-scroll-indicator-show--' . $this->get_instance_value( 'show' ) ); parent::render(); } /** * Get default nav class * * @since 2.1.0 * @return void */ public function get_nav_class() { return ''; } /** * Render element item content * * @since 2.1.0 * @return void */ public function render_element_content( $index, $section ) { parent::render_element_content( $index, $section ); $settings = $this->parent->get_settings(); $link_key = $this->parent->_get_repeater_setting_key( 'link', 'sections', $index ); $this->parent->add_render_attribute( [ $link_key => [ 'class' => [ 'ee-scroll-indicator__element__link', ], ], ] ); if ( 'yes' === $settings['click'] ) { $this->parent->add_render_attribute( $link_key, 'class', 'has--cursor' ); } else { if ( '' !== $section['link'] && ! empty( $section['url'] ) ) { $this->parent->add_render_attribute( $link_key, 'href', $section['url'] ); if ( '' !== $section['link_new_window'] ) { $this->parent->add_render_attribute( $link_key, 'target', '_blank' ); } } } ?> <a <?php echo $this->parent->get_render_attribute_string( $link_key ); ?>> <?php $this->render_element_bullet( $index, $section ); $this->render_element_text( $index, $section ); ?> </a> <?php } /** * Render bullet markup * * @since 2.1.0 * @return void */ public function render_element_bullet( $index, $section ) { parent::render_element_bullet( $index, $section ); } /** * Render text markup * * @since 2.1.0 * @return void */ public function render_element_text( $index, $section ) { parent::render_element_text( $index, $section ); } } scroll-indicator/widgets/scroll-indicator.php 0000644 00000023122 15112147616 0015447 0 ustar 00 <?php namespace ElementorExtras\Modules\ScrollIndicator\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\ScrollIndicator\Skins; use ElementorExtras\Modules\ScrollIndicator\Module as Module; use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Utils; use Elementor\Repeater; use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Css_Filter; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Scroll_Indicator * * @since 2.1.0 */ class Scroll_Indicator extends Extras_Widget { /** * Has template content * * @since 2.1.0 * @var bool */ protected $_has_template_content = false; /** * Nav menu index * * @since 2.1.0 * @var int */ protected $nav_menu_index = 1; /** * Get Name * * Get the name of the widget * * @since 2.1.0 * @return string */ public function get_name() { return 'ee-scroll-indicator'; } /** * Get Title * * Get the title of the widget * * @since 2.1.0 * @return string */ public function get_title() { return __( 'Scroll Indicator', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 2.1.0 * @return string */ public function get_icon() { return 'nicon nicon-scroll-indicator'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 2.1.0 * @return array */ public function get_script_depends() { return [ 'ee-scroll-indicator', 'hotips', ]; } /** * Whether the reload preview is required or not. * * Used to determine whether the reload preview is required. * * @since 2.1.0 * @return bool */ public function is_reload_preview_required() { return true; } /** * Register Skins * * @since 2.1.0 * @return void */ protected function register_skins() { $this->add_skin( new Skins\Skin_List( $this ) ); $this->add_skin( new Skins\Skin_Bar( $this ) ); $this->add_skin( new Skins\Skin_Bullets( $this ) ); } /** * Register Widget Controls * * @since 2.1.0 * @return void */ protected function _register_controls() { // Content tab $this->register_settings_controls(); $this->register_content_controls(); } /** * Register Settings Controls * * @since 2.1.0 * @return void */ protected function register_settings_controls() { $this->start_controls_section( 'section_settings', [ 'label' => __( 'Settings', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'click', [ 'label' => __( 'Enable Click to Scroll', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'scroll_offset', [ 'label' => __( 'Scroll Offset', 'elementor-extras' ), 'description' => __( 'Offset for scrolling to element on click.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'frontend_available' => true, 'default' => [ 'size' => 0, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => -200, 'max' => 200, 'step' => 1, ], ], 'condition' => [ 'click!' => '', ], ] ); $this->end_controls_section(); } /** * Register Content Controls * * @since 2.1.0 * @return void */ protected function register_content_controls() { $this->start_controls_section( 'section_elements', [ 'label' => __( 'Sections', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $repeater = new Repeater(); $repeater->add_control( 'selector', [ 'label' => __( 'Element ID', 'elementor-extras' ), 'description' => __( 'Enter the element CSS ID which you want the indicator to for this section.', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'title' => __( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor-extras' ), ] ); $repeater->add_control( 'title', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => __( 'Element title', 'elementor-extras' ), ] ); $repeater->add_control( 'subtitle', [ 'label' => __( 'Subtitle', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => __( 'Element subtitle', 'elementor-extras' ), ] ); $repeater->add_control( 'link', [ 'separator' => 'before', 'label' => __( 'Enable Link', 'elementor-extras' ), 'description' => __( 'Links only work if Settings > Enable Click to Scroll is disabled', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'label_block' => false, ] ); $repeater->add_control( 'url', [ 'label' => __( 'URL', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'placeholder' => esc_url( home_url( '/' ) ), 'dynamic' => [ 'active' => true ], 'label_block' => false, 'condition' => [ 'link!' => '', ], ] ); $repeater->add_control( 'link_new_window', [ 'label' => __( 'Open in new window', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'link!' => '', ], ] ); $repeater->start_controls_tabs( 'progress' ); $repeater->start_controls_tab( 'tab_progress_start', [ 'label' => __( 'Start', 'elementor-extras' ) ] ); $repeater->add_control( 'progress_start', [ 'label' => __( 'Start At', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'description' => __( 'Set when the progress starts. Example: "Top to Top" means progress starts when the top of the window hits the top of section.', 'elementor-extras' ), 'default' => 'top-top', 'label_block' => false, 'options' => [ 'top-top' => [ 'title' => __( 'Top to Top', 'elementor-extras' ), 'icon' => 'nicon nicon-top-top', ], 'bottom-top' => [ 'title' => __( 'Bottom to Top', 'elementor-extras' ), 'icon' => 'nicon nicon-bottom-top', ], ], ] ); $repeater->add_control( 'progress_start_offset', [ 'label' => __( 'Start Offset', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => -200, 'max' => 200, 'step' => 1, ], ], ] ); $repeater->end_controls_tab(); $repeater->start_controls_tab( 'tab_progress_end', [ 'label' => __( 'End', 'elementor-extras' ) ] ); $repeater->add_control( 'progress_end', [ 'label' => __( 'End At', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'description' => __( 'Set when the progress ends. Example: "Top to Bottom" means progress ends when the top of the window hits the bottom of section.', 'elementor-extras' ), 'default' => 'top-bottom', 'label_block' => false, 'options' => [ 'top-bottom' => [ 'title' => __( 'Top to Bottom', 'elementor-extras' ), 'icon' => 'nicon nicon-top-bottom', ], 'bottom-bottom' => [ 'title' => __( 'Bottom to Bottom', 'elementor-extras' ), 'icon' => 'nicon nicon-bottom-bottom', ], ], ] ); $repeater->add_control( 'progress_end_offset', [ 'label' => __( 'End Offset', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => -200, 'max' => 200, 'step' => 1, ], ], ] ); $repeater->end_controls_tab(); $repeater->end_controls_tabs(); $this->add_control( 'sections', [ 'label' => '', 'type' => Controls_Manager::REPEATER, 'default' => [ [ 'selector' => '', 'title' => __( 'Section', 'elementor-extras' ), 'subtitle' => __( 'Section subtitle', 'elementor-extras' ), ], ], 'fields' => $repeater->get_controls(), 'title_field' => '{{{ title }}}', ] ); $this->end_controls_section(); } /** * parse_text_editor wrapper * * @since 2.1.0 * @return void */ public function _parse_text_editor( $content ) { return $this->parse_text_editor( $content ); } /** * get_repeater_setting_key wrapper * * @since 2.1.0 * @return void */ public function _get_repeater_setting_key( $setting_key, $repeater_key, $repeater_item_index ) { return $this->get_repeater_setting_key( $setting_key, $repeater_key, $repeater_item_index ); } /** * Render widget content * * @since 2.1.0 * @return void */ public function render() { } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 2.1.0 * @return void */ public function content_template() {} } scroll-indicator/module.php 0000644 00000001172 15112147616 0012017 0 ustar 00 <?php namespace ElementorExtras\Modules\ScrollIndicator; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\ScrollIndicator\Module * * @since 2.1.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 2.1.0 * @return string */ public function get_name() { return 'scroll-indicator'; } /** * Get Widgets * * Get the modules' widgets * * @since 2.1.0 * @return array */ public function get_widgets() { return [ 'Scroll_Indicator', ]; } } search/conditions/search-id.php 0000644 00000001617 15112147616 0012543 0 ustar 00 <?php namespace ElementorExtras\Modules\Search\Conditions; use Elementor\Controls_Manager; use ElementorPro\Modules\ThemeBuilder as ThemeBuilder; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Search_Id extends ThemeBuilder\Conditions\Condition_Base { public static function get_type() { return 'archive'; } public static function get_priority() { return 71; } public function get_name() { return 'ee-search-id'; } public function get_label() { return __( 'Extras Search Results', 'elementor-extras' ); } public function check( $args = null ) { return is_search() && get_query_var('ee_search_id') === $args['id']; } protected function _register_controls() { $this->add_control( 'search_form_id', [ 'section' => 'settings', 'type' => Controls_Manager::TEXT, 'placeholder' => __( 'Search ID', 'elementor-extras' ) ] ); } } search/skins/skin-base.php 0000644 00000023125 15112147616 0011534 0 ustar 00 <?php namespace ElementorExtras\Modules\Search\Skins; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Base\Extras_Widget; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Skin_Base as Elementor_Skin_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Search\Skins * * @since 2.1.0 */ abstract class Skin_Base extends Elementor_Skin_Base { /** * Get Parent Widget * * @since 2.1.0 * @return $widget Extras_Widget */ public function get_widget() { return $this->parent; } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.1.0 * @return void */ protected function _register_controls_actions() { add_action( 'elementor/element/ee-search-form/section_button/before_section_end', [ $this, 'register_controls' ] ); } /** * Register Controls * * @since 2.1.0 * @return void * @param $widget Extras_Widget */ public function register_controls( Extras_Widget $widget ) { $this->parent = $widget; } /** * Register Content Controls * * @since 2.1.0 * @return void */ public function register_content_controls() { $this->parent->start_injection( [ 'at' => 'after', 'of' => $this->get_control_id('icon'), ] ); $this->add_control( 'icon_style', [ 'label' => __( 'Style', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'thin', 'options' => [ 'thin' => __( 'Thin', 'elementor-extras' ), 'thick' => __( 'Thick', 'elementor-extras' ), ], 'condition' => [ $this->get_control_id('icon!') => [ 'triangle', '' ], ], 'render_type' => 'template', ] ); $this->parent->end_injection(); } /** * Register Style Controls * * @since 2.1.0 * @return void */ public function register_base_style_controls() {} /** * Add Actions * * Registers actions for rendering * * @since 2.1.0 * @return void */ protected function add_actions() { add_action( 'elementor-extras/search-form/form/after_start', [ $this->parent, 'render_hidden_fields' ], 20 ); } /** * Render widget * * @since 2.1.0 * @return void */ public function render() { $this->parent->render(); $this->add_actions(); } /** * Render Form * * @since 2.1.0 * @return void */ public function has_button_label() { if ( '' === $this->get_instance_value('button_label') || '' === trim( $this->get_instance_value('button_label_text') ) || empty( $this->get_instance_value('button_label_text') ) ) return false; return true; } /** * Render Form * * @since 2.1.0 * @return void */ public function render_form() { $settings = $this->parent->get_settings(); $this->parent->add_render_attribute( 'form', [ 'class' => [ 'ee-form', 'ee-search-form', 'ee-search-form-skin--' . $settings['_skin'], ], 'role' => 'search', 'action' => $this->parent->get_search_url(), 'method' => 'get', 'value' => get_search_query(), ] ); ?><form <?php echo $this->parent->get_render_attribute_string( 'form' ); ?>> <?php $this->after_form_start(); $this->render_form_container(); $this->before_form_end(); ?></form><?php } /** * After Form Start * * @since 2.1.0 * @return void */ public function after_form_start() { $this->parent->render_hidden_fields(); } /** * Before Form End * * @since 2.1.0 * @return void */ public function before_form_end() {} /** * Render Form Container * * @since 2.1.0 * @return void */ public function render_form_container() { $this->parent->add_render_attribute( 'form-container', 'class', 'ee-search-form__container' ); ?><div <?php echo $this->parent->get_render_attribute_string( 'form-container' ); ?>><?php $this->render_form_container_content(); ?></div><?php } /** * Render Form Container Content * * @since 2.1.0 * @return void */ public function render_form_container_content() { $this->render_fields(); } /** * Render Form Input * * @since 2.1.0 * @return void */ public function render_fields() { $settings = $this->parent->get_settings_for_display(); $this->parent->add_render_attribute( [ 'fields' => [ 'class' => [ 'ee-form__fields', 'ee-search-form__fields', ], ], ] ); $widget_id = $this->parent->get_id(); ?><div <?php echo $this->parent->get_render_attribute_string( 'fields' ); ?>> <?php $this->before_fields(); $this->render_input(); $this->after_fields(); ?> </div><?php } /** * Before Fields * * @since 2.1.0 * @return void */ public function before_fields() {} /** * After Fields * * @since 2.1.0 * @return void */ public function after_fields() {} /** * Render Form Input Field * * @since 2.1.0 * @return void */ public function render_input() { $settings = $this->parent->get_settings_for_display(); $input_attributes = [ 'placeholder' => $settings['input_placeholder'], 'class' => [ 'ee-search-form__input', 'ee-form__field__control', 'ee-form__field__control--search', 'ee-form__field__control--text', 'ee-form__field__control--sent', 'ee-form__field__control--input', ], 'type' => 'search', 'name' => 's', 'title' => __( 'Search', 'elementor-extras' ), 'value' => get_search_query(), ]; /** * Search Query Input Attributes Filter * * @since 2.2.49 * @param array $input_attributes The default input attributes * @param array $settings The widget settings */ $input_attributes = apply_filters( 'elementor_extras/widgets/search-form/input/attributes', $input_attributes, $settings ); $this->parent->add_render_attribute( [ 'field' => [ 'class' => [ 'ee-form__field', 'ee-form__field--input', 'ee-form__field--search', 'ee-search-form__field', ], ], 'input' => $input_attributes, ] ); ?><div <?php echo $this->parent->get_render_attribute_string( 'field' ); ?>> <input <?php echo $this->parent->get_render_attribute_string( 'input' ); ?>> </div><?php } /** * Render Filters * * @since 2.1.0 * @return void */ public function render_filters() { $this->parent->render_filters(); } /** * Render Filters * * @since 2.1.0 * @return void */ public function render_filters_toggle() { $settings = $this->parent->get_settings_for_display(); if ( ! $this->parent->_fields ) return; $this->parent->add_render_attribute( [ 'filters-toggle' => [ 'class' => [ 'ee-search-form__filters-toggle', 'nicon nicon-filter', ], ], ] ); ?><span <?php echo $this->parent->get_render_attribute_string( 'filters-toggle' ); ?>></span><?php } /** * Render Button * * @since 2.1.0 * @return void */ public function render_button() { $this->parent->add_render_attribute( 'button', [ 'class' => [ 'ee-search-form__submit', 'ee-form__field__control', 'ee-form__field__control--submit', 'ee-form__field__control--text', 'ee-form__field__control--sent', 'ee-form__field__control--button', ], 'type' => 'submit', ] ); if ( $this->has_button_label() ) { $this->parent->add_render_attribute( 'button', 'class', 'ee-search-form__submit--has-label' ); } else { $this->parent->add_render_attribute( 'button', 'class', 'ee-search-form__control--icon' ); } ?><button <?php echo $this->parent->get_render_attribute_string( 'button' ); ?>> <?php $this->render_button_content(); ?> </button><?php } /** * Render Button Content * * @since 2.1.0 * @return void */ public function render_button_content() { $this->render_button_label(); $this->render_icon(); } /** * Render Button Icon * * @since 2.1.0 * @return void */ public function render_icon() { $settings = $this->parent->get_settings(); $icon = $this->get_instance_value( 'icon' ); $icon_style = $this->get_instance_value( 'icon_style' ); if ( '' === $icon ) return; $icon_style = ( 'thin' !== $icon_style ) ? '-thick' : ''; $icon_class = 'search'; switch ( $icon ) { case 'arrow' : $icon_class = is_rtl() ? 'arrow-left' : 'arrow-right'; break; case 'angle' : $icon_class = is_rtl() ? 'angle-left' : 'angle-right'; break; case 'triangle' : $icon_style = ''; $icon_class = is_rtl() ? 'triangle-left' : 'triangle-right'; break; default : break; } $this->parent->add_render_attribute( 'icon', [ 'class' => [ 'ee-search-form__icon', 'nicon nicon-' . $icon_class . $icon_style, ], 'aria-hidden' => 'true', ] ); ?><i <?php echo $this->parent->get_render_attribute_string( 'icon' ); ?>></i><?php } /** * Render Button Icon * * @since 2.1.0 * @return void */ public function render_button_label() { $settings = $this->parent->get_settings_for_display(); if ( ! $this->has_button_label() ) { $this->render_button_sr_label(); return; } echo $this->get_instance_value('button_label_text'); } /** * Render Button Screen Reader Label * * @since 2.2.40 * @return void */ public function render_button_sr_label() { $this->parent->add_render_attribute( 'screen-reader', 'class', 'elementor-screen-only' ); ?><span <?php echo $this->parent->get_render_attribute_string( 'screen-reader' ); ?>><?php /** * Separator filter * * Filters the separator * * @since 2.2.0 * @param string $post_title The markup for the separator */ echo apply_filters( 'elementor_extras/widgets/search-form/button/sr_text', __('Search', 'elementor-extras') ); ?></span><?php } } search/skins/skin-classic.php 0000644 00000023751 15112147616 0012250 0 ustar 00 <?php namespace ElementorExtras\Modules\Search\Skins; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Search\Skins * * @since 2.1.0 */ class Skin_Classic extends Skin_Base { /** * Get ID * * Gets the current skin ID * * @since 2.1.0 * @return string */ public function get_id() { return 'classic'; } /** * Get Title * * Gets the current skin title * * @since 2.1.0 * @return string */ public function get_title() { return __( 'Classic', 'elementor-extras' ); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.1.0 * @return void */ protected function _register_controls_actions() { parent::_register_controls_actions(); add_action( 'elementor/element/ee-search-form/section_button/before_section_end', [ $this, 'register_content_controls' ] ); add_action( 'elementor/element/ee-search-form/section_button_style/before_section_end', [ $this, 'register_style_controls' ] ); } /** * Register Content Controls * * @since 2.1.0 * @return void */ public function register_content_controls() { $this->register_button_content_controls(); parent::register_content_controls(); } /** * Register Style Controls * * @since 2.1.0 * @return void */ public function register_style_controls() { $this->register_form_style_controls(); $this->register_filters_style_controls(); $this->register_button_style_controls(); } /** * Register Button Content Controls * * @since 2.1.0 * @return void */ public function register_button_content_controls() { $this->parent->start_injection( [ 'type' => 'section', 'at' => 'start', 'of' => 'section_button', ] ); $this->add_control( 'heading_label_content', [ 'label' => __( 'Label', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'button_label', [ 'label' => __( 'Show Label', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_off' => __( 'Hide', 'elementor-extras' ), 'label_on' => __( 'Show', 'elementor-extras' ), ] ); $this->add_control( 'button_label_text', [ 'label' => __( 'Label', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Search', 'elementor-extras' ), 'separator' => 'after', 'condition' => [ $this->get_control_id( 'button_label!' ) => '', ], ] ); $this->parent->end_injection(); $this->parent->start_injection( [ 'at' => 'before', 'of' => 'icon_style', ] ); $this->add_control( 'icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'label_block' => false, 'default' => 'search', 'options' => [ '' => [ 'title' => __( 'Hide', 'elementor-extras' ), 'icon' => 'fa fa-eye-slash', ], 'search' => [ 'title' => __( 'Search', 'elementor-extras' ), 'icon' => 'nicon nicon-search', ], 'arrow' => [ 'title' => __( 'Arrow', 'elementor-extras' ), 'icon' => 'nicon nicon-arrow-right', ], 'angle' => [ 'title' => __( 'Angle', 'elementor-extras' ), 'icon' => 'nicon nicon-angle-right', ], 'triangle' => [ 'title' => __( 'Triangle', 'elementor-extras' ), 'icon' => 'nicon nicon-triangle-right', ], ], 'render_type' => 'template', 'prefix_class' => 'ee-search-form-icon--', ] ); $this->parent->end_injection(); $this->parent->start_injection( [ 'at' => 'after', 'of' => 'icon_style', ] ); $this->add_control( 'icon_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'right', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'condition' => [ $this->get_control_id( 'icon!' ) => '', $this->get_control_id( 'button_label!' ) => '', ], 'label_block' => false, 'prefix_class' => 'ee-search-form-icon-position--' ] ); $this->add_control( 'icon_distance', [ 'label' => __( 'Spacing', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 12, ], 'selectors' => [ 'body:not(.rtl) {{WRAPPER}}.ee-search-form-icon-position--left .ee-search-form__submit--has-label .ee-search-form__icon, body.rtl {{WRAPPER}}:not(.ee-search-form-icon-position--left) .ee-search-form__submit--has-label .ee-search-form__icon' => 'margin-right: {{SIZE}}px;', 'body:not(.rtl) {{WRAPPER}}:not(.ee-search-form-icon-position--left) .ee-search-form__submit--has-label .ee-search-form__icon, body.rtl {{WRAPPER}}.ee-search-form-icon-position--left .ee-search-form__submit--has-label .ee-search-form__icon' => 'margin-left: {{SIZE}}px;', ], 'condition' => [ $this->get_control_id( 'icon!' ) => '', $this->get_control_id( 'button_label!' ) => '', ], ] ); $this->parent->end_injection(); } /** * Register Form Style Controls * * @since 2.1.0 * @return void */ protected function register_form_style_controls() { $this->parent->start_injection( [ 'at' => 'after', 'of' => 'form_border_color', ] ); $this->add_responsive_control( 'form_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'description' => __( 'For perfectly rounded corners set this to half of the height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__container, {{WRAPPER}} .ee-search-form__filters .ee-form__field__control--text' => 'border-radius: {{SIZE}}px;', '{{WRAPPER}} .ee-search-form__filters .select2-container--open.select2-container--below .ee-form__field__control--select2, .ee-select2__dropdown--{{ID}}.select2-dropdown--above' => 'border-radius: {{SIZE}}px {{SIZE}}px 0 0', '{{WRAPPER}} .ee-search-form__filters .select2-container--open.select2-container--above .ee-form__field__control--select2, .ee-select2__dropdown--{{ID}}.select2-dropdown--below' => 'border-radius: 0 0 {{SIZE}}px {{SIZE}}px', ], 'condition' => [ 'collapse_spacing!' => '', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'form_box_shadow', 'selector' => '{{WRAPPER}} .ee-search-form__container', 'condition' => [ 'collapse_spacing!' => '', ], ] ); $this->parent->end_injection(); $this->parent->start_injection( [ 'type' => 'section', 'at' => 'start', 'of' => 'section_form_style', ] ); $this->add_responsive_control( 'form_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-search-form' => 'width: {{SIZE}}{{UNIT}}', ], ] ); $this->parent->end_injection(); $this->parent->start_injection( [ 'at' => 'after', 'of' => 'alignment', ] ); $this->add_control( 'fields_wrap', [ 'label' => __( 'Wrap on', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'desktop' => __( 'Desktop', 'elementor-extras' ), 'tablet' => __( 'Tablet', 'elementor-extras' ), 'mobile' => __( 'Mobile', 'elementor-extras' ), ], 'prefix_class' => 'ee-search-form-fields-wrap--', ] ); $this->parent->end_injection(); } /** * Register Filters Style Controls * * @since 2.1.0 * @return void */ protected function register_filters_style_controls() { $this->parent->start_injection( [ 'at' => 'after', 'of' => 'filters_custom', ] ); $this->parent->end_injection(); } /** * Register Icon Content Controls * * @since 2.1.0 * @return void */ public function register_button_style_controls() { $this->parent->start_injection( [ 'type' => 'section', 'at' => 'start', 'of' => 'section_button_style', ] ); $this->add_responsive_control( 'button_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__submit' => 'flex-basis: {{SIZE}}%', ], ] ); $this->parent->end_injection(); } /** * Render widget content * * @since 2.1.0 * @return void */ public function render() { parent::render(); $widget_id = $this->parent->get_id(); $this->render_form(); } /** * Before Form End * * @since 2.1.0 * @return void */ public function before_form_end() { $this->render_filters(); } /** * Before Fields * * @since 2.1.0 * @return void */ public function before_fields() {} /** * After Fields * * @since 2.1.0 * @return void */ public function after_fields() { $this->parent->render_inline_filters(); } /** * Render Form Container Content * * @since 2.1.0 * @return void */ public function render_form_container_content() { $this->render_fields(); $this->render_button(); } } search/skins/skin-expand.php 0000644 00000013251 15112147616 0012100 0 ustar 00 <?php namespace ElementorExtras\Modules\Search\Skins; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Search\Skins * * @since 2.1.0 */ class Skin_Expand extends Skin_Base { /** * Get ID * * Gets the current skin ID * * @since 2.1.0 * @return string */ public function get_id() { return 'expand'; } /** * Get Title * * Gets the current skin title * * @since 2.1.0 * @return string */ public function get_title() { return __( 'Expand', 'elementor-extras' ); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.1.0 * @return void */ protected function _register_controls_actions() { parent::_register_controls_actions(); add_action( 'elementor/element/ee-search-form/section_button/before_section_end', [ $this, 'register_content_controls' ] ); add_action( 'elementor/element/ee-search-form/section_input_style/before_section_end', [ $this, 'register_style_controls' ] ); } /** * Register Content Controls * * @since 2.1.0 * @return void */ public function register_content_controls() { $this->parent->start_injection( [ 'at' => 'after', 'of' => '_skin', ] ); $this->add_control( 'input_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'left', 'options' => [ 'left' => __( 'Left', 'elementor-extras' ), 'right' => __( 'Right', 'elementor-extras' ), ], 'label_block' => false, 'prefix_class' => 'ee-search-form-input-position--' ] ); $this->parent->end_injection(); $this->register_button_content_controls(); parent::register_content_controls(); } /** * Register Button Content Controls * * @since 2.1.0 * @return void */ public function register_button_content_controls() { $this->parent->start_injection( [ 'at' => 'after', 'of' => 'heading_icon_content', ] ); $this->add_control( 'icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HIDDEN, 'default' => 'search', ] ); $this->parent->end_injection(); } /** * Register Style Controls * * @since 2.1.0 * @return void */ public function register_style_controls() { $this->register_form_style_controls(); $this->register_input_style_controls(); $this->register_button_style_controls(); } /** * Register Input Style Controls * * @since 2.1.0 * @return void */ public function register_input_style_controls() { $this->parent->start_injection( [ 'at' => 'after', 'of' => 'fields_style_heading', ] ); $this->add_responsive_control( 'input_width', [ 'label' => __( 'Expand Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 400, 'unit' => 'px', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1000, ], 'vw' => [ 'min' => 0, 'max' => 100, ], 'em' => [ 'min' => 0, 'max' => 50, ], ], 'size_units' => [ 'px', 'vw', 'em' ], 'selectors' => [ '{{WRAPPER}} .ee-search-form.ee--active .ee-search-form__container' => 'width: {{SIZE}}{{UNIT}}', ], ] ); $this->parent->end_injection(); } /** * Register Form Style Controls * * @since 2.1.0 * @return void */ protected function register_form_style_controls() { $this->parent->start_injection( [ 'at' => 'after', 'of' => 'form_border_color', ] ); $this->add_responsive_control( 'form_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'description' => __( 'For perfectly rounded corners set this to half of the height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__container, {{WRAPPER}} .ee-search-form__submit, {{WRAPPER}} .ee-search-form__fields' => 'border-radius: {{SIZE}}px;', '{{WRAPPER}} .select2-container--open.select2-container--below .ee-form__field__control--select2, .ee-select2__dropdown--{{ID}}.select2-dropdown--above' => 'border-radius: {{SIZE}}px {{SIZE}}px 0 0', '{{WRAPPER}} .select2-container--open.select2-container--above .ee-form__field__control--select2, .ee-select2__dropdown--{{ID}}.select2-dropdown--below' => 'border-radius: 0 0 {{SIZE}}px {{SIZE}}px', ], 'condition' => [ 'collapse_spacing!' => '', ], ] ); $this->parent->end_injection(); } /** * Register Button Style Controls * * @since 2.1.0 * @return void */ public function register_button_style_controls() { $this->parent->start_injection( [ 'at' => 'after', 'of' => 'button_background_color', ] ); $this->parent->end_injection(); } /** * Render widget content * * @since 2.1.0 * @return void */ public function render() { parent::render(); $this->render_form(); } /** * After Fields * * @since 2.1.0 * @return void */ public function after_fields() { $this->parent->render_inline_filters(); } /** * Render Form Container * * @since 2.1.0 * @return void */ public function render_form_container() { parent::render_form_container(); parent::render_button(); } /** * Render Button Content * * @since 2.1.0 * @return void */ public function render_button_content() { $this->render_button_sr_label(); $this->render_icon(); } } search/skins/skin-fullscreen.php 0000644 00000020052 15112147616 0012760 0 ustar 00 <?php namespace ElementorExtras\Modules\Search\Skins; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Search\Skins * * @since 2.1.0 */ class Skin_Fullscreen extends Skin_Base { /** * Get ID * * Gets the current skin ID * * @since 2.1.0 * @return string */ public function get_id() { return 'fullscreen'; } /** * Get Title * * Gets the current skin title * * @since 2.1.0 * @return string */ public function get_title() { return __( 'Full Screen', 'elementor-extras' ); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.1.0 * @return void */ protected function _register_controls_actions() { parent::_register_controls_actions(); add_action( 'elementor/element/ee-search-form/section_button/before_section_end', [ $this, 'register_content_controls' ] ); add_action( 'elementor/element/ee-search-form/section_input_style/before_section_end', [ $this, 'register_style_controls' ] ); add_action( 'elementor/element/ee-search-form/section_form_style/after_section_end', [ $this, 'register_overlay_style_controls' ] ); } /** * Register Content Controls * * @since 2.1.0 * @return void */ public function register_content_controls() { $this->parent->start_injection( [ 'at' => 'after', 'of' => '_skin', ] ); $this->add_control( 'toggle_effect', [ 'label' => __( 'Toggle Effect', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'slide-down', 'options' => [ 'zoom' => __( 'Zoom', 'elementor-extras' ), 'slide-down' => __( 'Slide Down', 'elementor-extras' ), 'slide-left' => __( 'Slide Left', 'elementor-extras' ), 'slide-up' => __( 'Slide Up', 'elementor-extras' ), 'slide-right' => __( 'Slide Right', 'elementor-extras' ), ], 'prefix_class' => 'ee-search-form-toggle-effect--', ] ); $this->parent->end_injection(); $this->register_button_content_controls(); parent::register_content_controls(); } /** * Register Button Content Controls * * @since 2.1.0 * @return void */ public function register_button_content_controls() { $this->parent->start_injection( [ 'at' => 'after', 'of' => 'heading_icon_content', ] ); $this->add_control( 'icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => \Elementor\Controls_Manager::HIDDEN, 'default' => 'search', ] ); $this->parent->end_injection(); } /** * Register Style Controls * * @since 2.1.0 * @return void */ public function register_style_controls() { $this->register_form_style_controls(); $this->register_input_style_controls(); $this->register_button_style_controls(); } /** * Register Form Style Controls * * @since 2.1.0 * @return void */ protected function register_form_style_controls() { $this->parent->start_injection( [ 'at' => 'after', 'of' => 'form_border_color', ] ); $this->add_responsive_control( 'form_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'description' => __( 'For perfectly rounded corners set this to half of the height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__container, {{WRAPPER}} .ee-search-form__filters .ee-form__field__control--text, {{WRAPPER}} .ee-search-form__submit' => 'border-radius: {{SIZE}}px;', '{{WRAPPER}} .ee-search-form__filters .select2-container--open.select2-container--below .ee-form__field__control--select2, .ee-select2__dropdown--{{ID}}.select2-dropdown--above' => 'border-radius: {{SIZE}}px {{SIZE}}px 0 0', '{{WRAPPER}} .ee-search-form__filters .select2-container--open.select2-container--above .ee-form__field__control--select2, .ee-select2__dropdown--{{ID}}.select2-dropdown--below' => 'border-radius: 0 0 {{SIZE}}px {{SIZE}}px', ], 'condition' => [ 'collapse_spacing!' => '', ], ] ); $this->parent->end_injection(); } /** * Register Button Style Controls * * @since 2.1.0 * @return void */ public function register_overlay_style_controls() { $this->start_controls_section( 'section_overlay_style', [ 'label' => __( 'Overlay', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'overlay_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 0, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__overlay' => 'top: {{SIZE}}px; right: {{SIZE}}px; bottom: {{SIZE}}px; left: {{SIZE}}px;', ], ] ); $this->add_control( 'overlay_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-search-form__overlay' => 'background-color: {{VALUE}};', ], ] ); $this->parent->end_controls_section(); } /** * Register Input Style Controls * * @since 2.1.0 * @return void */ public function register_input_style_controls() {} /** * Register Button Style Controls * * @since 2.1.0 * @return void */ public function register_button_style_controls() { $this->parent->start_injection( [ 'type' => 'section', 'at' => 'start', 'of' => 'section_button_style', ] ); $this->add_responsive_control( 'button_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__submit' => 'min-width: {{SIZE}}px; min-height: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'button_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__submit' => 'border-radius: {{SIZE}}px;', ], ] ); $this->parent->end_injection(); } /** * Render widget content * * @since 2.1.0 * @return void */ public function render() { parent::render(); /** * Add Skin Actions */ add_action( 'elementor-extras/search-form/fields/before_end', [ $this->parent, 'render_inline_filters' ], 10 ); $this->render_form(); } /** * After Fields * * @since 2.1.0 * @return void */ public function after_fields() { $this->parent->render_inline_filters(); } /** * Render Form Container * * @since 2.1.0 * @return void */ public function render_form_container() { $this->parent->add_render_attribute( [ 'overlay' => [ 'class' => [ 'ee-search-form__overlay', ], ], ] ); ?><div <?php echo $this->parent->get_render_attribute_string( 'overlay' ); ?>><?php parent::render_form_container(); parent::render_filters(); ?></div><?php parent::render_button(); } /** * Render Button * * @since 2.1.0 * @return void */ public function render_button_content() { $this->render_icon(); } /** * Render Close Icon * * @since 2.1.0 * @return void */ public function render_close_icon() { $settings = $this->parent->get_settings(); $this->parent->add_render_attribute( [ 'close' => [ 'class' => [ 'ee-search-form__overlay__close', ], ], ] ); ?><div <?php echo $this->parent->get_render_attribute_string( 'close' ); ?>><i class="eicon-close"></i></div><?php } } search/widgets/search-form.php 0000644 00000206672 15112147616 0012417 0 ustar 00 <?php namespace ElementorExtras\Modules\Search\Widgets; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\Search\Skins; use ElementorExtras\Modules\Search\Module as Module; use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Utils as ElementorUtils; use Elementor\Repeater; use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Css_Filter; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Search * * @since 2.1.0 */ class Search_Form extends Extras_Widget { /** * Has template content * * @since 1.6.0 * @var bool */ protected $_has_template_content = false; /** * Has Inline Filters * * @since 2.1.0 * @var bool */ public $_has_inline_filters = false; /** * Has Inline Filters * * @since 2.1.0 * @var bool */ public $_has_block_filters = false; /** * Search Filters * * @since 2.1.0 * @var bool */ public $_filters = []; /** * Search Fields * * @since 2.1.0 * @var bool */ public $_fields = []; /** * Query Filters * * Used to generate hidden fields * * @since 2.1.0 * @var bool */ public $_query_filters = []; /** * Search Fields * * @since 2.1.0 * @var bool */ public $_filter_types = [ 'post_type', 'author', 'taxonomies', ]; /** * Get Name * * Get the name of the widget * * @since 2.1.0 * @return string */ public function get_name() { return 'ee-search-form'; } /** * Get Title * * Get the title of the widget * * @since 2.1.0 * @return string */ public function get_title() { return __( 'Search Form', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 2.1.0 * @return string */ public function get_icon() { return 'nicon nicon-search-form'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 2.1.0 * @return array */ public function get_script_depends() { return [ 'jquery-elementor-select2' ]; } /** * Get Style Depends * * A list of css files that the widgets is depended in * * @since 2.1.0 * @return array */ public function get_style_depends() { return [ 'elementor-select2' ]; } /** * Get Search URL * * Returns the complete search url with vars * * @since 2.1.0 * @return array */ public function get_search_url() { $url = home_url(); return $url; } /** * Add filter 'all' option * * Shorthand for retrieving a control ID specific to filters * * @since 2.1.0 * @return array */ public function maybe_add_filter_all_option( $type ) { if ( ! $type || '' === $type ) return; // Add when setting exists $condition_show_all = '' !== $this->get_filter_control_setting( $type, 'all' ); if ( $condition_show_all ) { $label = '' !== trim( $this->get_filter_control_setting( $type, 'all_label' ) ) ? $this->get_filter_control_setting( $type, 'all_label' ) : sprintf( __( 'All %s', 'elementor-extras' ), $this->_filters[ $type ]['label'] ); $this->_filters[ $type ]['values'][] = [ 'name' => 'all', 'title' => $label, ]; } } /** * Get Field Values * * @since 2.1.0 * @return array */ public function get_field_values( $category ) { $values = []; foreach ( $this->_fields[ $category ]['values'] as $index => $data ) { if ( 'all' === $data['name'] ) continue; $values[] = $data['name']; } return $values; } /** * Get Filter Control ID * * Shorthand for retrieving a control ID specific to filters * * @since 2.1.0 * @return array */ public function get_filter_control_setting( $type, $name = '' ) { $control_id = 'filter_' . $type; if ( '' !== $name ) { $control_id .= '_' . $name; } return $this->get_settings( $control_id ); } /** * Set Search Filters * * Calls methods to set up required filter vars from filter types * * @since 2.1.0 * @return array */ public function set_search_filters() { foreach ( $this->_filter_types as $type ) { call_user_func( [ $this, 'set_' . $type . '_search_filters' ] ); } $this->_has_inline_filters = ! empty( array_keys( array_filter( $this->_fields, function ( $item ) { return $item['inline'] === true; } ) ) ); $this->_has_block_filters = ! empty( array_keys( array_filter( $this->_fields, function ( $item ) { return $item['inline'] === false; } ) ) ); } /** * Set Post Type Search Filters * * Processes post type filter settings and sets up required filter vars * * @since 2.1.0 * @return array */ public function set_post_type_search_filters() { $settings = $this->get_settings(); $filter_types = $settings['filter_types']; // Post type $post_types = Utils::get_public_post_types_options( true, false ); if ( $post_types && in_array( 'post_type', $filter_types ) ) { $this->_filters['post_type'] = [ 'label' => __( 'Post Types', 'elementor-extras' ), 'inline' => '' !== $settings['filter_post_type_inline'], ]; $this->maybe_add_filter_all_option( 'post_type' ); foreach ( $post_types as $post_type => $name ) { if ( $settings['filter_post_type_exclude'] && in_array( $post_type , $settings['filter_post_type_exclude'] ) ) continue; $post_type_object = get_post_type_object( $post_type ); $this->_filters['post_type']['values'][] = [ 'name' => $post_type, 'title' => $post_type_object->labels->singular_name, ]; if ( '' === $settings['filter_post_type_fields'] ) { $this->_query_filters['post_type'][] = $post_type; } } // Add to list of available fields for user if ( $settings['filter_post_type_fields'] ) { $this->_fields['post_type'] = $this->_filters['post_type']; } } } /** * Set Author Search Filters * * Processes author filter settings and sets up required filter vars * * @since 2.1.0 * @return array */ public function set_author_search_filters() { $settings = $this->get_settings(); $filter_types = $settings['filter_types']; // Authors $authors = Utils::get_users_options(); if ( $authors && in_array( 'author', $filter_types ) ) { $this->_filters['author'] = [ 'label' => __( 'Authors', 'elementor-extras' ), 'inline' => '' !== $settings['filter_author_inline'], ]; $this->maybe_add_filter_all_option( 'author' ); foreach ( $authors as $author => $name ) { if ( $settings['filter_author_exclude'] && in_array( $author , $settings['filter_author_exclude'] ) ) continue; $user_info = get_userdata( $author ); $this->_filters['author']['values'][] = [ 'name' => $author, 'title' => $user_info->display_name, ]; if ( '' === $settings['filter_author_fields'] ) { $this->_query_filters['author'][] = $author; } } // Add to list of available fields for user if ( $settings['filter_author_fields'] ) $this->_fields['author'] = $this->_filters['author']; } } /** * Set Taxonomies Search Filters * * Processes taxonomies filter settings and sets up required filter vars * * @since 2.1.0 * @return array */ public function set_taxonomies_search_filters() { $settings = $this->get_settings(); $filter_types = $settings['filter_types']; // Taxonomy terms $taxonomies = Utils::get_taxonomies_options(); foreach ( $taxonomies as $name => $label ) { $terms = Utils::get_terms_options( $name, 'slug', false ); $prefix = 'filter_' . str_replace( '-', '_', $name ); $exclude = $settings[ $prefix . '_exclude' ]; if ( ! in_array( $name, $filter_types ) ) { continue; } else { if ( $terms ) { $this->_query_filters[ $name ] = []; $this->_filters[ $name ] = [ 'label' => $label, 'inline' => '' !== $settings['filter_' . $name . '_inline'], ]; $this->maybe_add_filter_all_option( $name ); if ( ! $exclude && '' === $settings[ $prefix . '_fields' ] ) { $this->_query_filters[ $name ][] = 'all'; } foreach ( $terms as $term_name => $term ) { if ( $exclude && in_array( $term_name, $exclude ) ) { continue; } $this->_filters[ $name ]['values'][] = [ 'name' => $term_name, 'title' => $term, ]; if ( $exclude && '' === $settings[ $prefix . '_fields' ] ) { $this->_query_filters[ $name ][] = $term_name; } } // Add to list of available fields for user if ( $settings[ $prefix . '_fields'] ) $this->_fields[ $name ] = $this->_filters[ $name ]; } } } } /** * Register Skins * * @since 2.1.0 * @return void */ protected function register_skins() { $this->add_skin( new Skins\Skin_Classic( $this ) ); $this->add_skin( new Skins\Skin_Expand( $this ) ); $this->add_skin( new Skins\Skin_Fullscreen( $this ) ); } /** * Register Widget Controls * * @since 2.1.0 * @return void */ protected function _register_controls() { // Content tab $this->register_content_controls(); $this->register_style_controls(); } /** * Register Content Controls * * @since 2.1.0 * @return void */ protected function register_content_controls() { $this->register_settings_content_controls(); $this->register_filters_content_controls(); $this->register_button_content_controls(); $this->register_input_content_controls(); } /** * Register Settings Controls * * @since 2.1.0 * @return void */ protected function register_settings_content_controls() { $this->start_controls_section( 'section_settings', [ 'label' => __( 'Settings', 'elementor-extras' ), ] ); if ( is_elementor_pro_active() ) { $this->add_control( 'search_id', [ 'label' => __( 'Search ID', 'elementor-extras' ), 'description' => __( 'Enter a unique ID for the search results page.', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, ] ); } $this->end_controls_section(); } /** * Register Filters Settings Controls * * @since 2.1.0 * @return void */ protected function register_filters_content_controls() { $this->start_controls_section( 'section_filters', [ 'label' => __( 'Restrictions & Filters', 'elementor-extras' ), ] ); $this->add_control( 'filter_types', [ 'label' => __( 'Restrict to', 'elementor-extras' ), 'type' => Controls_Manager::SELECT2, 'label_block' => true, 'default' => [], 'options' => array_merge( Utils::get_taxonomies_options(), [ 'post_type' => __( 'Post Type', 'elementor-extras' ), 'author' => __( 'Author', 'elementor-extras' ), ] ), 'multiple' => true, ] ); $this->add_control( 'filters_titles', [ 'label' => __( 'Show Filter Titles', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'condition' => [ 'filter_types!' => [], ], ] ); $this->add_control( 'filters_strict', [ 'label' => __( 'Strict Filters Mode', 'elementor-extras' ), 'description' => __( 'In strict mode, when selecting \'All\' in filters, the results will not include posts that don\'t have a term belonging to this taxonomy.', 'elementor-extras'), 'type' => Controls_Manager::SWITCHER, 'default' => '', ] ); $this->add_control( 'filter_post_type_heading', [ 'label' => __( 'Post Types', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'filter_types' => 'post_type', ], ] ); $this->add_control( 'filter_post_type_fields', [ 'label' => __( 'Show Filters', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'condition' => [ 'filter_types' => 'post_type', ], ] ); $this->add_control( 'filter_post_type_inline', [ 'label' => __( 'Show Inline', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'condition' => [ 'filter_types' => 'post_type', 'filter_post_type_fields!' => '' ], ] ); $this->add_control( 'filter_post_type_all', [ 'label' => __( 'Show All Option', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'condition' => [ 'filter_types' => 'post_type', 'filter_post_type_fields!' => '', ], ] ); $this->add_control( 'filter_post_type_checked', [ 'label' => __( 'Show Checked', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'condition' => [ 'filter_types' => 'post_type', 'filter_post_type_inline' => '', 'filter_post_type_fields!' => '', 'filter_post_type_control' => 'checkbox', ], ] ); $this->add_control( 'filter_post_type_exclude', [ 'label' => __( 'Exclude', 'elementor-extras' ), 'type' => Controls_Manager::SELECT2, 'label_block' => true, 'default' => '', 'options' => Utils::get_public_post_types_options( true, false ), 'multiple' => true, 'condition' => [ 'filter_types' => 'post_type', ], ] ); $this->add_control( 'filter_post_type_control', [ 'label' => __( 'Field Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'select', 'options' => [ 'checkbox' => __( 'Checkboxes', 'elementor-extras' ), 'radio' => __( 'Radio Buttons', 'elementor-extras' ), 'select' => __( 'Dropdown', 'elementor-extras' ), ], 'condition' => [ 'filter_types' => 'post_type', 'filter_post_type_inline' => '', 'filter_post_type_fields!' => '', ], ] ); $this->add_control( 'filter_author_heading', [ 'label' => __( 'Authors', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'filter_types' => 'author', ], ] ); $this->add_control( 'filter_author_fields', [ 'label' => __( 'Show Filters', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'condition' => [ 'filter_types' => 'author', ], ] ); $this->add_control( 'filter_author_inline', [ 'label' => __( 'Show Inline', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'condition' => [ 'filter_types' => 'author', 'filter_author_fields!' => '', ], ] ); $this->add_control( 'filter_author_all', [ 'label' => __( 'Show All Option', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'condition' => [ 'filter_types' => 'author', 'filter_author_fields!' => '', ], ] ); $this->add_control( 'filter_author_checked', [ 'label' => __( 'Show Checked', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'condition' => [ 'filter_types' => 'author', 'filter_author_inline' => '', 'filter_author_fields!' => '', 'filter_author_control' => 'checkbox', ], ] ); $this->add_control( 'filter_author_exclude', [ 'label' => __( 'Exclude', 'elementor-extras' ), 'type' => Controls_Manager::SELECT2, 'label_block' => true, 'default' => '', 'options' => Utils::get_users_options(), 'multiple' => true, 'condition' => [ 'filter_types' => 'author', ], ] ); $this->add_control( 'filter_author_control', [ 'label' => __( 'Filter Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'select', 'options' => [ 'checkbox' => __( 'Checkboxes', 'elementor-extras' ), 'radio' => __( 'Radio Buttons', 'elementor-extras' ), 'select' => __( 'Dropdown', 'elementor-extras' ), ], 'condition' => [ 'filter_types' => 'author', 'filter_author_inline' => '', 'filter_author_fields!' => '', ], ] ); $taxonomies = Utils::get_taxonomies_options(); foreach ( $taxonomies as $name => $label ) { $terms = Utils::get_terms_options( $name, 'slug', false ); $labels = Utils::get_taxonomy_labels( $name ); $control_prefix = 'filter_' . str_replace( '-', '_', $name ); $this->add_control( $control_prefix . '_heading', [ 'label' => $label, 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'condition' => [ 'filter_types' => $name, ], ] ); $this->add_control( $control_prefix . '_fields', [ 'label' => __( 'Show Filters', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'condition' => [ 'filter_types' => $name, ], ] ); $this->add_control( $control_prefix . '_inline', [ 'label' => __( 'Show Inline', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'condition' => [ 'filter_types' => $name, $control_prefix . '_fields!' => '', ], ] ); $this->add_control( $control_prefix . '_all', [ 'label' => __( 'Show All Option', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'condition' => [ 'filter_types' => $name, $control_prefix . '_fields!' => '', ], ] ); $this->add_control( $control_prefix . '_checked', [ 'label' => __( 'Show Checked', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'condition' => [ 'filter_types' => $name, $control_prefix . '_inline' => '', $control_prefix . '_fields!' => '', $control_prefix . '_control' => 'checkbox', ], ] ); $this->add_control( $control_prefix . '_exclude', [ 'label' => __( 'Exclude', 'elementor-extras' ), 'type' => Controls_Manager::SELECT2, 'label_block' => true, 'multiple' => true, 'default' => '', 'options' => $terms, 'condition' => [ 'filter_types' => $name, ], ] ); $this->add_control( $control_prefix . '_all_label', [ 'label' => __( 'All Label', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => '', 'condition' => [ 'filter_types' => $name, $control_prefix . '_fields!' => '', $control_prefix . '_all!' => '', ], ] ); $this->add_control( $control_prefix . '_control', [ 'label' => __( 'Filter Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'select', 'options' => [ 'checkbox' => __( 'Checkboxes', 'elementor-extras' ), 'radio' => __( 'Radio Buttons', 'elementor-extras' ), 'select' => __( 'Dropdown', 'elementor-extras' ), ], 'condition' => [ 'filter_types' => $name, $control_prefix . '_inline' => '', $control_prefix . '_fields!' => '', ], ] ); } $this->end_controls_section(); } /** * Register Button Content Controls * * @since 2.1.0 * @return void */ protected function register_button_content_controls() { $this->start_controls_section( 'section_button', [ 'label' => __( 'Submit Button', 'elementor-extras' ), ] ); $this->add_control( 'heading_icon_content', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->end_controls_section(); } /** * Register Input Content Controls * * @since 2.1.0 * @return void */ protected function register_input_content_controls() { $this->start_controls_section( 'section_input', [ 'label' => __( 'Keyword Field', 'elementor-extras' ), ] ); $this->add_control( 'heading_input_content', [ 'label' => __( 'Input', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'input_placeholder', [ 'label' => __( 'Placeholder', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'What are you looking for?', 'elementor-extras' ), ] ); $this->end_controls_section(); } /** * Register Style Controls * * @since 2.1.0 * @return void */ protected function register_style_controls() { $this->register_form_style_controls(); $this->register_filters_style_controls(); $this->register_button_style_controls(); $this->register_input_style_controls(); } /** * Register Form Style Controls * * @since 2.1.0 * @return void */ protected function register_form_style_controls() { $this->start_controls_section( 'section_form_style', [ 'label' => __( 'Form', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'alignment', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'label_block' => false, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .elementor-widget-container' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'collapse_spacing', [ 'label' => __( 'Collapse Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'prefix_class' => 'ee-search-form-spacing--', 'return_value' => 'collapse', 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'form_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-search-form.ee-search-form-skin--classic .ee-search-form__container, {{WRAPPER}} .ee-search-form.ee-search-form-skin--fullscreen .ee-search-form__container, {{WRAPPER}} .ee-search-form.ee-search-form-skin--expand .ee-search-form__fields, {{WRAPPER}} .ee-search-form__filters .ee-form__field__control--text, {{WRAPPER}} .ee-form__field--checkbox label i', 'condition' => [ 'collapse_spacing!' => '', ], ] ); $this->add_control( 'fields_style_heading', [ 'label' => __( 'Fields', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_responsive_control( 'spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-form__fields .ee-form__field, {{WRAPPER}} .ee-search-form-skin--classic .ee-search-form__submit' => 'margin-right: {{SIZE}}px;', '{{WRAPPER}} .ee-search-form__container' => 'margin-right: -{{SIZE}}px;', '{{WRAPPER}}.ee-search-form-input-position--right .ee-form__fields' => 'margin-left: {{SIZE}}px;', '(desktop){{WRAPPER}}.ee-search-form-fields-wrap--desktop .ee-form__fields .ee-form__field' => 'margin-bottom: {{SIZE}}px;', '(tablet){{WRAPPER}}.ee-search-form-fields-wrap--tablet .ee-form__fields .ee-form__field' => 'margin-bottom: {{SIZE}}px;', '(mobile){{WRAPPER}}.ee-search-form-fields-wrap--mobile .ee-form__fields .ee-form__field' => 'margin-bottom: {{SIZE}}px;', ], 'condition' => [ 'collapse_spacing!' => 'collapse', ] ] ); $this->add_responsive_control( 'padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-form__field__control--text:not(.ee-form__field__control--submit), {{WRAPPER}} .ee-search-form-skin--classic .ee-form__field__control--submit' => 'padding: 0 {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'height', [ 'label' => __( 'Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-form__field__control--text' => 'min-height: {{SIZE}}px;', '{{WRAPPER}} .ee-search-form .ee-search-form__submit.ee-search-form__control--icon' => 'min-width: {{SIZE}}px', '{{WRAPPER}} .ee-search-form.ee-search-form-skin--expand .ee-search-form__submit' => 'min-width: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'fields_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'description' => __( 'For perfectly rounded corners set this to half of the height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-form__field__control--text' => 'border-radius: {{SIZE}}px;', '{{WRAPPER}} .select2-container--open.select2-container--below .ee-form__field__control--select2, .ee-select2__dropdown--{{ID}}.select2-dropdown--above' => 'border-radius: {{SIZE}}px {{SIZE}}px 0 0', '{{WRAPPER}} .select2-container--open.select2-container--above .ee-form__field__control--select2, .ee-select2__dropdown--{{ID}}.select2-dropdown--below' => 'border-radius: 0 0 {{SIZE}}px {{SIZE}}px', ], 'condition' => [ 'collapse_spacing' => '', ], ] ); $this->add_responsive_control( 'separator_width', [ 'label' => __( 'Separator Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 6, ], ], 'selectors' => [ '{{WRAPPER}} .ee-form__fields .ee-form__field:not(:first-child)' => 'border-left-width: {{SIZE}}px;', '(desktop){{WRAPPER}}.ee-search-form-fields-wrap--desktop .ee-form__fields .ee-form__field:not(:first-child)' => 'border-top-width: {{SIZE}}px;', '(tablet){{WRAPPER}}.ee-search-form-fields-wrap--tablet .ee-form__fields .ee-form__field:not(:first-child)' => 'border-top-width: {{SIZE}}px;', '(mobile){{WRAPPER}}.ee-search-form-fields-wrap--mobile .ee-form__fields .ee-form__field:not(:first-child)' => 'border-top-width: {{SIZE}}px;', ], 'condition' => [ 'collapse_spacing!' => '', ], ] ); $this->add_control( 'separator_color', [ 'label' => __( 'Separator Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__fields .ee-form__field:not(:first-child)' => 'border-color: {{VALUE}};', ], 'condition' => [ 'collapse_spacing!' => '', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'fields_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-form__field__control--text, {{WRAPPER}} .ee-form__field--check label i', 'exclude' => ['color'], 'condition' => [ 'collapse_spacing' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'fields_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-search-form__container .ee-form__field__control, {{WRAPPER}} .ee-search-form__filters .ee-form__field__control--text', ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'days', 'selector' => '{{WRAPPER}} .ee-form__field__control', 'separator' => '', ] ); $this->start_controls_tabs( 'fields_style' ); $this->start_controls_tab( 'fields_style_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'fields_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field__control--text' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'fields_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field__control--text' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'fields_border_color', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field__control--text, {{WRAPPER}} .ee-form__field--check label i' => 'border-color: {{VALUE}};', ], 'condition' => [ 'collapse_spacing' => '', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'fields_box_shadow', 'selector' => '{{WRAPPER}} .ee-form__field__control--text', 'condition' => [ 'collapse_spacing' => '', '_skin!' => 'expand', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'fields_style_focus', [ 'label' => __( 'Focus', 'elementor-extras' ) ] ); $this->add_control( 'fields_color_focus', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field__control--text:focus, {{WRAPPER}} .select2-container--open .ee-select2 .select2-selection__rendered, {{WRAPPER}} .select2-container--focus .ee-select2 .select2-selection__rendered' => 'color: {{VALUE}};', '{{WRAPPER}} .select2-container--open .select2-selection__arrow b' => 'border-bottom-color: {{VALUE}};', '{{WRAPPER}} .select2-container--focus .select2-selection__arrow b, {{WRAPPER}} .ee-form__field--select select:focus + label:after' => 'border-top-color: {{VALUE}};', ], ] ); $this->add_control( 'fields_background_color_focus', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field__control--text:focus, {{WRAPPER}} .select2-container--open .ee-select2, {{WRAPPER}} .select2-container--focus .ee-select2' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'fields_border_color_focus', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field__control--text:focus, {{WRAPPER}} .select2-container--open .ee-select2, {{WRAPPER}} .select2-container--focus .ee-select2' => 'border-color: {{VALUE}};', ], 'condition' => [ 'collapse_spacing' => '', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'fields_box_shadow_focus', 'selector' => '{{WRAPPER}} .ee-form__field__control--text:focus, {{WRAPPER}} .select2-container--open .ee-select2, {{WRAPPER}} .select2-container--focus .ee-select2', 'condition' => [ 'collapse_spacing' => '', '_skin!' => 'expand', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Register Filters Style Controls * * @since 2.1.0 * @return void */ protected function register_filters_style_controls() { $this->start_controls_section( 'section_filters_style', [ 'label' => __( 'Filters', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'filters_custom', [ 'label' => __( 'Custom', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'separator' => 'after', ] ); $this->add_control( 'filters_layout_heading', [ 'label' => __( 'Layout', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_responsive_control( 'columns', [ 'label' => __( 'Columns', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '3', 'tablet_default' => '2', 'mobile_default' => '1', 'options' => [ '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', ], 'prefix_class' => 'ee-grid-columns%s-', 'frontend_available' => true, ] ); $this->add_responsive_control( 'filters_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__filters' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'filters_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__filters' => 'margin-top: {{SIZE}}px;', ], ] ); $columns_horizontal_margin = is_rtl() ? 'margin-left' : 'margin-right'; $columns_horizontal_padding = is_rtl() ? 'padding-left' : 'padding-right'; $this->add_responsive_control( 'filters_horizontal_spacing', [ 'label' => __( 'Horizontal Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 24, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__filters' => $columns_horizontal_margin . ': -{{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-search-form__filters__category' => $columns_horizontal_padding . ': {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'filters_vertical_spacing', [ 'label' => __( 'Vertical Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 24, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__filters' => 'margin-bottom: -{{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-search-form__filters__category' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'filters_titles_heading', [ 'label' => __( 'Titles', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'filters_titles_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-search-form__filters-category__title', ] ); $this->add_responsive_control( 'filters_titles_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__filters-category__title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'filters_labels_heading', [ 'label' => __( 'Labels', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'filters_labels_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-form__field__label', ] ); $this->add_control( 'filters_checkboxes_heading', [ 'label' => __( 'Checkboxes', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_responsive_control( 'filters_checkboxes_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 12, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-form__field--check.ee-custom label i' => 'width: {{SIZE}}px; height: {{SIZE}}px;', '{{WRAPPER}} .ee-form__field--check.ee-custom:hover .ee-form__field__control--check + label i, {{WRAPPER}} .ee-form__field--check.ee-custom .ee-form__field__control--check:checked + label i' => 'font-size: calc({{SIZE}}px/2)', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_responsive_control( 'filters_checkboxes_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 6, ], ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__filters .ee-form__field--checkbox label i' => 'border-radius: {{SIZE}}px;', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_responsive_control( 'filters_check_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .ee-form__field--check.ee-custom label i' => 'margin-right: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-form__field--check:not(.ee-custom) label'=> 'margin-left: {{SIZE}}{{UNIT}};', ], ] ); $this->start_controls_tabs( 'filters_check_style' ); $this->start_controls_tab( 'filters_check_style_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_control( 'filters_check_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field--check label i' => 'background-color: {{VALUE}};', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_control( 'filters_check_border_color', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field--check label i' => 'border-color: {{VALUE}};', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'filters_check_box_shadow', 'selector' => '{{WRAPPER}} .ee-form__field--check label i', 'condition' => [ 'filters_custom!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'filters_check_style_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_control( 'filters_check_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-form__field--check.ee-custom:hover .ee-form__field__control--check:not(:checked) + label i:before' => 'color: {{VALUE}};', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_control( 'filters_check_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field--check.ee-custom:hover label i' => 'background-color: {{VALUE}};', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_control( 'filters_check_border_color_hover', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field--check.ee-custom:hover label i' => 'border-color: {{VALUE}};', ], 'condition' => [ 'filters_custom!' => '' ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'filters_check_box_shadow_hover', 'selector' => '{{WRAPPER}} .ee-form__field--check:hover label i', 'condition' => [ 'filters_custom!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'filters_check_style_checked', [ 'label' => __( 'Checked', 'elementor-extras' ), 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_control( 'filters_check_accent_checked', [ 'label' => __( 'Accent Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-form__field--check.ee-custom .ee-form__field__control--checkbox:checked + label i' => 'border-color: {{VALUE}}; background-color: {{VALUE}};', '{{WRAPPER}} .ee-form__field--check.ee-custom .ee-form__field__control--radio:checked + label i' => 'border-color: {{VALUE}}; color: {{VALUE}};', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_control( 'filters_check_border_color_checked', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field__control--check:checked + label i' => 'border-color: {{VALUE}};', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'filters_check_box_shadow_checked', 'selector' => '{{WRAPPER}} .ee-form__field__control--check:checked + label i', 'condition' => [ 'filters_custom!' => '', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'filters_dropdown_heading', [ 'label' => __( 'Dropdowns', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_responsive_control( 'filters_dropdown_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'allowed_dimensions' => 'horizontal', 'selectors' => [ '{{WRAPPER}} .ee-form__field--select .ee-form__field__control--select' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'filters_custom' => '', ], ] ); $this->add_responsive_control( 'filters_dropdown_items_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '.ee-select2__dropdown--{{ID}} .select2-results__option' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'label' => __( 'Options Box Shadow', 'elementor-extras' ), 'name' => 'filters_dropdown_options_box_shadow', 'selector' => '.ee-select2__dropdown.ee-select2__dropdown--{{ID}}', 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'filters_dropdown_options_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'separator' => 'before', 'selector' => '.ee-select2__dropdown.ee-select2__dropdown--{{ID}}', 'condition' => [ 'filters_custom!' => '', ], ] ); $this->start_controls_tabs( 'filters_dropdown_items_style' ); $this->start_controls_tab( 'filters_dropdown_items_style_default', [ 'label' => __( 'Default', 'elementor-extras' ), 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_control( 'filters_dropdown_items_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-select2__dropdown--{{ID}} .select2-results__option' => 'color: {{VALUE}};', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_control( 'filters_dropdown_items_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-select2__dropdown--{{ID}} .select2-results__option[aria-selected]' => 'background-color: {{VALUE}};', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'filters_dropdown_items_style_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_control( 'filters_dropdown_items_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-select2__dropdown.ee-select2__dropdown--{{ID}} .select2-results__option.select2-results__option--highlighted[aria-selected]' => 'color: {{VALUE}};', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_control( 'filters_dropdown_items_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '.ee-select2__dropdown.ee-select2__dropdown--{{ID}} .select2-results__option.select2-results__option--highlighted[aria-selected]' => 'background-color: {{VALUE}};', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'filters_dropdown_items_style_selected', [ 'label' => __( 'Selected', 'elementor-extras' ), 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_control( 'filters_dropdown_items_color_highlighted', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-select2__dropdown.ee-select2__dropdown--{{ID}} .select2-results__option[aria-selected=true]' => 'color: {{VALUE}};', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->add_control( 'filters_dropdown_items_background_color_selected', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.ee-select2__dropdown.ee-select2__dropdown--{{ID}} .select2-results__option[aria-selected=true]' => 'background-color: {{VALUE}};', ], 'condition' => [ 'filters_custom!' => '', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Register Button Style Controls * * @since 2.1.0 * @return void */ protected function register_button_style_controls() { $this->start_controls_section( 'section_button_style', [ 'label' => __( 'Submit Button', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'button_style' ); $this->start_controls_tab( 'button_style_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'button_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-search-form__submit' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-search-form__submit' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'button_border_color', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-search-form__submit' => 'border-color: {{VALUE}};', ], 'condition' => [ 'collapse_spacing' => '', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'button_box_shadow', 'selector' => '{{WRAPPER}} .ee-search-form__submit', 'condition' => [ 'collapse_spacing' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'button_style_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'button_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-search-form__submit:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-search-form__submit:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'button_border_color_hover', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-search-form__submit:hover' => 'border-color: {{VALUE}};', ], 'condition' => [ 'collapse_spacing' => '', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'button_box_shadow_hover', 'selector' => '{{WRAPPER}} .ee-search-form__submit:hover', 'condition' => [ 'collapse_spacing' => '', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'separator' => 'before', 'selector' => '{{WRAPPER}} .ee-search-form__submit', ] ); $this->end_controls_section(); } /** * Register Input Style Controls * * @since 2.1.0 * @return void */ protected function register_input_style_controls() { $this->start_controls_section( 'section_input_style', [ 'label' => __( 'Keyword Field', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'input_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-form__field--input' => 'flex-basis: {{SIZE}}%', ], ] ); $this->start_controls_tabs( 'input_style' ); $this->start_controls_tab( 'input_style_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'input_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field__control.ee-search-form__input' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'placeholder_color', [ 'label' => __( 'Placeholder Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => Utils::get_placeholder_selectors( '{{WRAPPER}} .ee-form__field__control.ee-search-form__input', 'color: {{VALUE}};' ), ] ); $this->add_control( 'input_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field__control.ee-search-form__input' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'input_border_color', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field__control.ee-search-form__input' => 'border-color: {{VALUE}};', ], 'condition' => [ 'collapse_spacing' => '', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'input_style_focus', [ 'label' => __( 'Focus', 'elementor-extras' ) ] ); $this->add_control( 'input_color_focus', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field__control.ee-search-form__input:focus' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'placeholder_color_focus', [ 'label' => __( 'Placeholder Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => Utils::get_placeholder_selectors( '{{WRAPPER}} .ee-form__field__control.ee-search-form__input:focus', 'color: {{VALUE}};' ), ] ); $this->add_control( 'input_background_color_focus', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field__control.ee-search-form__input:focus' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'input_border_color_focus', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-form__field__control.ee-search-form__input:focus' => 'border-color: {{VALUE}};', ], 'condition' => [ 'collapse_spacing' => '', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * parse_text_editor wrapper * * @since 2.1.0 * @return void */ public function _parse_text_editor( $content ) { return $this->parse_text_editor( $content ); } /** * get_repeater_setting_key wrapper * * @since 2.1.0 * @return void */ public function _get_repeater_setting_key( $setting_key, $repeater_key, $repeater_item_index ) { return $this->get_repeater_setting_key( $setting_key, $repeater_key, $repeater_item_index ); } /** * Render widget content * * @since 2.1.0 * @return void */ public function render() { $settings = $this->get_settings(); if ( $settings['filter_types'] ) { $this->set_search_filters(); } } /** * Render Filters * * @since 2.1.0 * @return void */ public function render_filters() { $settings = $this->get_settings(); if ( ! $this->_fields || ! $this->_has_block_filters ) return; $this->add_render_attribute( [ 'filters' => [ 'class' => [ 'ee-search-form__filters', 'ee-grid', ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'filters' ); ?>><?php foreach ( $this->_fields as $category => $field ) { if ( true === $field['inline'] ) { continue; } else { $this->render_filter( $category, $field ); } } ?></div><?php } /** * Render Inline Filters * * @since 2.1.0 * @return void */ public function render_inline_filters() { $settings = $this->get_settings(); if ( ! $this->_fields || ! $this->_has_inline_filters ) return; foreach ( $this->_fields as $category => $field ) { if ( false === $field['inline'] ) { continue; } else { $this->render_filter( $category, $field ); } } } /** * Render Filter * * @since 2.1.0 * @return void */ public function render_filter( $category, $field ) { $settings = $this->get_settings(); $is_inline = true === $field['inline']; $field_key = $this->get_repeater_setting_key( 'category', 'filters', $category ); if ( 'select' === $settings['filter_' . $category . '_control'] || $is_inline ) { add_action( 'elementor-extras/search-form/{$category}/options/before', [ $this, 'render_filter_select_start' ], 10, 2 ); add_action( 'elementor-extras/search-form/{$category}/options/after', [ $this, 'render_filter_select_end' ], 10, 1 ); } if ( ! $is_inline ) { $this->add_render_attribute( [ $field_key => [ 'class' => [ 'ee-grid__item', 'ee-search-form__filters-category', 'ee-search-form__filters__category', 'ee-search-form__filters__category--' . $settings['filter_' . $category . '_control'], ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( $field_key ); ?>><?php } if ( '' !== $settings['filters_titles'] && ! $is_inline ) { $this->render_filter_title( $category, $field ); } $this->render_filter_options( $category, $field ); if ( ! $is_inline ) { ?></div><?php } if ( 'select' === $settings['filter_' . $category . '_control'] || $is_inline ) { remove_action( 'elementor-extras/search-form/{$category}/options/before', [ $this, 'render_filter_select_start' ], 10 ); remove_action( 'elementor-extras/search-form/{$category}/options/after', [ $this, 'render_filter_select_end' ], 10, 1 ); } } /** * Render Filter Title * * @since 2.1.0 * @return void */ public function render_filter_title( $category, $field ) { $title_key = $this->get_repeater_setting_key( 'category-title', 'filters', $category ); $this->add_render_attribute( [ $title_key => [ 'class' => [ 'ee-search-form__filters-category__title', ], ], ] ); ?><div <?php echo $this->get_render_attribute_string( $title_key ); ?>> <?php echo $field['label']; ?> </div><?php } /** * Render Filter Options * * @since 2.1.0 * @return void */ public function render_filter_options( $category, $field ) { /** * elementor-extras/search-form/{$category}/options/before hook * * @since 2.1.0 */ do_action( 'elementor-extras/search-form/{$category}/options/before', $category, $field ); foreach ( $field['values'] as $values ) { ?> <?php $this->render_filter_option( $category, $values ); ?> <?php } /** * elementor-extras/search-form/{$category}/options/after hook * * @since 2.1.0 */ do_action( 'elementor-extras/search-form/{$category}/options/after', $category ); } /** * Render Single Filter * * @since 2.1.0 * @return void */ public function render_filter_option( $category, $field ) { $settings = $this->get_settings(); $control = ( true === $this->_fields[ $category ]['inline'] ) ? 'select' : $settings['filter_' . $category . '_control'] ; $method = 'radio' === $control ? 'checkbox' : $control; call_user_func( [ $this, 'render_filter_' . $method . '_option' ], $category, $field, $control ); } /** * Render Filter Checkbox Option * * @since 2.1.0 * @return void */ public function render_filter_checkbox_option( $category, $field, $control = 'checkbox' ) { $settings = $this->get_settings(); $option_key = $this->get_repeater_setting_key( $this->get_id() . '.' . $field['name'], 'filters', $category ); $label_key = $this->get_repeater_setting_key( $this->get_id() . '.' . $field['name'], 'labels', $category ); $input_key = $this->get_repeater_setting_key( $this->get_id() . '.' . $field['name'], 'inputs', $category ); $icon_key = $this->get_repeater_setting_key( $this->get_id() . '.' . $field['name'], 'icons', $category ); $this->add_render_attribute( [ $option_key => [ 'class' => [ 'ee-search-form__filters-category__filter', 'ee-form__field', 'ee-form__field--' . $control, 'ee-form__field--check', 'ee-search-form__field', ], ], $label_key => [ 'for' => $input_key, 'class' => [ 'ee-form__field__label', ], ], $input_key => [ 'class' => [ 'ee-form__field__control', 'ee-form__field__control--check', 'ee-form__field__control--' . $control, ], 'id' => $input_key, 'type' => $control, 'name' => $category, ], ] ); if ( 'all' === $field['name'] ) { $this->add_render_attribute( $input_key, [ 'class' => 'ee-form__field__control--all', // 'value' => json_encode( $this->get_field_values( $category ) ), 'value' => '' !== $settings['filters_strict'] ? 'all' : 'any', ] ); if ( 'radio' === $control ) { $this->add_render_attribute( $input_key, 'class', 'ee-form__field__control--search' ); } } else { $this->add_render_attribute( $input_key, [ 'class' => 'ee-form__field__control--search', 'value' => $field['name'], ] ); } if ( 'checkbox' === $control ) { if ( 'yes' === $this->get_filter_control_setting( $category, 'checked' ) ) { $this->add_render_attribute( $input_key, 'checked', 'checked' ); } } else if ( 'radio' === $control ) { if ( 'all' === $field['name'] ) { $this->add_render_attribute( $input_key, 'checked', 'checked' ); } } if ( '' !== $settings['filters_custom'] ) { $this->add_render_attribute( $option_key, 'class', 'ee-custom' ); $this->add_render_attribute( $icon_key, [ 'class' => 'nicon nicon-' . $control, 'aria-hidden' => 'true', ] ); } ?> <div <?php echo $this->get_render_attribute_string( $option_key ); ?>> <input <?php echo $this->get_render_attribute_string( $input_key ); ?>> <label <?php echo $this->get_render_attribute_string( $label_key ); ?>> <?php if ( '' !== $settings['filters_custom'] ) { ?> <i <?php echo $this->get_render_attribute_string( $icon_key ); ?>></i> <?php } ?> <?php echo $field['title']; ?> </label> </div><?php } /** * Render Filter Select Option * * @since 2.1.0 * @return void */ public function render_filter_select_option( $category, $field, $control = 'checkbox' ) { $settings = $this->get_settings(); $option_key = $this->get_repeater_setting_key( $field['name'], 'filters', $category ); if ( 'all' === $field['name'] ) { $value = '' !== $settings['filters_strict'] ? 'all' : 'any'; } else { $value = $field['name']; } $this->add_render_attribute( [ $option_key => [ 'value' => $value, ] ] ); ?> <option <?php echo $this->get_render_attribute_string( $option_key ); ?>> <?php echo $field['title']; ?> </option><?php } /** * Render Filter Select Start * * Markup for opening select tag for filters * * @since 2.1.0 * @return void */ public function render_filter_select_start( $category, $field ) { $settings = $this->get_settings(); $select_key = $this->get_repeater_setting_key( 'select', 'filters', $category ); $option_key = $this->get_repeater_setting_key( 'field', 'filters', $category ); $this->add_render_attribute( [ $option_key => [ 'class' => [ 'ee-form__field', 'ee-form__field--select', 'ee-search-form__field', ], ], $select_key => [ 'name' => $category, 'id' => 'ee_filter_' . $category . '_' . $this->get_id(), 'class' => [ 'ee-search-form__filters-category__filter', 'ee-form__field__control', 'ee-form__field__control--search', 'ee-form__field__control--select', 'ee-form__field__control--text', ], ], ] ); if ( '' !== $settings['filters_custom'] ) { $this->add_render_attribute( $option_key, 'class', 'ee-custom' ); } ?><div <?php echo $this->get_render_attribute_string( $option_key ); ?>> <select <?php echo $this->get_render_attribute_string( $select_key ); ?>><?php // Wee need this for focus states } /** * Render Filter Select End * * Markup for closing select tag for filters * * @since 2.1.0 * @return void */ public function render_filter_select_end( $category ) { $select_key = $this->get_repeater_setting_key( 'select', 'filters', $category ); $label_key = $this->get_repeater_setting_key( 'label', 'filters', $category ); $this->add_render_attribute( [ $label_key => [ 'for' => $select_key, 'class' => [ 'ee-form__field__label', ], ], ] ); ?></select> <label <?php echo $this->get_render_attribute_string( $label_key ); ?>></label> </div><?php } /** * Render Hidden Fields * * Outputs markup with hidden fields for search queries * * @since 2.1.0 * @return void */ public function render_hidden_fields() { $settings = $this->get_settings(); foreach ( $this->_query_filters as $category => $filter ) { foreach ( $filter as $value ) { $this->render_hidden_field( $category, $value, [ 'ee-form__field__control--search', ] ); } } $this->render_hidden_field( 'ee_search_query', '', 'ee-form__field__control--sent' ); if ( '' !== $settings['search_id'] ) { $this->render_hidden_field( 'ee_search_id', $settings['search_id'], 'ee-form__field__control--sent' ); } } /** * Render Hidden Fields * * Outputs markup with hidden fields for search queries * * @since 2.1.0 * @return void */ public function render_hidden_field( $name, $value, $classes = '' ) { $hidden_key = $this->get_repeater_setting_key( $name, 'filters', $value ); $this->add_render_attribute( $hidden_key, [ 'type' => 'hidden', 'class' => $classes, 'name' => $name, 'value' => $value, ] ); ?><input <?php echo $this->get_render_attribute_string( $hidden_key ); ?> /><?php } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 2.1.0 * @return void */ public function content_template() {} } search/module.php 0000644 00000011365 15112147616 0010021 0 ustar 00 <?php namespace ElementorExtras\Modules\Search; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Base\Module_Base; use ElementorExtras\Modules\Search\Conditions; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Search\Module * * @since 2.1.0 */ class Module extends Module_Base { /** * Constructor * * Hook into Elementor to register the widgets * * @access public * @since 2.1.0 * * @return void */ public function __construct() { parent::__construct(); add_filter( 'query_vars', [ $this, 'register_query_vars' ] ); add_action( 'pre_get_posts', [ $this, 'pre_get_posts' ], 1 ); if ( is_plugin_active( 'relevanssi/relevanssi.php' ) ) { add_filter( 'elementor_extras/widgets/posts/query', [ $this, 'add_relevanssi_compatibility' ], 10, 1 ); } if ( is_elementor_pro_active() ) { add_action( 'elementor/theme/register_conditions', [ $this, 'register_conditions' ] ); } } /** * Get Name * * Get the name of the module * * @since 2.1.0 * @return string */ public function get_name() { return 'search'; } /** * Get Widgets * * Get the modules' widgets * * @since 2.1.0 * @return array */ public function get_widgets() { return [ 'Search_Form', ]; } /** * Register Custom Query Vars * * @since 2.1.0 * @return array * @link https://codex.wordpress.org/Plugin_API/Filter_Reference/query_vars */ public function register_query_vars( $vars ) { $vars[] = 'ee_search_query'; $vars[] = 'ee_search_id'; return $vars; } /** * Register Theme Builder Conditions * * @since 2.1.0 * @access public * @param Conditions_Manager $conditions_manager */ public function register_conditions( $conditions_manager ) { $woocommerce_condition = new Conditions\Search_Id(); $conditions_manager->get_condition( 'search' )->register_sub_condition( $woocommerce_condition ); } /** * Pre Get Posts * * Filter search results query * * @since 2.1.0 * @return array * @link https://codex.wordpress.org/Plugin_API/Filter_Reference/query_vars */ function pre_get_posts( $query ) { if ( is_admin() || ! $query->is_main_query() || ! $query->is_search() ){ return; } // Save query vars separately $query_vars = $query->query_vars; if ( ! array_key_exists( 'ee_search_query', $query_vars ) ) { return; } // Check if search query get var exists if ( $query_vars['ee_search_query'] ) { // Decode both url and json $search_query = json_decode( stripcslashes( $query_vars['ee_search_query'] ), JSON_UNESCAPED_SLASHES ); if ( ! is_array( $search_query ) ) { return; } // Set post types if ( isset( $search_query['post_type'] ) ) { // Set the query var $query->set( 'post_type', $search_query['post_type'] ); } // Set post authors if ( isset( $search_query['author'] ) ) { // Set the query var $query->set( 'author__in', $search_query['author'] ); } // Get taxnomnies as names $taxonomies = get_taxonomies( [ 'show_in_nav_menus' => true ] ); $tax_queries = []; // Loop through all public taxonomies foreach ( $taxonomies as $taxonomy ) { if ( ! array_key_exists( $taxonomy, $search_query ) ) { // Taxnonomy appears in restrictions continue; } // If no taxnomy terms sent if ( ! $search_query[ $taxonomy ] ) { continue; } $terms = $search_query[ $taxonomy ]; $operator = 'IN'; if ( is_array( $search_query[ $taxonomy ] ) && in_array( 'all', $search_query[ $taxonomy ] ) ) { array_splice( $terms, array_search( 'all', $terms ), 1 ); } else if ( 'all' === $terms ) { $terms = array_keys( Utils::get_terms_options( $taxonomy, 'slug', false ) ); } else if ( 'any' === $terms ) { continue; } // Add to tax query array $tax_queries[] = array( 'taxonomy' => $taxonomy, 'field' => 'slug', 'operator' => $operator, 'terms' => $terms, ); } if ( count( $tax_queries ) > 1 ) { $tax_queries['relation'] = 'AND'; } // Set the query var $query->set( 'tax_query', $tax_queries ); } return $query; } /** * Add Relevanssi compatibility * * Replaces the default query by running Relevanssi logic on it * if the search form id is present in the query vars * * @since 2.2.2 * @return array * @link https://codex.wordpress.org/Plugin_API/Filter_Reference/query_vars */ public function add_relevanssi_compatibility( $query ) { if ( function_exists( 'relevanssi_do_query' ) && is_search() && get_query_var( 'ee_search_id' ) ) { $relevanssi_query = new \WP_Query(); $relevanssi_query->parse_query( $query->query_vars ); relevanssi_do_query( $relevanssi_query ); return $relevanssi_query; } return $query; } } svg/widgets/inline-svg.php 0000644 00000021576 15112147616 0011614 0 ustar 00 <?php namespace ElementorExtras\Modules\Svg\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Utils; use Elementor\Widget_Base; use Elementor\Controls_Manager; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Inline_SVG * * @since 1.7.0 */ class Inline_Svg extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 1.7.0 * @return string */ public function get_name() { return 'ee-inline-svg'; } /** * Get Title * * Get the title of the widget * * @since 1.7.0 * @return string */ public function get_title() { return __( 'Inline SVG', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 1.7.0 * @return string */ public function get_icon() { return 'nicon nicon-svg'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 1.7.0 * @return array */ public function get_script_depends() { return [ 'elementor-extras' ]; } /** * Register Widget Controls * * @since 1.7.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_content', [ 'label' => __( 'Graphic', 'elementor-extras' ), ] ); $this->add_control( 'svg', [ 'label' => __( 'Choose file', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true ], 'frontend_available' => true, ] ); $this->add_control( 'link', [ 'label' => __( 'Link', 'elementor-extras' ), 'description' => __( 'Active only when tolltips\' Trigger is set to Hover', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'dynamic' => [ 'active' => true ], 'placeholder' => 'http://your-link.com', 'default' => [ 'url' => '', ], 'separator' => 'after', 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style', [ 'label' => __( 'Graphic', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], ] ); $this->add_control( 'sizing', [ 'label' => __( 'Sizing', 'elementor-extras' ), 'description' => __( 'Makes contents responsive and allows you to change maximum width and aspect ratio', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', ] ); $this->add_control( 'maintain_ratio', [ 'label' => __( 'Keep aspect ratio', 'elementor-extras' ), 'description' => __( 'Maintains width / height ratio intact. Note: Use this feature carefully as it might distort elements inside the SVG.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'condition' => [ 'sizing' => 'yes' ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'width', [ 'label' => __( 'Width', 'elementor-extras' ), 'description' => __( 'Set the maximum width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1920, 'step' => 10, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-inline-svg' => 'width: 100%; max-width: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-inline-svg > svg' => 'width: 100%; height: auto; min-width: auto;', ], 'condition' => [ 'sizing' => 'yes' ], ] ); $this->add_responsive_control( 'height', [ 'label' => __( 'Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => '', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 1920, 'step' => 10, ], '%' => [ 'min' => 0, 'max' => 100, ], ], 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-inline-svg > svg' => 'height: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'sizing' => 'yes', 'maintain_ratio!' => 'yes' ], ] ); $this->add_control( 'remove_inline_css', [ 'label' => __( 'Convert CSS to attributes', 'elementor-extras' ), 'description' => __( 'Sometimes a SVG might have internal or inline CSS styling preventing you to set a custom color. This happens usually when exporting artwork from Illustrator. Keeping this option on will prevent strange color behaviour when multiple Inline SVG widgets are on the same page.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'override_colors', [ 'label' => __( 'Override Color', 'elementor-extras' ), 'description' => __( 'Specify the color for all svg elements that have a fill or stroke color set.', 'elementor-extras' ), 'frontend_available' => true, 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'svg', 'selector' => '{{WRAPPER}} .ee-inline-svg', ] ); $this->update_control( 'svg_transition', array( 'default' => 'custom', )); $this->add_control( 'color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-inline-svg' => 'color: {{VALUE}} !important', ], 'condition' => [ 'override_colors!' => '', ], ] ); $this->add_control( 'color_hover', [ 'label' => __( 'Hover Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_SECONDARY, ], 'selectors' => [ '{{WRAPPER}} .ee-inline-svg:hover' => 'color: {{VALUE}} !important', ], 'condition' => [ 'override_colors!' => '', ] ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 1.7.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); $tag = 'div'; if ( empty( $settings['svg']['url'] ) ) { echo $this->render_placeholder( ['body' => __( 'Select your SVG file.', 'elementor-extras' ) ] ); return; } // Add main class to wrapper $this->add_render_attribute( [ 'wrapper' => [ 'class' => 'ee-inline-svg-wrapper', ], 'svg' => [ 'class' => 'ee-inline-svg', 'data-url' => $settings['svg']['url'], ], ] ); if ( ! empty( $settings['link']['url'] ) ) { $tag = 'a'; $this->add_render_attribute( 'svg', 'href', $settings['link']['url'] ); if ( $settings['link']['is_external'] ) { $this->add_render_attribute( 'svg', 'target', '_blank' ); } if ( ! empty( $settings['link']['nofollow'] ) ) { $this->add_render_attribute( 'svg', 'rel', 'nofollow' ); } } ?><div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>> <<?php echo $tag ?> <?php echo $this->get_render_attribute_string( 'svg' ); ?>></<?php echo $tag; ?>> </div><?php } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 1.7.0 * @return void */ protected function content_template() {} } svg/module.php 0000644 00000001117 15112147616 0007345 0 ustar 00 <?php namespace ElementorExtras\Modules\Svg; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Svg\Module * * @since 1.6.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.6.0 * @return string */ public function get_name() { return 'svg'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.6.0 * @return array */ public function get_widgets() { return [ 'Inline_Svg', ]; } } switcher/skins/skin-base.php 0000644 00000002420 15112147616 0012112 0 ustar 00 <?php namespace ElementorExtras\Modules\Switcher\Skins; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Group_Control_Image_Size; use Elementor\Skin_Base as Elementor_Skin_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Switcher\Skins * * @since 1.9.0 */ abstract class Skin_Base extends Elementor_Skin_Base { /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 1.9.0 * @return void */ protected function _register_controls_actions() { add_action( 'elementor/element/ee-switcher/section_items/before_section_end', [ $this, 'register_controls' ] ); } /** * Register Controls * * @since 1.9.0 * @return void * @param $widget Extras_Widget */ public function register_controls( Extras_Widget $widget ) { $this->parent = $widget; $this->register_content_controls(); } /** * Register Content Controls * * @since 1.9.0 * @return void */ public function register_content_controls() {} /** * Render * * Render widget contents on frontend * * @since 1.9.0 * @return void */ public function render() { $this->parent->render(); } } switcher/skins/skin-classic.php 0000644 00000002326 15112147616 0012626 0 ustar 00 <?php namespace ElementorExtras\Modules\Switcher\Skins; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Border; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Switcher\Skins * * @since 1.9.0 */ class Skin_Classic extends Skin_Base { /** * Get ID * * Gets the current skin ID * * @since 1.9.0 * @return string */ public function get_id() { return 'classic'; } /** * Get Title * * Gets the current skin title * * @since 1.9.0 * @return string */ public function get_title() { return __( 'Classic', 'elementor-extras' ); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 1.9.0 * @return void */ protected function _register_controls_actions() { parent::_register_controls_actions(); // add_action( 'elementor/element/ee-switcher/section_query/after_section_end', [ $this, 'register_parallax_controls' ] ); } /** * Register Layout Content Controls * * @since 1.9.0 * @return void */ public function register_layout_content_controls() { parent::register_layout_content_controls(); } } switcher/widgets/switcher.php 0000644 00000233127 15112147616 0012417 0 ustar 00 <?php namespace ElementorExtras\Modules\Switcher\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\Switcher\Skins; use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Repeater; use Elementor\Utils; use Elementor\Icons_Manager; use Elementor\Controls_Manager; use Elementor\Control_Media; use Elementor\Group_Control_Border; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Background; use Elementor\Group_Control_Css_Filter; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Switcher * * @since 1.9.0 */ class Switcher extends Extras_Widget { /** * Has template content * * @since 1.9.0 * @var bool */ protected $_has_template_content = false; /** * Get Name * * Get the name of the widget * * @since 1.9.0 * @return string */ public function get_name() { return 'ee-switcher'; } /** * Get Title * * Get the title of the widget * * @since 1.9.0 * @return string */ public function get_title() { return __( 'Switcher', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 1.9.0 * @return string */ public function get_icon() { return 'nicon nicon-switcher'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 1.9.0 * @return array */ public function get_script_depends() { return [ 'ee-switcher', 'parallax-element', 'gsap-js', 'splittext', 'custom-ease', 'jquery-resize-ee', 'jquery-appear', 'jquery-visible', ]; } /** * Register Skins * * @since 1.9.0 * @return void */ protected function register_skins() { $this->add_skin( new Skins\Skin_Classic( $this ) ); } /** * Register Widget Controls * * @since 1.9.0 * @return void */ protected function _register_controls() { $this->register_content_controls(); $this->register_settings_controls(); $this->register_effects_controls(); $this->register_interaction_controls(); $this->register_layout_style_controls(); $this->register_media_style_controls(); $this->register_title_style_controls(); $this->register_description_style_controls(); $this->register_menu_style_controls(); $this->register_arrows_style_controls(); } /** * Register Content Controls * * @since 1.9.0 * @return void */ protected function register_content_controls() { $this->start_controls_section( 'section_items', [ 'label' => __( 'Content', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'layout', [ 'label' => __( 'Skin', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), 'overlay' => __( 'Overlay', 'elementor-extras' ), ], 'prefix_class' => 'ee-switcher-skin--', ] ); $content = new Repeater(); $content->start_controls_tabs( 'items_repeater' ); $content->start_controls_tab( 'tab_content', [ 'label' => __( 'Content', 'elementor-extras' ) ] ); $content->add_control( 'image', [ 'label' => __( 'Image', 'elementor-extras' ), 'type' => Controls_Manager::MEDIA, 'dynamic' => [ 'active' => true ], 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], ] ); $content->add_control( 'title', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => __( 'Content Title', 'elementor-extras' ), ] ); $content->add_control( 'description', [ 'label' => __( 'Description', 'elementor-extras' ), 'description' => __( 'Remeber to enables the display of description under the Settings section.', 'elementor-extras' ), 'dynamic' => [ 'active' => true ], 'type' => Controls_Manager::WYSIWYG, 'default' => '', 'rows' => 5, ] ); $content->add_control( 'label', [ 'label' => __( 'Label', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => __( 'Navigation Label', 'elementor-extras' ), ] ); $content->add_control( 'selected_icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::ICONS, 'skin' => 'inline', 'label_block' => false, 'fa4compatibility' => 'icon', ] ); $content->add_control( 'icon_align', [ 'label' => __( 'Icon Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'left', 'options' => [ 'left' => __( 'Before', 'elementor-extras' ), 'right' => __( 'After', 'elementor-extras' ), ], 'condition' => [ 'selected_icon[value]!' => '', ], ] ); $content->add_control( 'icon_indent', [ 'label' => __( 'Icon Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'condition' => [ 'selected_icon[value]!' => '', ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-icon--right' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}} {{CURRENT_ITEM}} .ee-icon--left' => 'margin-right: {{SIZE}}{{UNIT}};', ], ] ); $content->end_controls_tab(); $content->start_controls_tab( 'tab_settings', [ 'label' => __( 'Settings', 'elementor-extras' ) ] ); $content->add_control( 'link', [ 'label' => __( 'Link', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'dynamic' => [ 'active' => true ], 'placeholder' => esc_url( home_url( '/' ) ), 'frontend_available' => true, ] ); $content->end_controls_tab(); $content->start_controls_tab( 'tab_style', [ 'label' => __( 'Style', 'elementor-extras' ) ] ); $content->add_control( 'background_switcher_heading', [ 'label' => __( 'Background Switcher', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $content->add_control( 'background_switcher_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'frontend_available' => true, ] ); $content->end_controls_tab(); $content->end_controls_tabs(); $this->add_control( 'items', [ 'label' => __( 'Items', 'elementor-extras' ), 'type' => Controls_Manager::REPEATER, 'default' => [ [ 'title' => __( 'Title', 'elementor-extras' ), 'label' => __( 'Item #1', 'elementor-extras' ), 'description' => __( 'Lorem ipsum dolor sit amet, dictas evertitur philosophia an duo. At tamquam similique constituam vis, his tale similique disputationi an.', 'elementor-extras' ), ], [ 'title' => __( 'Title', 'elementor-extras' ), 'label' => __( 'Item #2', 'elementor-extras' ), 'description' => __( 'Periculis voluptatum vis ad, ex nam alienum iudicabit reprehendunt. Movet iisque voluptatum nec at.', 'elementor-extras' ), ], [ 'title' => __( 'Title', 'elementor-extras' ), 'label' => __( 'Item #2', 'elementor-extras' ), 'description' => __( 'Hinc novum id mei, mel nominavi probatus id. Meis iudicabit ei nam, vidit latine atomorum vim at, ne pro purto cotidieque.', 'elementor-extras' ), ], ], 'fields' => $content->get_controls(), 'title_field' => '{{{ label }}}', ] ); $this->add_control( 'linking_heading', [ 'label' => __( 'Linking', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'link_to', [ 'label' => __( 'Link to', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'custom', 'options' => [ 'file' => __( 'Media File', 'elementor-extras' ), 'attachment' => __( 'Attachment Page', 'elementor-extras' ), 'custom' => __( 'Item URL', 'elementor-extras' ), ], ] ); $this->add_control( 'link_image', [ 'label' => __( 'Link Image', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', 'condition' => [ 'layout!' => 'overlay', ], ] ); $this->add_control( 'link_title', [ 'label' => __( 'Link Title', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', ] ); $this->add_control( 'link_description', [ 'label' => __( 'Link Description', 'elementor-extras' ), 'description' => __( 'Make sure you don\'t have any links inside your descriptions in order to avoid HTML and display errors', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'condition' => [ 'description!' => '', ], ] ); $this->add_control( 'link_open_lightbox', [ 'label' => __( 'Lightbox', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'default', 'separator' => 'before', 'options' => [ 'default' => __( 'Default', 'elementor-extras' ), 'yes' => __( 'Yes', 'elementor-extras' ), 'no' => __( 'No', 'elementor-extras' ), ], 'condition' => [ 'link_to' => 'file', ], ] ); $this->add_control( 'lightbox_slideshow', [ 'label' => __( 'Lightbox Slideshow', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'condition' => [ 'link_to' => 'file', 'link_open_lightbox' => ['default', 'yes'], ], ] ); $this->end_controls_section(); } /** * Register Settings Controls * * @since 1.9.0 * @return void */ protected function register_settings_controls() { $this->start_controls_section( 'section_settings', [ 'label' => __( 'Settings', 'elementor-extras' ), ] ); $this->add_control( 'settings_switcher_heading', [ 'label' => __( 'General', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'autoplay', [ 'label' => __( 'Autoplay', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'duration', [ 'label' => __( 'Autoplay Duration (s)', 'elementor-extras' ), 'description' => __( 'How long should an item stay on screen before being switched.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0.2, 'max' => 5, 'step'=> 0.1, ], ], 'condition' => [ 'autoplay!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'autoplay_preview', [ 'label' => __( 'Autoplay in Editor', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'condition' => [ 'autoplay!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'autoplay_cancel', [ 'label' => __( 'Stop on Interaction', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'condition' => [ 'autoplay!' => '', ], 'frontend_available' => true, ] ); $this->add_control( 'loop', [ 'label' => __( 'Loop', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'background_switcher_heading', [ 'label' => __( 'Background switcher', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'background_switcher', [ 'label' => __( 'Enable', 'elementor-extras' ), 'description' => __( 'Turn on changing of widget, section or page background color when switching items.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'background_switcher_notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Select the background color for each item under Content > Item > Style Tab.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', 'condition' => [ 'background_switcher!' => '' ], ] ); $this->add_control( 'background_switcher_element', [ 'label' => __( 'Change Element', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Body', 'elementor-extras' ), 'widget' => __( 'Widget', 'elementor-extras' ), 'section' => __( 'Section', 'elementor-extras' ), ], 'condition' => [ 'background_switcher!' => '' ], 'frontend_available' => true, ] ); $this->add_control( 'settings_images_heading', [ 'label' => __( 'Images', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Image_Size::get_type(), [ 'name' => 'image', // Actually its `original_image_size`. 'label' => __( 'Image Size', 'elementor-extras' ), 'exclude' => ['custom'], 'default' => 'full', ] ); $this->add_control( 'settings_title_heading', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'title_heading_tag', [ 'label' => __( 'HTML Tag', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => __( 'H1', 'elementor-extras' ), 'h2' => __( 'H2', 'elementor-extras' ), 'h3' => __( 'H3', 'elementor-extras' ), 'h4' => __( 'H4', 'elementor-extras' ), 'h5' => __( 'H5', 'elementor-extras' ), 'h6' => __( 'H6', 'elementor-extras' ), 'div' => __( 'div', 'elementor-extras' ), 'span' => __( 'span', 'elementor-extras' ), ], 'default' => 'h1', ] ); $this->add_control( 'settings_description_heading', [ 'label' => __( 'Description', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'description', [ 'label' => __( 'Enable', 'elementor-extras' ), 'description' => __( 'Disable this to hide the description wrappers completely.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', ] ); $this->add_control( 'settings_navigation_heading', [ 'label' => __( 'Navigation', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_responsive_control( 'menu', [ 'label' => __( 'Menu', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'show', 'tablet_default' => 'show', 'mobile_default' => 'hide', 'options' => [ 'show' => __( 'Show', 'elementor-extras' ), 'hide' => __( 'Hide', 'elementor-extras' ), ], 'frontend_available' => true, 'prefix_class' => 'ee-switcher-menu%s-', ] ); $this->add_responsive_control( 'arrows', [ 'label' => __( 'Arrows', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'hide', 'tablet_default' => 'hide', 'mobile_default' => 'show', 'options' => [ 'show' => __( 'Show', 'elementor-extras' ), 'hide' => __( 'Hide', 'elementor-extras' ), ], 'frontend_available' => true, 'prefix_class' => 'ee-switcher-arrows%s-', ] ); $this->end_controls_section(); } /** * Register Effects Controls * * @since 1.9.0 * @return void */ protected function register_effects_controls() { $this->start_controls_section( '_section_effects', [ 'label' => __( 'Effects', 'elementor-extras' ), ] ); $this->add_control( 'effect_entrance', [ 'label' => __( 'Entrance Animation', 'elementor-extras' ), 'description' => __( 'Animate the first item when entering viewport.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'effect_entrance_preview', [ 'label' => __( 'Preview in Editor', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'frontend_available' => true, 'separator' => 'after', 'condition' => [ 'effect_entrance!' => '', ], ] ); $this->add_control( 'speed', [ 'label' => __( 'Animation Speed (s)', 'elementor-extras' ), 'description' => __( 'The time it takes for the transition to complete.', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0.2, 'max' => 3, 'step'=> 0.1, ], ], 'frontend_available' => true, ] ); $this->add_control( 'effects_media_heading', [ 'label' => __( 'Media', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'effect_media', [ 'label' => __( 'Media Effect', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'swipeLeft', 'options' => [ 'coverLeft' => __( 'Cover Left', 'elementor-extras' ), 'coverRight' => __( 'Cover Right', 'elementor-extras' ), 'coverBottom' => __( 'Cover Bottom', 'elementor-extras' ), 'coverTop' => __( 'Cover Top', 'elementor-extras' ), 'uncoverLeft' => __( 'Uncover Left', 'elementor-extras' ), 'uncoverRight' => __( 'Uncover Right', 'elementor-extras' ), 'uncoverBottom' => __( 'Uncover Bottom', 'elementor-extras' ), 'uncoverTop' => __( 'Uncover Top', 'elementor-extras' ), 'fade' => __( 'Fade', 'elementor-extras' ), 'slideLeft' => __( 'Slide Left', 'elementor-extras' ), 'slideRight' => __( 'Slide Right', 'elementor-extras' ), 'slideTop' => __( 'Slide Top', 'elementor-extras' ), 'slideBottom' => __( 'Slide Bottom', 'elementor-extras' ), 'flipHorizontal' => __( 'Flip Horizontal', 'elementor-extras' ), 'flipVertical' => __( 'Flip Vertical', 'elementor-extras' ), 'swipeLeft' => __( 'Swipe Left', 'elementor-extras' ), 'swipeRight' => __( 'Swipe Right', 'elementor-extras' ), 'swipeBottom' => __( 'Swipe Bottom', 'elementor-extras' ), 'swipeTop' => __( 'Swipe Top', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_control( 'effect_media_zoom', [ 'label' => __( 'Zoom', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', 'frontend_available' => true, 'conditions' => [ 'relation' => 'or', 'terms' => [ [ 'name' => 'effect_media', 'operator' => '!=', 'value' => 'flipVertical', ], [ 'name' => 'effect_media', 'operator' => '!=', 'value' => 'flipHorizontal', ], ] ], ] ); $this->add_control( 'effects_text_heading', [ 'label' => __( 'Title', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'effect_title', [ 'label' => __( 'Title Effect', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'slideLeft', 'options' => [ 'slideLeft' => __( 'Slide Left', 'elementor-extras' ), 'slideRight' => __( 'Slide Right', 'elementor-extras' ), 'slideTop' => __( 'Slide Top', 'elementor-extras' ), 'slideBottom' => __( 'Slide Bottom', 'elementor-extras' ), 'fade' => __( 'Fade', 'elementor-extras' ), 'scale' => __( 'Scale', 'elementor-extras' ), ], 'frontend_available' => true, ] ); $this->add_control( 'effect_title_stagger', [ 'label' => __( 'Character Delay', 'elementor-extras' ), 'description' => __( 'Wether or not to animate each character with a slight delay.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->end_controls_section(); } /** * Register Interaction Controls * * @since 1.9.0 * @return void */ protected function register_interaction_controls() { $this->start_controls_section( 'section_interactions', [ 'label' => __( 'Interactions', 'elementor-extras' ), ] ); $this->add_control( 'pan_heading', [ 'label' => __( 'Mouse Parallax', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'parallax_enable', [ 'label' => __( 'Enable', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'parallax_amount', [ 'label' => __( 'Pan Amount', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0.1, 'max' => 1, 'step'=> 0.01, ], ], 'frontend_available' => true, 'condition' => [ 'parallax_enable!' => '', ], ] ); $this->add_control( 'parallax_pan_axis', [ 'label' => __( 'Pan Axis', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'both', 'options' => [ 'both' => __( 'Both', 'elementor-extras' ), 'vertical' => __( 'Vertical', 'elementor-extras' ), 'horizontal' => __( 'Horizontal', 'elementor-extras' ), ], 'frontend_available' => true, 'condition' => [ 'parallax_enable!' => '', ], ] ); // $this->add_control( // 'tilt_heading', // [ // 'label' => __( 'Tilt', 'elementor-extras' ), // 'type' => Controls_Manager::HEADING, // 'separator' => 'before', // 'condition' => [ // 'skin!' => 'overlay', // ], // ] // ); // $this->add_control( // 'tilt_enable', // [ // 'label' => __( 'Enable', 'elementor-extras' ), // 'type' => Controls_Manager::SWITCHER, // 'default' => '', // 'label_on' => __( 'Yes', 'elementor-extras' ), // 'label_off' => __( 'No', 'elementor-extras' ), // 'return_value' => 'yes', // 'frontend_available' => true, // 'condition' => [ // 'skin!' => 'overlay', // ], // ] // ); // $this->add_control( // 'tilt_axis', // [ // 'label' => __( 'Axis', 'elementor-extras' ), // 'type' => Controls_Manager::SELECT, // 'default' => '', // 'options' => [ // '' => __( 'Both', 'elementor-extras' ), // 'x' => __( 'X Only', 'elementor-extras' ), // 'y' => __( 'Y Only', 'elementor-extras' ), // ], // 'frontend_available' => true, // 'condition' => [ // 'skin!' => 'overlay', // 'tilt_enable' => 'yes', // ], // ] // ); // $this->add_control( // 'tilt_amount', // [ // 'label' => __( 'Amount', 'elementor-extras' ), // 'type' => Controls_Manager::SLIDER, // 'range' => [ // 'px' => [ // 'min' => 10, // 'max' => 40, // ], // ], // 'default' => [ // 'size' => 20, // ], // 'frontend_available' => true, // 'condition' => [ // 'skin!' => 'overlay', // 'tilt_enable' => 'yes', // ], // ] // ); // $this->add_control( // 'tilt_scale', // [ // 'label' => __( 'Scale', 'elementor-extras' ), // 'type' => Controls_Manager::SLIDER, // 'range' => [ // 'px' => [ // 'min' => 1, // 'max' => 1.5, // 'step' => 0.01, // ], // ], // 'default' => [ // 'size' => 1.05, // ], // 'frontend_available' => true, // 'condition' => [ // 'skin!' => 'overlay', // 'tilt_enable' => 'yes', // ], // ] // ); // $this->add_control( // 'tilt_speed', // [ // 'label' => __( 'Speed', 'elementor-extras' ), // 'type' => Controls_Manager::SLIDER, // 'range' => [ // 'px' => [ // 'min' => 100, // 'max' => 1000, // 'step' => 50, // ], // ], // 'default' => [ // 'size' => 800, // ], // 'frontend_available' => true, // 'condition' => [ // 'skin!' => 'overlay', // 'tilt_enable' => 'yes', // ], // ] // ); $this->end_controls_section(); } /** * Register Layout Style Controls * * @since 1.9.0 * @return void */ protected function register_layout_style_controls() { $this->start_controls_section( 'section_style_layout', [ 'label' => __( 'Layout', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'layout_stack', [ 'label' => __( 'Stack on', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'tablet', 'options' => [ 'mobile' => __( 'Mobile', 'elementor-extras' ), 'tablet' => __( 'Tablet', 'elementor-extras' ), 'desktop' => __( 'Desktop', 'elementor-extras' ), ], 'condition' => [ 'layout' => 'default', ], 'prefix_class' => 'ee-switcher-stack-' ] ); $this->add_responsive_control( 'layout_height', [ 'label' => __( 'Min Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 800, ], 'vh' => [ 'min' => 0, 'max' => 100, ], ], 'condition' => [ 'layout' => 'overlay', ], 'size_units' => [ 'px', 'vh' ], 'selectors' => [ '{{WRAPPER}}.ee-switcher-skin--overlay .ee-switcher__wrapper' => 'min-height: {{SIZE}}{{UNIT}}', ] ] ); $this->add_responsive_control( 'layout_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}}.ee-switcher-skin--default .ee-switcher__wrapper' => 'margin-left: -{{SIZE}}px;', '{{WRAPPER}}.ee-switcher-skin--default .ee-switcher__media-wrapper, {{WRAPPER}}.ee-switcher-skin--default .ee-switcher__content-wrapper' => 'padding-left: {{SIZE}}px;', ], 'condition' => [ 'layout' => 'default', ] ] ); $this->add_responsive_control( 'layout_content_padding', [ 'label' => __( 'Content Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__content' => 'padding: {{SIZE}}px', ], ] ); $this->add_control( 'layout_vertical_aligment', [ 'label' => __( 'Vertical Align', 'elementor-extras' ), 'label_block' => false, 'type' => Controls_Manager::CHOOSE, 'options' => [ 'flex-start' => [ 'title' => __( 'Top', 'elementor-extras' ), 'icon' => 'eicon-v-align-top', ], 'center' => [ 'title' => __( 'Middle', 'elementor-extras' ), 'icon' => 'eicon-v-align-middle', ], 'flex-end' => [ 'title' => __( 'Bottom', 'elementor-extras' ), 'icon' => 'eicon-v-align-bottom', ], 'stretch' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-v-align-stretch', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}} .ee-switcher__wrapper' => 'align-items: {{VALUE}};', '{{WRAPPER}} .ee-switcher__content-wrapper' => 'align-items: {{VALUE}};', ], ] ); $this->add_control( 'layout_reverse', [ 'label' => __( 'Reverse', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'reverse', 'prefix_class' => 'ee-switcher-layout--', 'condition' => [ 'layout' => 'default', ], ] ); $this->end_controls_section(); } /** * Register Media Style Controls * * @since 1.9.0 * @return void */ protected function register_media_style_controls() { $this->start_controls_section( 'section_style_media', [ 'label' => __( 'Media', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'media_width', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 500, ], '%' => [ 'min' => 10, 'max' => 80, ], ], 'condition' => [ 'layout' => 'default', ], 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}}.ee-switcher-skin--default .ee-switcher__media-wrapper' => 'min-width: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'layout' => 'default', ], ] ); $this->add_responsive_control( 'media_height', [ 'label' => __( 'Min Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 800, ], 'vh' => [ 'min' => 0, 'max' => 100, ], ], 'condition' => [ 'layout' => 'default', ], 'size_units' => [ 'px', 'vh' ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__media' => 'min-height: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'layout' => 'default', ], ] ); $this->add_responsive_control( 'media_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 20, ], ], 'condition' => [ 'layout' => 'default', ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__media__items' => 'border-radius: {{SIZE}}px', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'media', 'selector' => '{{WRAPPER}} .ee-switcher__media', 'exclude' => [ 'box_shadow_position' ], 'separator' => '', ] ); $this->add_control( 'media_overlay', [ 'label' => __( 'Overlay', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'condition' => [ 'layout' => 'overlay', ], 'separator' => 'before', ] ); $this->add_control( 'media_overlay_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-media__overlay' => 'background-color: {{VALUE}};', ], 'condition' => [ 'layout' => 'overlay', ], ] ); $this->add_control( 'media_overlay_blend', [ 'label' => __( 'Blend mode', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'normal', 'options' => [ 'normal' => __( 'Normal', 'elementor-extras' ), 'multiply' => __( 'Multiply', 'elementor-extras' ), 'screen' => __( 'Screen', 'elementor-extras' ), 'overlay' => __( 'Overlay', 'elementor-extras' ), 'darken' => __( 'Darken', 'elementor-extras' ), 'lighten' => __( 'Lighten', 'elementor-extras' ), 'color' => __( 'Color', 'elementor-extras' ), 'color-dodge' => __( 'Color Dodge', 'elementor-extras' ), 'hue' => __( 'Hue', 'elementor-extras' ), ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__media__overlay' => 'mix-blend-mode: {{VALUE}};', ], 'condition' => [ 'layout' => 'overlay', ], ] ); $this->add_control( 'media_overlay_blend_notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => sprintf( __( 'Please check blend mode support for your browser %1$s here %2$s', 'elementor-extras' ), '<a href="https://caniuse.com/#search=mix-blend-mode" target="_blank">', '</a>' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'condition' => [ 'overlay_blend!' => 'normal', 'layout' => 'overlay', ], ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'media_css_filters', 'selector' => '{{WRAPPER}} .ee-switcher__media', ] ); $this->end_controls_section(); } /** * Register Title Style Controls * * @since 1.9.0 * @return void */ protected function register_title_style_controls() { $this->start_controls_section( 'section_style_title', [ 'label' => __( 'Title', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'title_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-switcher__title' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'title_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__titles' => 'text-align: {{VALUE}};', ] ] ); $this->add_responsive_control( 'title_overlap', [ 'label' => __( 'Overlap', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'vw' => [ 'min' => 0, 'max' => 50, ], 'px' => [ 'min' => 0, 'max' => 200, ], ], 'size_units' => [ 'vw', 'px' ], 'condition' => [ 'layout' => 'default', ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__titles' => 'margin-left: -{{SIZE}}{{UNIT}};', '{{WRAPPER}}.ee-switcher-layout--reverse .ee-switcher__titles' => 'margin-left: 0px; margin-right: -{{SIZE}}{{UNIT}};', ] ] ); $this->add_responsive_control( 'title_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__titles' => 'margin-top: {{SIZE}}px', ], ] ); $this->add_responsive_control( 'title_font_size', [ 'label' => __( 'Font Size (vw)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 30, ], ], 'default' => [ 'size' => 8, ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__title' => 'font-size: {{SIZE}}vw', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'exclude' => [ 'font_size', 'font_style' ], 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, ], 'selector' => '{{WRAPPER}} .ee-switcher__title', ] ); $this->end_controls_section(); } /** * Register Description Style Controls * * @since 1.9.0 * @return void */ protected function register_description_style_controls() { $this->start_controls_section( 'section_style_description', [ 'label' => __( 'Description', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'description!' => '', ], ] ); $this->add_control( 'description_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-switcher__descriptions__description' => 'color: {{VALUE}};', ], 'condition' => [ 'description!' => '', ], ] ); $this->add_responsive_control( 'description_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'condition' => [ 'description!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__descriptions__description' => 'text-align: {{VALUE}};', ] ] ); $this->add_responsive_control( 'description_overlap', [ 'label' => __( 'Overlap', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'vw' => [ 'min' => 0, 'max' => 50, ], 'px' => [ 'min' => 0, 'max' => 200, ], ], 'size_units' => [ 'vw', 'px' ], 'condition' => [ 'layout' => 'default', 'description!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__descriptions' => 'margin-left: -{{SIZE}}{{UNIT}};', '{{WRAPPER}}.ee-switcher-layout--reverse .ee-switcher__descriptions' => 'margin-left: 0px; margin-right: -{{SIZE}}{{UNIT}};', ] ] ); $this->add_responsive_control( 'description_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'condition' => [ 'description!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__descriptions' => 'margin-top: {{SIZE}}px', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'description_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} .ee-switcher__descriptions__description', 'condition' => [ 'description!' => '', ], ] ); $this->end_controls_section(); } /** * Register Menu Style Controls * * @since 1.9.0 * @return void */ protected function register_menu_style_controls() { $this->start_controls_section( 'section_style_menu', [ 'label' => __( 'Menu', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'menu_layout_heading', [ 'label' => __( 'Layout', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'menu_direction', [ 'label' => __( 'Direction', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'row', 'options' => [ 'row' => [ 'title' => __( 'Vertical', 'elementor-extras' ), 'icon' => 'nicon nicon-block', ], 'column' => [ 'title' => __( 'Horizontal', 'elementor-extras' ), 'icon' => 'nicon nicon-inline', ], ], 'label_block' => false, ] ); $this->add_responsive_control( 'menu_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'justify', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], 'justify' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-h-align-stretch', ], ], 'label_block' => false, 'prefix_class' => 'ee-switcher-menu%s-align--', ] ); $this->add_responsive_control( 'menu_text_align', [ 'label' => __( 'Text Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'condition' => [ 'menu_align' => 'justify', ], 'label_block' => false, 'selectors' => [ '{{WRAPPER}} .ee-switcher__nav__item' => 'justify-content: {{VALUE}};', ] ] ); $this->add_responsive_control( 'menu_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__nav' => 'margin-top: {{SIZE}}px', ], ] ); $this->add_control( 'menu_items_heading', [ 'label' => __( 'Items', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_responsive_control( 'menu_items_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 48, ], ], 'selectors' => [ '{{WRAPPER}} .ee-nav.ee-nav--stacked .ee-switcher__nav__item' => 'margin-bottom: {{SIZE}}px', '{{WRAPPER}} .ee-nav.ee-nav--inline' => 'margin-left: -{{SIZE}}px; margin-bottom: {{SIZE}}px', '{{WRAPPER}} .ee-nav.ee-nav--inline .ee-switcher__nav__item' => 'margin-left: {{SIZE}}px', ], ] ); $this->add_responsive_control( 'menu_items_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__nav__item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'menu_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_ACCENT, ], 'selector' => '{{WRAPPER}} .ee-switcher__nav__item', ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'menu', 'selector' => '{{WRAPPER}} .ee-switcher__nav__item', ] ); $this->update_control( 'menu_transition', array( 'default' => 'custom', )); $this->start_controls_tabs( 'menu_items_tabs' ); $this->start_controls_tab( 'menu_items_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'menu_items_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-switcher__nav__item' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'menu_items_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-switcher__nav__item' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'menu_items_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'menu_items_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-switcher__nav__item:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'menu_items_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-switcher__nav__item:hover' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'menu_items_tab_active', [ 'label' => __( 'Active', 'elementor-extras' ) ] ); $this->add_control( 'menu_items_color_active', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-switcher__nav__item.is--active' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'menu_items_background_color_active', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-switcher__nav__item.is--active' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'menu_style_loader', [ 'label' => __( 'Separator', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'menu_separator_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-loader' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'menu_loader_color', [ 'label' => __( 'Loader Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-loader__progress' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'menu_separator_thickness', [ 'label' => __( 'Thickness', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 10, ], ], 'default' => [ 'size' => 1, ], 'selectors' => [ '{{WRAPPER}} .ee-loader' => 'height: {{SIZE}}{{UNIT}}', ], ] ); $this->end_controls_section(); } /** * Register Arrows Style Controls * * @since 1.9.0 * @return void */ protected function register_arrows_style_controls() { $this->start_controls_section( 'section_style_arrows', [ 'label' => __( 'Arrows', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'arrows_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-switcher__arrows' => 'margin-top: {{SIZE}}px', ], ] ); $this->add_responsive_control( 'arrows_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'mobile_default' => 'center', 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], 'space-between' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-h-align-stretch', ], ], 'label_block' => false, 'selectors' => [ '{{WRAPPER}} .ee-switcher__arrows' => 'justify-content: {{VALUE}};', ], ] ); $this->add_responsive_control( 'arrows_spacing', [ 'label' => __( 'Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .ee-arrow--next' => 'margin-left: {{SIZE}}px;', ], 'condition' => [ 'arrows_align!' => 'space-between' ], ] ); $this->add_responsive_control( 'arrows_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0.2, 'max' => 2, 'step'=> 0.1 ], ], 'default' => [ 'size' => 0.6, ], 'selectors' => [ '{{WRAPPER}} .ee-arrow' => 'padding: {{SIZE}}em;', ], ] ); $this->add_responsive_control( 'arrows_size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'default' => [ 'size' => 24, ], 'selectors' => [ '{{WRAPPER}} .ee-arrow' => 'font-size: {{SIZE}}px;', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'arrows', 'selector' => '{{WRAPPER}} .ee-arrow', ] ); $this->update_control( 'arrows_transition', array( 'default' => 'custom', )); $this->start_controls_tabs( 'arrows_tabs' ); $this->start_controls_tab( 'arrows_tab_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'arrows_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-arrow' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'arrows_background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-arrow' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'arrows_opacity', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-arrow' => 'opacity: {{SIZE}}', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'arrows_tab_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'arrows_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-arrow:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'arrows_background_color_hover', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-arrow:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'arrows_opacity_hover', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-arrow:hover' => 'opacity: {{SIZE}}', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'arrows_tab_disabled', [ 'label' => __( 'Disabled', 'elementor-extras' ) ] ); $this->add_control( 'arrows_color_disabled', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-arrow.ee-arrow--disabled' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'arrows_background_color_disabled', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-arrow.ee-arrow--disabled' => 'background-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'arrows_opacity_disabled', [ 'label' => __( 'Opacity', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 1, 'step'=> 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-arrow.ee-arrow--disabled' => 'opacity: {{SIZE}}', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_control( 'arrows_style_loader', [ 'label' => __( 'Loader', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'arrows_loader_color', [ 'label' => __( 'Loader Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .ee-arrow__circle--loader.is--animating' => 'stroke: {{VALUE}};', ], ] ); $this->add_responsive_control( 'arrows_loader_thickness', [ 'label' => __( 'Thickness', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 10, ], ], 'default' => [ 'size' => 2, ], 'selectors' => [ '{{WRAPPER}} .ee-arrow__circle--loader' => 'stroke-width: -webkit-calc({{SIZE}} * 2); stroke-width: calc({{SIZE}} * 2);', '{{WRAPPER}} .ee-arrow .ee-arrow__circle--loader' => 'stroke-width: -webkit-calc({{SIZE}}px * 2); stroke-width: calc({{SIZE}}px * 2);', ], ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 1.9.0 * @return void */ public function render() { $this->add_render_attribute( [ 'switcher' => [ 'class' => [ 'ee-switcher', 'ee-switcher--stack-' . $this->get_settings( 'layout_stack' ), ], ], 'switcher-wrapper' => [ 'class' => 'ee-switcher__wrapper', ], 'switcher-media-wrapper' => [ 'class' => [ 'ee-switcher__media-wrapper', 'ee-media--stretch', ], ], 'switcher-content-wrapper' => [ 'class' => 'ee-switcher__content-wrapper', ], 'switcher-content' => [ 'class' => 'ee-switcher__content', ], ] ); ?> <div <?php echo $this->get_render_attribute_string( 'switcher' ); ?>> <div <?php echo $this->get_render_attribute_string( 'switcher-wrapper' ); ?>> <div <?php echo $this->get_render_attribute_string( 'switcher-media-wrapper' ); ?>> <?php $this->render_media_loop(); ?> </div> <div <?php echo $this->get_render_attribute_string( 'switcher-content-wrapper' ); ?>> <div <?php echo $this->get_render_attribute_string( 'switcher-content' ); ?>> <?php $this->render_titles_loop(); $this->render_descriptions_loop(); $this->render_nav_loop(); $this->render_arrows(); ?> </div> </div> </div> </div> <?php } /** * Render Titles Loop * * @since 1.9.0 * @return void */ public function render_titles_loop() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( 'items', 'class', 'ee-switcher__titles' ); ?><div <?php echo $this->get_render_attribute_string( 'items' ); ?>> <?php foreach ( $settings['items'] as $index => $item ) { $title_tag = 'div'; $heading_tag = $settings['title_heading_tag']; $item_key = $this->get_repeater_setting_key( 'item', 'items', $index ); $item_title_key = $this->get_repeater_setting_key( 'item-title', 'items', $index ); $this->add_render_attribute( [ $item_key => [ 'class' => 'ee-switcher__titles__title' ], $item_title_key => [ 'class' => 'ee-switcher__title', ], ] ); if ( 'yes' === $settings['link_title'] ) { $title_tag = 'a'; $this->set_item_link_attributes( $item, $item_key, 'title' ); } ?> <<?php echo $title_tag; ?> <?php echo $this->get_render_attribute_string( $item_key ); ?>> <<?php echo $heading_tag; ?> <?php echo $this->get_render_attribute_string( $item_title_key ); ?>><?php echo $item['title']; ?></<?php echo $heading_tag; ?>> </<?php echo $title_tag; ?>> <?php } ?> </div> <?php } /** * Render Descriptions Loop * * @since 1.9.0 * @return void */ public function render_descriptions_loop() { $settings = $this->get_settings_for_display(); if ( 'yes' !== $settings['description'] ) return; $this->add_render_attribute( 'descriptions', 'class', 'ee-switcher__descriptions' ); ?> <div <?php echo $this->get_render_attribute_string( 'descriptions' ); ?>> <?php foreach ( $settings['items'] as $index => $item ) { $description_tag = 'div'; $description_key = $this->get_repeater_setting_key( 'description', 'items', $index ); $this->add_render_attribute( $description_key, 'class', 'ee-switcher__descriptions__description' ); if ( 'yes' === $settings['link_description'] ) { $description_tag = 'a'; $this->set_item_link_attributes( $item, $description_key, 'description' ); } ?> <<?php echo $description_tag; ?> <?php echo $this->get_render_attribute_string( $description_key ); ?>> <?php echo $item['description']; ?> </<?php echo $description_tag; ?>> <?php } ?> </div> <?php } /** * Render Media Loop * * @since 1.9.0 * @return void */ public function render_media_loop() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'media' => [ 'class' => [ 'ee-switcher__media', 'ee-media', 'ee-effect--' . $settings['effect_media'], ], ], 'media-items' => [ 'class' => [ 'ee-media__wrapper', 'ee-switcher__media__items', ], ], 'media-overlay' => [ 'class' => [ 'ee-switcher__media__overlay', 'ee-media__overlay', ], ], ] ); ?> <div <?php echo $this->get_render_attribute_string( 'media' ); ?>> <div <?php echo $this->get_render_attribute_string( 'media-items' ); ?>> <?php foreach ( $settings['items'] as $index => $item ) { $media_tag = 'div'; $media_item_key = $this->get_repeater_setting_key( 'media-item', 'items', $index ); $image_key = $this->get_repeater_setting_key( 'image', 'items', $index ); $this->add_render_attribute( $media_item_key, 'class', [ 'ee-switcher__media__item', 'ee-media__thumbnail', ]); if ( 'yes' === $settings['link_image'] ) { $media_tag = 'a'; $this->set_item_link_attributes( $item, $media_item_key, 'media' ); } ?> <<?php echo $media_tag; ?> <?php echo $this->get_render_attribute_string( $media_item_key ); ?>><?php $this->add_render_attribute( $image_key, [ 'src' => $this->get_item_image_url( $item ), 'alt' => Control_Media::get_image_alt( $item['image'] ), 'title' => Control_Media::get_image_title( $item['image'] ) ] ); ?><img <?php echo $this->get_render_attribute_string( $image_key ) ?>/> </<?php echo $media_tag; ?>> <?php } ?> </div> <div <?php echo $this->get_render_attribute_string( 'media-overlay' ); ?>></div> </div> <?php } /** * Render Nav Loop * * @since 1.9.0 * @return void */ public function render_nav_loop() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'nav' => [ 'class' => [ 'ee-switcher__nav', 'ee-nav', ], ], 'loader' => [ 'class' => 'ee-loader', ], 'loader-progress' => [ 'class' => 'ee-loader__progress', ], ]); if ( 'row' === $settings['menu_direction'] ) { $this->add_render_attribute( 'nav', 'class', 'ee-nav--stacked' ); } else { $this->add_render_attribute( 'nav', 'class', 'ee-nav--inline' ); } ?> <ul <?php echo $this->get_render_attribute_string( 'nav' ); ?>> <?php foreach ( $settings['items'] as $index => $item ) { $has_icon = false; $nav_item_key = $this->get_repeater_setting_key( 'nav-item', 'items', $index ); $nav_item_label_key = $this->get_repeater_setting_key( 'nav-item-label', 'items', $index ); $nav_item_icon_key = $this->get_repeater_setting_key( 'nav-item-icon', 'items', $index ); $nav_icon_wrapper_key = $this->get_repeater_setting_key( 'nav-icon-wrapper', 'items', $index ); $migrated = isset( $item['__fa4_migrated']['selected_icon'] ); $is_new = empty( $item['icon'] ) && Icons_Manager::is_migration_allowed(); if ( ! empty( $item['icon'] ) || ! empty( $item['selected_icon']['value'] ) ) { $this->add_render_attribute( $nav_icon_wrapper_key, 'class', [ 'ee-icon', 'ee-icon--' . $item['icon_align'], 'ee-icon-support--svg', 'ee-icon-support--svg-large', 'ee-switcher__nav__icon', ] ); if ( ! empty( $item['icon'] ) ) { $this->add_render_attribute( [ $nav_item_icon_key => [ 'class' => esc_attr( $item['icon'] ), 'aria-hidden' => 'true', ], ] ); } $this->add_render_attribute( $nav_item_key, 'class', 'has--icon' ); $has_icon = true; } if ( 'yes' === $settings['background_switcher'] ) { $this->add_render_attribute( $nav_item_key, 'data-switcher-background', $item['background_switcher_color'] ); } // $this->add_inline_editing_attributes( $navItemLabelKey, 'none' ); $this->add_render_attribute( $nav_item_key, 'class', [ 'ee-switcher__nav__item', 'ee-nav__item', 'elementor-repeater-item-' . $item['_id'], ]); ?> <li <?php echo $this->get_render_attribute_string( $nav_item_key ); ?>><?php if ( $has_icon ) { ?><span <?php echo $this->get_render_attribute_string( $nav_icon_wrapper_key ); ?>><?php if ( $is_new || $migrated ) { Icons_Manager::render_icon( $item['selected_icon'], [ 'aria-hidden' => 'true' ], 'i' ); } else { ?><span <?php echo $this->get_render_attribute_string( $nav_item_icon_key ); ?>></span><?php } ?></span><?php } if ( '' !== $item['label'] ) { ?><span <?php echo $this->get_render_attribute_string( $nav_item_label_key ); ?>><?php echo $item['label']; ?></span><?php } ?><span <?php echo $this->get_render_attribute_string( 'loader' ); ?>> <span <?php echo $this->get_render_attribute_string( 'loader-progress' ); ?>></span> </span> </li> <?php } ?> </ul> <?php } /** * Render Arrows * * @since 1.9.0 * @return void */ public function render_arrows() { $this->add_render_attribute( [ 'arrows' => [ 'class' => 'ee-switcher__arrows', ], 'arrow-prev' => [ 'class' => [ 'ee-arrow', 'ee-arrow--prev', ], ], 'arrow-prev-icon' => [ 'class' => 'eicon-chevron-left', ], 'arrow-next' => [ 'class' => [ 'ee-arrow', 'ee-arrow--next', ], ], 'arrow-next-icon' => [ 'class' => 'eicon-chevron-right', ], ] ); ?> <ul <?php echo $this->get_render_attribute_string( 'arrows' ); ?>> <li <?php echo $this->get_render_attribute_string( 'arrow-prev' ); ?>> <i <?php echo $this->get_render_attribute_string( 'arrow-prev-icon' ); ?>></i> </li> <li <?php echo $this->get_render_attribute_string( 'arrow-next' ); ?>> <i <?php echo $this->get_render_attribute_string( 'arrow-next-icon' ); ?>></i> <svg x="0px" y="0px" viewBox="0 0 80 80" xml:space="preserve" class="ee-arrow__svg"> <defs> <clipPath id="clipLoader<?php echo $this->get_id(); ?>"> <circle cx="40" cy="40" r="40"/> </clipPath> </defs> <circle transform="rotate(-90 40 40)" class="ee-arrow__circle--loader" stroke-dasharray="227" stroke-dashoffset="227" cx="40" cy="40" r="40" fill="transparent" stroke="transparent" stroke-width="4" vector-effect="non-scaling-stroke" clip-path="url(#clipLoader<?php echo $this->get_id(); ?>)" /> </svg> </li> </ul><?php } /** * Render Loader * * @since 1.9.0 * @return void */ public function render_loader() { $this->add_render_attribute( [ 'loader' => [ 'class' => [ 'ee-switcher__loader', 'ee-progress-loader', ], ], 'loader-inner' => [ 'class' => 'ee-progress-loader__inner', ], ] ); ?><div <?php echo $this->get_render_attribute_string( 'loader' ); ?>> <span <?php echo $this->get_render_attribute_string( 'loader-inner' ); ?>></span> </div><?php } /** * Content Template * * Javascript content template for quick rendering * * @since 1.9.0 * @return void */ public function content_template() { ?><# view.addRenderAttribute( { 'switcher' : { 'class' : [ 'ee-switcher', 'ee-switcher--stack-' + settings.layout_stack, ], }, 'switcher-wrapper' : { 'class' : 'ee-switcher__wrapper', }, 'switcher-media-wrapper' : { 'class' : [ 'ee-switcher__media-wrapper', 'ee-media--stretch', ], }, 'switcher-content-wrapper' : { 'class' : 'ee-switcher__content-wrapper', }, 'switcher-content' : { 'class' : 'ee-switcher__content', }, } ); #><div {{{ view.getRenderAttributeString( 'switcher' ) }}}> <div {{{ view.getRenderAttributeString( 'switcher-wrapper' ) }}}> <div {{{ view.getRenderAttributeString( 'switcher-media-wrapper' ) }}}> <?php $this->_media_loop_template(); ?> </div> <div {{{ view.getRenderAttributeString( 'switcher-content-wrapper' ) }}}> <div {{{ view.getRenderAttributeString( 'switcher-content' ) }}}> <?php $this->_titles_loop_template(); $this->_descriptions_loop_template(); $this->_nav_loop_template(); $this->render_arrows(); ?> </div> </div> </div> </div> <?php } /** * Titles Loop Template * * @since 1.9.0 * @return void */ public function _titles_loop_template() { ?><# view.addRenderAttribute( 'items', 'class', 'ee-switcher__titles' ); #><div {{{ view.getRenderAttributeString( 'items' ) }}}> <# _.each( settings.items, function( item, index ) { var titleTag = 'div', headingTag = settings.title_heading_tag, itemKey = view.getRepeaterSettingKey( 'item', 'items', index ), itemTitleKey = view.getRepeaterSettingKey( 'itemTitle', 'items', index ); view.addRenderAttribute( itemKey, 'class', 'ee-switcher__titles__title' ); view.addRenderAttribute( itemTitleKey, 'class', 'ee-switcher__title' ); if ( 'yes' === settings.link_title ) { if ( 'file' == settings.link_to ) { titleTag = 'a'; view.addRenderAttribute( itemKey, 'href', item.image.url ); view.addRenderAttribute( itemKey, 'class', 'elementor-clickable' ); view.addRenderAttribute( itemKey, 'data-elementor-open-lightbox', settings.link_open_lightbox ); view.addRenderAttribute( itemKey, 'data-elementor-lightbox-slideshow', view.$el.data('id') ); } else if ( 'attachment' === settings.link_to ) { titleTag = 'a'; view.addRenderAttribute( itemKey, 'href', '' ); } else if ( 'custom' === settings.link_to && '' !== item.link.url ) { titleTag = 'a'; view.addRenderAttribute( itemKey, 'href', item.link.url ); } } #> <{{{ titleTag }}} {{{ view.getRenderAttributeString( itemKey ) }}}> <{{{ headingTag }}} {{{ view.getRenderAttributeString( itemTitleKey ) }}}>{{ item.title }}</{{{ headingTag }}}> </{{{ titleTag }}}> <# }); #> </div> <?php } /** * Descriptions Loop Template * * @since 1.9.0 * @return void */ public function _descriptions_loop_template() { ?><# if ( 'yes' === settings.description ) { view.addRenderAttribute( 'descriptions', 'class', 'ee-switcher__descriptions' ); #><div {{{ view.getRenderAttributeString( 'descriptions' ) }}}> <# _.each( settings.items, function( item, index ) { var descriptionTag = 'div', descriptionKey = view.getRepeaterSettingKey( 'description', 'items', index ); view.addRenderAttribute( descriptionKey, 'class', 'ee-switcher__descriptions__description' ); if ( 'yes' === settings.link_description ) { descriptionTag = 'a'; if ( 'file' == settings.link_to && '' !== item.image.url ) { view.addRenderAttribute( descriptionKey, 'href', item.image.url ); view.addRenderAttribute( descriptionKey, 'class', 'elementor-clickable' ); view.addRenderAttribute( descriptionKey, 'data-elementor-open-lightbox', settings.link_open_lightbox ); view.addRenderAttribute( descriptionKey, 'data-elementor-lightbox-slideshow', view.$el.data('id') ); } else if ( 'attachment' === settings.link_to ) { view.addRenderAttribute( descriptionKey, 'href', '' ); } else if ( 'custom' === settings.link_to && '' !== item.link.url ) { view.addRenderAttribute( descriptionKey, 'href', item.link.url ); } } #> <{{{ descriptionTag }}} {{{ view.getRenderAttributeString( descriptionKey ) }}}> {{{ item.description }}} </{{{ descriptionTag }}}> <# }); #> </div><# } #> <?php } /** * Media Loop Template * * @since 1.9.0 * @return void */ public function _media_loop_template() { ?><# view.addRenderAttribute( { 'media' : { 'class' : [ 'ee-switcher__media', 'ee-media', 'ee-effect--' + settings.effect_media, ], }, 'media-items' : { 'class' : [ 'ee-switcher__media__items', ], }, 'media-overlay' : { 'class' : [ 'ee-switcher__media__overlay', 'ee-media__overlay', ], }, } ); #> <div {{{ view.getRenderAttributeString( 'media' ) }}}> <div {{{ view.getRenderAttributeString( 'media-items' ) }}}> <# _.each( settings.items, function( item, index ) { var image = { id: item.image.id, url: item.image.url, size: settings.image_size, dimension: settings.image_custom_dimension, model: view.getEditModel() }, mediaTag = 'div', imageURL = elementor.imagesManager.getImageUrl( image ), mediaItemKey = view.getRepeaterSettingKey( 'media-item', 'items', index ), imageKey = view.getRepeaterSettingKey( 'image', 'items', index ); view.addRenderAttribute( mediaItemKey, 'class', [ 'ee-switcher__media__item', 'ee-media__thumbnail', ]); if ( 'yes' === settings.link_image ) { if ( 'file' == settings.link_to ) { mediaTag = 'a'; view.addRenderAttribute( mediaItemKey, 'href', item.image.url ); view.addRenderAttribute( mediaItemKey, 'class', 'elementor-clickable' ); view.addRenderAttribute( mediaItemKey, 'data-elementor-open-lightbox', settings.link_open_lightbox ); view.addRenderAttribute( mediaItemKey, 'data-elementor-lightbox-slideshow', view.$el.data('id') ); } else if ( 'attachment' === settings.link_to ) { mediaTag = 'a'; view.addRenderAttribute( mediaItemKey, 'href', '' ); } else if ( 'custom' === settings.link_to && '' !== item.link.url ) { mediaTag = 'a'; view.addRenderAttribute( mediaItemKey, 'href', item.link.url ); } } view.addRenderAttribute( imageKey, 'src', imageURL ); #> <{{{ mediaTag }}} {{{ view.getRenderAttributeString( mediaItemKey ) }}}> <# if ( imageURL ) { #> <img {{{ view.getRenderAttributeString( imageKey ) }}}> <# } #> </{{{ mediaTag }}}> <# }); #> </div> <div {{{ view.getRenderAttributeString( 'media-overlay' ) }}}></div> </div> <?php } /** * Navigation Loop Template * * @since 1.9.0 * @return void */ public function _nav_loop_template() { ?><# view.addRenderAttribute( { 'nav' : { 'class' : [ 'ee-switcher__nav', 'ee-nav', ], }, 'loader' : { 'class' : 'ee-loader', }, 'loader-progress' : { 'class' : 'ee-loader__progress', }, } ); if ( 'row' === settings.menu_direction ) { view.addRenderAttribute( 'nav', 'class', 'ee-nav--stacked' ); } else { view.addRenderAttribute( 'nav', 'class', 'ee-nav--inline' ); } #><ul {{{ view.getRenderAttributeString( 'nav' ) }}}> <# _.each( settings.items, function( item, index ) { var has_icon = false, navItemKey = view.getRepeaterSettingKey( 'nav-item', 'items', index ), navItemLabelKey = view.getRepeaterSettingKey( 'nav-item-label', 'items', index ), navItemIconKey = view.getRepeaterSettingKey( 'nav-item-icon', 'items', index ); navIconWrapperKey = view.getRepeaterSettingKey( 'nav-icon-wrapper', 'items', index ); var iconHTML = elementor.helpers.renderIcon( view, item.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ), migrated = elementor.helpers.isIconMigrated( item, 'selected_icon' ); if ( item.icon || item.selected_icon ) { view.addRenderAttribute( navIconWrapperKey, { 'class' : [ 'ee-icon', 'ee-icon-support--svg', 'ee-icon-support--svg-large', 'ee-switcher__nav__icon', 'ee-icon--' + item.icon_align, ], } ); if ( item.icon ) { view.addRenderAttribute( navItemIconKey, { 'class' : item.icon, 'aria-hidden' : 'true', } ); } view.addRenderAttribute( navItemKey, 'class', 'has--icon' ); has_icon = true; } if ( 'yes' === settings.background_switcher ) { view.addRenderAttribute( navItemKey, 'data-switcher-background', item.background_switcher_color ); } // view.addInlineEditingAttributes( navItemLabelKey, 'none' ); view.addRenderAttribute( navItemKey, 'class', [ 'ee-switcher__nav__item', 'ee-nav__item', 'elementor-repeater-item-' + item._id ]); #><li {{{ view.getRenderAttributeString( navItemKey ) }}}><# if ( has_icon ) { #><span {{{ view.getRenderAttributeString( navIconWrapperKey ) }}}><# if ( ( migrated || ! item.icon ) && iconHTML.rendered ) { #> {{{ iconHTML.value }}} <# } else { #> <span {{{ view.getRenderAttributeString( navItemIconKey ) }}}></span> <# } #></span><# } if ( '' !== item.label ) { #> <span {{{ view.getRenderAttributeString( navItemLabelKey ) }}}>{{{ item.label }}}</span> <# } #> <span {{{ view.getRenderAttributeString( 'loader' ) }}}> <span {{{ view.getRenderAttributeString( 'loader-progress' ) }}}></span> </span> </li> <# }); #> </ul> <?php } /** * Get Item Image URL * * @since 1.9.0 * @return void */ protected function get_item_image_url( $item ) { if ( empty( $item['image']['id'] ) ) { $item['image']['url'] = Utils::get_placeholder_image_src(); } $image_url = Group_Control_Image_Size::get_attachment_image_src( $item['image']['id'], 'image', $this->get_settings() ); if ( ! $image_url ) { $image_url = $item['image']['url']; } return $image_url; } /** * Set Item Link Attributes * * @since 2.2.18 * @return void */ protected function get_item_link( $item ) { switch ( $this->get_settings('link_to') ) { case 'file' : return $this->get_item_image_url( $item ); break; case 'attachment' : return get_attachment_link( $item['image']['id'] ); break; case 'custom' : return $item['link']['url']; break; default : return false; } return false; } /** * Set Item Link Attributes * * @since 1.9.0 * @return void */ protected function set_item_link_attributes( $item, $key, $slideshow_key = false ) { $link_to = $this->get_settings('link_to'); if ( 'file' == $link_to ) { $slideshow_key = $slideshow_key ? implode( '-', [ $this->get_id(), $slideshow_key ] ) : false; $has_slideshow = $this->get_settings('lightbox_slideshow') && $slideshow_key ? $slideshow_key : false; $this->add_lightbox_data_attributes( $key, $item['image']['id'], $this->get_settings('link_open_lightbox'), $has_slideshow ); if ( $this->_is_edit_mode ) { $this->add_render_attribute( $key, 'class', 'elementor-clickable' ); } } else if ( 'custom' === $link_to ) { if ( ! empty( $item['link']['url'] ) ) { if ( $item['link']['is_external'] ) { $this->add_render_attribute( $key, 'target', '_blank' ); } if ( ! empty( $item['link']['nofollow'] ) ) { $this->add_render_attribute( $key, 'rel', 'nofollow' ); } } } $this->add_render_attribute( $key, 'href', $this->get_item_link( $item ) ); } } switcher/module.php 0000644 00000001134 15112147616 0010375 0 ustar 00 <?php namespace ElementorExtras\Modules\Switcher; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Switcher\Module * * @since 1.9.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.9.0 * @return string */ public function get_name() { return 'switcher'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.9.0 * @return array */ public function get_widgets() { return [ 'Switcher', ]; } } table/widgets/table.php 0000644 00000124711 15112147616 0011113 0 ustar 00 <?php namespace ElementorExtras\Modules\Table\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Repeater; use Elementor\Icons_Manager; use Elementor\Controls_Manager; use Elementor\Utils; use Elementor\Group_Control_Border; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Image_Size; use Elementor\Group_Control_Box_Shadow; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Table * * @since 1.5.0 */ class Table extends Extras_Widget { /** * Cell counter * * @since 1.5.0 * @var int */ private $cell_counter = 0; /** * Get Name * * Get the name of the widget * * @since 1.5.0 * @return string */ public function get_name() { return 'table'; } /** * Get Title * * Get the title of the widget * * @since 1.5.0 * @return string */ public function get_title() { return __( 'Table', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 1.5.0 * @return string */ public function get_icon() { return 'nicon nicon-table'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 1.5.0 * @return array */ public function get_script_depends() { return [ 'tablesorter' ]; } /** * Register Cell Controls * * @since 1.5.0 * @return void */ protected function _register_cell_controls( $repeater, $condition = array() ) { $repeater->add_control( 'cell_content', [ 'label' => __( 'Cell Content', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'text', 'options' => [ 'text' => __( 'Text', 'elementor-extras' ), ], 'condition' => array_merge( $condition, [] ), ] ); $repeater->add_control( 'cell_text', [ 'label' => __( 'Cell Text', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'condition' => array_merge( $condition, [ 'cell_content' => 'text', ] ), ] ); $repeater->add_control( 'selected_cell_icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'cell_icon', 'condition' => array_merge( $condition, [ 'cell_content' => 'text', ] ), ] ); $repeater->add_control( 'cell_icon_align', [ 'label' => __( 'Icon Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'left', 'options' => [ 'left' => __( 'Before', 'elementor-extras' ), 'right' => __( 'After', 'elementor-extras' ), ], 'condition' => array_merge( $condition, [ 'cell_content' => 'text', 'selected_cell_icon[value]!' => '', ] ), ] ); $repeater->add_control( 'cell_icon_indent', [ 'label' => __( 'Icon Spacing', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'dynamic' => [ 'active' => true ], 'min' => 0, 'max' => 48, 'default' => '', 'step' => 1, 'condition' => array_merge( $condition, [ 'cell_content' => 'text', 'selected_cell_icon[value]!' => '', ] ), 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-table__text .ee-icon--right' => 'margin-left: {{SIZE}}px;', '{{WRAPPER}} {{CURRENT_ITEM}} .ee-table__text .ee-icon--left' => 'margin-right: {{SIZE}}px;', ], ] ); $repeater->add_control( 'cell_span', [ 'label' => __( 'Column Span', 'elementor-extras' ), 'title' => __( 'How many columns should this column span across.', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'dynamic' => [ 'active' => true ], 'default' => 1, 'min' => 1, 'max' => 20, 'step' => 1, 'condition' => array_merge( $condition, [] ), ] ); $repeater->add_control( 'cell_row_span', [ 'label' => __( 'Row Span', 'elementor-extras' ), 'title' => __( 'How many rows should this column span across.', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'dynamic' => [ 'active' => true ], 'default' => 1, 'min' => 1, 'max' => 20, 'step' => 1, 'condition' => array_merge( $condition, [] ), 'separator' => 'below', ] ); $repeater->add_control( '_item_id', [ 'label' => __( 'CSS ID', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '', 'label_block' => false, 'title' => __( 'Add your custom id WITHOUT the Pound key. e.g: my-id', 'elementor-extras' ), ] ); $repeater->add_control( 'css_classes', [ 'label' => __( 'CSS Classes', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => '', 'prefix_class' => '', 'label_block' => false, 'title' => __( 'Add your custom class WITHOUT the dot. e.g: my-class', 'elementor-extras' ), ] ); } /** * Register Widget Controls * * @since 1.5.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_header', [ 'label' => __( 'Header', 'elementor-extras' ), ] ); $this->add_control( 'sortable', [ 'label' => __( 'Sortable', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'description' => __( 'Enables sorting rows by clicking on header cells.', 'elementor-extras' ), 'frontend_available' => true, ] ); $this->add_control( 'responsive', [ 'label' => __( 'Responsive', 'elementor-extras' ), 'description' => __( 'Converts the header row into individual headers for each cell on mobile.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'responsive', 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'responsive', 'prefix_class' => 'ee-table--' ] ); $this->add_control( 'mobile_headers_hide', [ 'label' => __( 'Hide on Mobile', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'hide', 'description' => __( 'Hide headers completely on mobile.', 'elementor-extras' ), 'frontend_available' => true, 'prefix_class' => 'ee-table-mobile-header--', 'condition' => [ 'responsive' => 'responsive', ], ] ); $this->add_control( 'mobile_headers_auto', [ 'label' => __( 'Auto Mobile Headers', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'elementor-extras' ), 'label_off' => __( 'No', 'elementor-extras' ), 'return_value' => 'yes', 'default' => 'yes', 'description' => __( 'Try to automatically fetch corresponding headers content on mobile. Works only when column span values are not used.', 'elementor-extras' ), 'frontend_available' => true, 'condition' => [ 'responsive' => 'responsive', 'mobile_headers_hide!' => 'hide', ], ] ); $this->add_control( 'mobile_headers_display', [ 'label' => __( 'Mobile Display', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'row', 'options' => [ 'row' => [ 'title' => __( 'Column', 'elementor-extras' ), 'icon' => 'nicon nicon-inline', ], 'column' => [ 'title' => __( 'Row', 'elementor-extras' ), 'icon' => 'nicon nicon-block', ], ], 'condition' => [ 'responsive' => 'responsive', 'mobile_headers_hide!' => 'hide', ], 'label_block' => false, 'prefix_class' => 'ee-table-mobile-header--' ] ); $repeater_header = new Repeater(); $this->_register_cell_controls( $repeater_header, [] ); $this->add_control( 'header_cells', [ 'label' => __( 'Columns', 'elementor-extras' ), 'type' => Controls_Manager::REPEATER, 'default' => [ [ 'cell_text' => __( 'First header', 'elementor-extras' ), ], [ 'cell_text' => __( 'Second header', 'elementor-extras' ), ], [ 'cell_text' => __( 'Third header', 'elementor-extras' ), ], ], 'prevent_empty' => true, 'fields' => $repeater_header->get_controls(), 'title_field' => '{{{ cell_text }}}', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_content', [ 'label' => __( 'Body', 'elementor-extras' ), ] ); $repeater_elements = new Repeater(); $repeater_elements->add_control( 'type', [ 'label' => __( 'Start new', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'cell', 'options' => [ 'row' => __( 'Row', 'elementor-extras' ), 'cell' => __( 'Cell', 'elementor-extras' ), ], ] ); $repeater_elements->add_control( 'cell_type', [ 'label' => __( 'Cell Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'td', 'options' => [ 'td' => __( 'Default', 'elementor-extras' ), 'th' => __( 'Header', 'elementor-extras' ), ], 'condition' => [ 'type' => 'cell', ] ] ); $repeater_elements->add_control( 'cell_header', [ 'label' => __( 'Mobile Header', 'elementor-extras' ), 'description' => __( 'Overrides value set by Auto Mobile Header option.', 'elementor-extras' ), 'title' => __( 'Specify the header text for this cell to appear on mobile', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'condition' => [ 'type' => 'cell', ] ] ); $this->_register_cell_controls( $repeater_elements, [ 'type' => 'cell' ] ); $repeater_elements->add_control( 'link', [ 'label' => __( 'Link', 'elementor-extras' ), 'type' => Controls_Manager::URL, 'dynamic' => [ 'active' => true ], 'label_block' => false, 'placeholder' => esc_url( home_url( '/' ) ), 'condition' => [ 'type' => 'cell', ] ] ); $this->add_control( 'rows', [ 'label' => __( 'Rows', 'elementor-extras' ), 'type' => Controls_Manager::REPEATER, 'default' => [ [ 'type' => 'row', ], [ 'type' => 'cell', 'cell_text' => __( 'First column', 'elementor-extras' ), 'cell_type' => 'td', ], [ 'type' => 'cell', 'cell_text' => __( 'Second column', 'elementor-extras' ), 'cell_type' => 'td', ], [ 'type' => 'cell', 'cell_text' => __( 'Third column', 'elementor-extras' ), 'cell_type' => 'td', ], [ 'type' => 'row', ], [ 'type' => 'cell', 'cell_text' => __( 'First column', 'elementor-extras' ), ], [ 'type' => 'cell', 'cell_text' => __( 'Second column', 'elementor-extras' ), ], [ 'type' => 'cell', 'cell_text' => __( 'Third column', 'elementor-extras' ), ], ], 'fields' => $repeater_elements->get_controls(), 'title_field' => 'Start {{ type }}: {{{ cell_text }}}', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_table_style', [ 'label' => __( 'Table', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'size', [ 'label' => __( 'Maximum Size', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 100, 'unit' => '%', ], 'size_units' => [ '%', 'px' ], 'range' => [ '%' => [ 'min' => 1, 'max' => 100, ], 'px' => [ 'min' => 1, 'max' => 1200, ], ], 'selectors' => [ '{{WRAPPER}} .elementor-widget-container' => 'max-width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => 'center', 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'selectors' => [ '{{WRAPPER}}' => 'justify-content: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'table', 'selector' => '{{WRAPPER}} .ee-table__row, {{WRAPPER}} .ee-table__cell', ] ); $this->update_control( 'table_transition', array( 'default' => 'custom', )); $this->end_controls_section(); $this->start_controls_section( 'section_rows_style', [ 'label' => __( 'Rows', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'row_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-table__row', ] ); $this->add_control( 'row_alternate', [ 'label' => __( 'Alternate', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'even', 'options' => [ 'even' => __( 'Even', 'elementor-extras' ), 'odd' => __( 'Odd', 'elementor-extras' ), ], ] ); $this->start_controls_tabs( 'tabs_row_style' ); $this->start_controls_tab( 'tab_row_default_style', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'row_style_heading', [ 'label' => __( 'Default', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_responsive_control( 'row_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_TEXT, ], 'selectors' => [ '{{WRAPPER}} .ee-table__row .ee-table__text' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'row_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-table__row' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'row_style_hover_heading', [ 'label' => __( 'Hover', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'row_hover_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '(desktop+){{WRAPPER}} .ee-table__row:hover .ee-table__text' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'row_hover_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '(desktop+){{WRAPPER}} .ee-table__row:hover' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_row_alternate_style', [ 'label' => __( 'Alternate', 'elementor-extras' ) ] ); $this->add_control( 'row_style_alternate_heading', [ 'label' => __( 'Default', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_responsive_control( 'row_alternate_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-table--odd .ee-table__row:nth-child(odd) .ee-table__text, {{WRAPPER}} .ee-table--even .ee-table__row:nth-child(even) .ee-table__text' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'row_alternate_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-table--odd .ee-table__row:nth-child(odd), {{WRAPPER}} .ee-table--even .ee-table__row:nth-child(even)' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'row_style_alternate_hover_heading', [ 'label' => __( 'Hover', 'elementor-extras' ), 'type' => Controls_Manager::HEADING, ] ); $this->add_control( 'row_alternate_hover_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '(desktop+){{WRAPPER}} .ee-table--odd .ee-table__row:nth-child(odd):hover .ee-table__text, {{WRAPPER}} .ee-table--even .ee-table__row:nth-child(even):hover .ee-table__text' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'row_alternate_hover_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '(desktop+){{WRAPPER}} .ee-table--odd .ee-table__row:nth-child(odd):hover, {{WRAPPER}} .ee-table--even .ee-table__row:nth-child(even):hover' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_cells_style', [ 'label' => __( 'Cells', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'cell_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} td.ee-table__cell', ] ); $this->start_controls_tabs( 'tabs_cell_colors' ); $this->start_controls_tab( 'tab_cell_colors', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_responsive_control( 'cell_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_TEXT, ], 'selectors' => [ '{{WRAPPER}} .ee-table__cell .ee-table__text' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'cell_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-table__cell' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_cell_hover_colors', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'cell_hover_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '(desktop+){{WRAPPER}} .ee-table__cell:hover .ee-table__text' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'cell_hover_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '(desktop+){{WRAPPER}} .ee-table__cell:hover' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->start_controls_tabs( 'tabs_cell_style' ); $this->start_controls_tab( 'tab_cell_default_style', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_responsive_control( 'cell_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-table__text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'cell_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-table__text' => 'justify-content: {{VALUE}};', ] ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'cell_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-table__cell', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_cell_first_style', [ 'label' => __( 'First', 'elementor-extras' ) ] ); $this->add_responsive_control( 'cell_first_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-table__cell:first-child .ee-table__text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'cell_first_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-table__cell:first-child .ee-table__text' => 'justify-content: {{VALUE}};', ] ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'cell_first_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '(tablet+){{WRAPPER}} .ee-table__cell:first-child', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_cell_last_style', [ 'label' => __( 'Last', 'elementor-extras' ) ] ); $this->add_responsive_control( 'cell_last_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-table__cell:last-child .ee-table__text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'cell_last_align', [ 'label' => __( 'Align Text', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'flex-start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'flex-end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-table__cell:last-child .ee-table__text' => 'justify-content: {{VALUE}};', ] ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'cell_last_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '(tablet+){{WRAPPER}} .ee-table__cell:last-child', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_header_style', [ 'label' => __( 'Headers', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'mobile_headers_size', [ 'label' => __( 'Mobile Width (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 50, ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 90, 'step'=> 10, ], ], 'condition' => [ 'mobile_headers_hide!' => 'hide', ], 'selectors' => [ '{{WRAPPER}} .ee-table__cell[data-title]:before' => 'flex-basis: {{SIZE}}%;', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'header_typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_ACCENT, ], 'selector' => '{{WRAPPER}} th.ee-table__cell', ] ); $this->start_controls_tabs( 'tabs_header_colors' ); $this->start_controls_tab( 'tab_header_colors', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_responsive_control( 'header_cell_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '#FFFFFF', 'selectors' => [ '{{WRAPPER}} th.ee-table__cell .ee-table__text' => 'color: {{VALUE}};', '{{WRAPPER}} .ee-table__cell[data-title]:before' => 'color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'header_cell_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} th.ee-table__cell' => 'background-color: {{VALUE}};', '{{WRAPPER}} .ee-table__cell[data-title]:before' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_header_hover_colors', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'header_cell_hover_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '(tablet+){{WRAPPER}} th.ee-table__cell:hover .ee-table__text' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'header_cell_hover_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '(tablet+){{WRAPPER}} th.ee-table__cell:hover' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->start_controls_tabs( 'tabs_header_style' ); $this->start_controls_tab( 'tab_header_default_style', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_responsive_control( 'header_cell_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} th.ee-table__cell .ee-table__text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} .ee-table__cell[data-title]:before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'header_cell_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} th.ee-table__cell, {{WRAPPER}} .ee-table__cell[data-title]:before', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_header_first_style', [ 'label' => __( 'First', 'elementor-extras' ) ] ); $this->add_responsive_control( 'header_cell_first_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} th.ee-table__cell:first-child .ee-table__text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} .ee-table__cell:first-child[data-title]:before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'header_cell_first_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '(tablet+){{WRAPPER}} th.ee-table__cell:first-child, {{WRAPPER}} .ee-table__cell:first-child[data-title]:before', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_header_last_style', [ 'label' => __( 'Last', 'elementor-extras' ) ] ); $this->add_responsive_control( 'header_cell_last_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} th.ee-table__cell:last-child .ee-table__text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} .ee-table__cell:last-child[data-title]:before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'header_cell_last_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '(tablet+){{WRAPPER}} th.ee-table__cell:last-child, {{WRAPPER}} .ee-table__cell:last-child[data-title]:before', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_columns_style', [ 'label' => __( 'Columns', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $repeater_columns = new Repeater(); $repeater_columns->add_control( 'span', [ 'label' => __( 'Span', 'elementor-extras' ), 'title' => __( 'Rule applies to this number of columns starting after the previous rule.', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'step' => 1, 'label_block' => false, ] ); $repeater_columns->add_control( 'column_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '(tablet+){{WRAPPER}} {{CURRENT_ITEM}}' => 'background-color: {{VALUE}};', ], ] ); $repeater_columns->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'column_border', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '(tablet+){{WRAPPER}} {{CURRENT_ITEM}}', ] ); $repeater_columns->add_control( 'column_size', [ 'label' => __( 'Width', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ '%', 'px' ], 'range' => [ '%' => [ 'min' => 1, 'max' => 100, ], 'px' => [ 'min' => 1, 'max' => 1200, ], ], 'selectors' => [ '(tablet+){{WRAPPER}} {{CURRENT_ITEM}}' => 'width: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'rules', [ 'label' => __( 'Column Rules', 'elementor-extras' ), 'type' => Controls_Manager::REPEATER, 'fields' => $repeater_columns->get_controls(), 'prevent_empty' => true, 'title_field' => 'Column', 'default' => [ [ 'span' => 1 ] ] ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 1.5.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); if ( empty( $settings['rows'] ) ) return; $this->add_render_attribute( [ 'table' => [ 'class' => [ 'ee-table', 'ee-table--' . $settings['row_alternate'], ], ], 'body-row' => [ 'class' => 'ee-table__row', ], ] ); if ( $settings['sortable'] ) { $this->add_render_attribute( 'table', 'class', 'ee-table--sortable' ); } if ( $settings['rules'] ) { $this->add_render_attribute( 'table', 'class', 'ee-table--rules' ); } ?> <table <?php echo $this->get_render_attribute_string( 'table' ); ?>> <?php $this->render_rules(); $this->render_header(); ?><tbody><?php if ( $this->is_invalid_first_row() ) { ?><tr <?php echo $this->get_render_attribute_string( 'body-row' ); ?>><?php } foreach ( $settings['rows'] as $index => $row ) { call_user_func( [ $this, 'render_' . $row['type'] ], $row, $index ); } ?></tr> </tbody> </table> <?php } /** * Checks if the first row of the table is invalid * Uses the settings to determine if the structure is valid html * * @since 1.5.0 * @return bool */ protected function is_invalid_first_row() { $settings = $this->get_settings_for_display(); if ( 'row' === $settings['rows'][0]['type'] ) return false; return true; } /** * Render colgroup rules * * @since 1.5.0 * @return void */ protected function render_rules() { $settings = $this->get_settings_for_display(); if ( $settings['rules'] ) { ?> <colgroup> <?php foreach( $settings['rules'] as $rule ) { ?> <col span="<?php echo $rule['span']; ?>" class="elementor-repeater-item-<?php echo $rule['_id']; ?>"> <?php } ?> </colgroup> <?php } } /** * Register Table Header * * @since 1.5.0 * @return void */ protected function render_header() { $settings = $this->get_settings_for_display(); if ( empty( $settings['header_cells'] ) ) { return; } $this->add_render_attribute( [ 'header-row' => [ 'class' => 'ee-table__row', ], 'sort' => [ 'class' => [ 'nicon', 'nicon-sort-up-down', ], ], 'sort-up' => [ 'class' => [ 'nicon', 'nicon-sort-up', ], ], 'sort-down' => [ 'class' => [ 'nicon', 'nicon-sort-down', ], ], ] ); ?><thead> <tr <?php echo $this->get_render_attribute_string( 'header-row' ); ?>> <?php foreach ( $settings['header_cells'] as $index => $item ) { $header_cell_key = $this->get_repeater_setting_key( 'cell', 'header_cells', $index ); $header_cell_text_key = $this->get_repeater_setting_key( 'cell-text', 'header_cells', $index ); $header_cell_inner_text_key = $this->get_repeater_setting_key( 'cell-text-inner', 'header_cells', $index ); $this->add_render_attribute( [ $header_cell_key => [ 'class' => [ 'ee-table__cell', 'elementor-repeater-item-' . $item['_id'] ], ], $header_cell_text_key => [ 'class' => 'ee-table__text', ], $header_cell_inner_text_key => [ 'class' => 'ee-table__text__inner', ], ] ); if ( $item['_item_id'] ) $this->add_render_attribute( $header_cell_key, 'id', $item['_item_id'] ); if ( $item['css_classes'] ) $this->add_render_attribute( $header_cell_key, 'class', $item['css_classes'] ); if ( $item['cell_span'] > 1 ) $this->add_render_attribute( $header_cell_key, 'colspan', $item['cell_span'] ); if ( $item['cell_row_span'] > 1 ) $this->add_render_attribute( $header_cell_key, 'rowspan', $item['cell_row_span'] ); $this->add_inline_editing_attributes( $header_cell_inner_text_key, 'basic' ); // Output header contents ?><th <?php echo $this->get_render_attribute_string( $header_cell_key ); ?>> <span <?php echo $this->get_render_attribute_string( $header_cell_text_key ); ?>><?php $this->render_cell_icon( $index, $item, 'header-cell' ); ?><span <?php echo $this->get_render_attribute_string( $header_cell_inner_text_key ); ?>><?php echo $item['cell_text']; ?></span> <?php if ( 'yes' === $settings['sortable'] ) { ?> <span <?php echo $this->get_render_attribute_string( 'sort' ); ?>></span> <span <?php echo $this->get_render_attribute_string( 'sort-up' ); ?>></span> <span <?php echo $this->get_render_attribute_string( 'sort-down' ); ?>></span> <?php } ?> </span> </th> <?php } // foreach ?> </tr> </thead><?php } /** * Render Cell * * Render markup for table cells * * @since 1.5.0 * @param row|array The row item in the repeater control * @param index|int The index of the repeater item * @return void */ protected function render_cell( $row, $index ) { $settings = $this->get_settings_for_display(); $text_tag = 'span'; $header_text = $row['cell_header']; $cell_key = $this->get_repeater_setting_key( 'cell', 'rows', $index ); $cell_text_key = $this->get_repeater_setting_key( 'cell-text', 'rows', $index ); $cell_text_inner_key = $this->get_repeater_setting_key( 'cell-text-inner', 'rows', $index ); if ( ! empty( $row['link']['url'] ) ) { $text_tag = 'a'; $this->add_render_attribute( $cell_text_key, 'href', $row['link']['url'] ); if ( $row['link']['is_external'] ) { $this->add_render_attribute( $cell_text_key, 'target', '_blank' ); } if ( ! empty( $row['link']['nofollow'] ) ) { $this->add_render_attribute( $cell_text_key, 'rel', 'nofollow' ); } } if ( 'hide' !== $settings['mobile_headers_hide'] ) { if ( 'yes' === $settings['mobile_headers_auto'] ) { // Fetch corresponding header cell text if ( isset( $settings['header_cells'][ $this->cell_counter ] ) && '' === $row['cell_header'] ) { $header_text = $settings['header_cells'][ $this->cell_counter ]['cell_text']; } // Increment to next cell $this->cell_counter ++; } } $this->add_render_attribute( [ $cell_key => [ 'class' => [ 'ee-table__cell', 'elementor-repeater-item-' . $row['_id'], ], ], $cell_text_key => [ 'class' => [ 'ee-table__text', ], ], $cell_text_inner_key => [ 'class' => 'ee-table__text__inner', ], ] ); if ( $row['_item_id'] ) $this->add_render_attribute( $cell_key, 'id', $row['_item_id'] ); if ( $row['css_classes'] ) $this->add_render_attribute( $cell_key, 'class', $row['css_classes'] ); if ( $header_text ) $this->add_render_attribute( $cell_key, 'data-title', $header_text ); if ( $row['cell_span'] > 1 ) $this->add_render_attribute( $cell_key, 'colspan', $row['cell_span'] ); if ( $row['cell_row_span'] > 1 ) $this->add_render_attribute( $cell_key, 'rowspan', $row['cell_row_span'] ); $this->add_inline_editing_attributes( $cell_text_inner_key, 'basic' ); // Output cell contents ?><<?php echo $row['cell_type']; ?> <?php echo $this->get_render_attribute_string( $cell_key ); ?>> <<?php echo $text_tag; ?> <?php echo $this->get_render_attribute_string( $cell_text_key ); ?>><?php $this->render_cell_icon( $index, $row, 'body-cell' ); ?><span <?php echo $this->get_render_attribute_string( $cell_text_inner_key ); ?>><?php echo $row['cell_text']; ?></span> </<?php echo $text_tag; ?>> </<?php echo $row['cell_type']; ?>><?php } /** * Render Cell * * Renders the row markup for a repeater item * * @since 1.5.0 * @param row|array The row item in the repeater control * @param index|int The index of the repeater item * @return void */ protected function render_row( $row, $index ) { $settings = $this->get_settings_for_display(); $row_count = count( $settings['rows'] ); $row_key = $this->get_repeater_setting_key( 'body-row', 'rows', $index ); $counter = $index + 1; $this->add_render_attribute( [ $row_key => [ 'class' => [ 'ee-table__row', 'elementor-repeater-item-' . $row['_id'], ], ], ] ); if ( $row['_item_id'] ) $this->add_render_attribute( $row_key, 'id', $row['_item_id'] ); if ( $row['css_classes'] ) $this->add_render_attribute( $row_key, 'class', $row['css_classes'] ); if ( $counter > 1 && $counter < $row_count ) { // Break into new row ?></tr><tr <?php echo $this->get_render_attribute_string( $row_key ); ?>> <?php } else if ( 1 === $counter && false === $this->is_invalid_first_row() ) { ?><tr <?php echo $this->get_render_attribute_string( $row_key ); ?>> <?php } $this->cell_counter = 0; } /** * Render Cell Icon * * @since 2.1.5 * * @param int $index * @param array $item * @param string $type * @return void */ protected function render_cell_icon( $index, $item, $type = 'cell' ) { if ( 'text' === $item['cell_content'] && ( ! empty( $item['cell_icon'] ) || ! empty( $item['selected_cell_icon']['value'] ) ) ) { $icon_wrapper_key = $this->get_repeater_setting_key( 'icon-wrapper', $type, $index ); $icon_key = $this->get_repeater_setting_key( 'icon', $type, $index ); $migrated = isset( $item['__fa4_migrated']['selected_cell_icon'] ); $is_new = empty( $item['cell_icon'] ) && Icons_Manager::is_migration_allowed(); $this->add_render_attribute( [ $icon_wrapper_key => [ 'class' => [ 'ee-icon', 'ee-icon-support--svg', 'ee-icon--' . $item['cell_icon_align'], ], ], ] ); if ( ! empty( $item['cell_icon'] ) ) { $this->add_render_attribute( [ $icon_key => [ 'class' => esc_attr( $item['cell_icon'] ), 'aria-hidden' => 'true', ], ] ); } ?><span <?php echo $this->get_render_attribute_string( $icon_wrapper_key ); ?>><?php if ( $is_new || $migrated ) { Icons_Manager::render_icon( $item['selected_cell_icon'], [ 'aria-hidden' => 'true' ] ); } else { ?><i <?php echo $this->get_render_attribute_string( $icon_key ); ?>></i><?php } ?></span><?php } } } table/module.php 0000644 00000001116 15112147616 0007634 0 ustar 00 <?php namespace ElementorExtras\Modules\Table; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Svg\Module * * @since 1.6.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.6.0 * @return string */ public function get_name() { return 'table'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.6.0 * @return array */ public function get_widgets() { return [ 'Table', ]; } } templates-control/background-image.php 0000644 00000016756 15112147616 0014153 0 ustar 00 <?php namespace ElementorExtras\Modules\TemplatesControl; // Extras for Elementor Classes use ElementorExtras\Utils; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Provides temporary support for background images inside * our templates used in loops * @since 2.2.4 */ class BackgroundImage { /** * The current template ID * * @since 2.2.4 * @access private * * @var int */ private $template_id; /** * The current template ID * * @since 2.2.4 * @access private * * @var int */ private $elements = [ 'section' => [ 'background_image' => [ 'allow_static' => false, 'condition' => 'background_background', 'selector' => ' {{WRAPPER}}:not(.elementor-motion-effects-element-type-background), {{WRAPPER}} > .elementor-motion-effects-container > .elementor-motion-effects-layer', 'styles' => [ [ 'property' => 'background-image', 'value' => 'url({{URL}});', ] ], ], 'background_hover_image' => [ 'allow_static' => true, 'condition' => 'background_hover_background', 'selector' => '{{WRAPPER}}:hover, {{WRAPPER}}:hover > .elementor-motion-effects-container > .elementor-motion-effects-layer', 'styles' => [ [ 'property' => 'background-image', 'value' => 'url({{URL}});', ] ], ], ], 'column' => [ 'background_image' => [ 'allow_static' => false, 'condition' => 'background_background', 'selector' => ' {{WRAPPER}}:not(.elementor-motion-effects-element-type-background) > .elementor-element-populated, {{WRAPPER}} > .elementor-column-wrap > .elementor-motion-effects-container > .elementor-motion-effects-layer', 'styles' => [ [ 'property' => 'background-image', 'value' => 'url({{URL}});', ] ], ], 'background_hover_image' => [ 'allow_static' => true, 'condition' => 'background_hover_background', 'selector' => '{{WRAPPER}}:hover > .elementor-element-populated', 'styles' => [ [ 'property' => 'background-image', 'value' => 'url({{URL}});', ] ], ], ], 'widget' => [ '_background_image' => [ 'allow_static' => false, 'condition' => '_background_background', 'selector' => '{{WRAPPER}} > .elementor-widget-container', 'styles' => [ [ 'property' => 'background-image', 'value' => 'url({{URL}});', ] ], ], '_background_hover_image' => [ 'allow_static' => true, 'condition' => '_background_hover_background', 'selector' => '{{WRAPPER}}:hover > .elementor-widget-container', 'styles' => [ [ 'property' => 'background-image', 'value' => 'url({{URL}});', ] ], ], ], ]; /** * Set Template Id * * Sets the current template id * * @param int $template_id The template post ID * @since 2.2.4 * @return void */ public function set_template_id( $template_id ) { if ( ! $template_id ) return; $this->template_id = $template_id; } /** * Get Element Selector * * Retrieves the element selector for printing styles * * @param int $element_id The element ID * @param int $post_id The current post ID in the loop * @since 2.2.4 * @return void */ protected function get_element_selector( $element_id, $post_id ) { $unique_id = $element_id . '-' . $post_id; return '.elementor-' . $this->template_id . ' .elementor-element.elementor-element-'. $element_id .'.elementor-ee-element-'. $unique_id; } /** * Add Actions * * @param Element_Base $element The Elementor element object * @since 2.2.4 * @return void */ public function add_actions( $element ) { $this->parse_controls( $element ); } /** * Add Inline CSS * * Contains logic for determining wether the element needs * template specific inline css addded before it's rendered * * @param Element_Base $element The Elementor element object * @since 2.2.4 * @return void */ protected function parse_controls( $element ) { $_settings = $element->get_settings(); $settings = $element->get_settings_for_display(); $has_styles = false; foreach ( $this->elements as $element_type => $styles ) { foreach ( $styles as $control_name => $control_settings ) { if ( 'classic' !== $element->get_settings( $control_settings['condition'] ) ) { continue; } $control = $element->get_controls( $control_name ); if ( ! $control ) { continue; } $control_name = $control['name']; if ( empty( $control['type'] ) ) { continue; } $control_obj = \Elementor\Plugin::$instance->controls_manager->get_control( $control['type'] ); if ( empty( $control['dynamic'] ) ) { continue; } $dynamic_settings = array_merge( $control_obj->get_settings( 'dynamic' ), $control['dynamic'] ); if ( ! isset( $settings[ '__dynamic__' ][ $control_name ] ) ) { if ( true === $control_settings['allow_static'] && array_key_exists( $control_name, $settings ) ) { $parsed_value = $settings[ $control_name ]; } else { continue; } } else { $parsed_value = $control_obj->parse_tags( $settings[ '__dynamic__' ][ $control_name ], $dynamic_settings ); } if ( $parsed_value && array_key_exists( 'url' , $parsed_value ) ) { // Keep empty urls values to remove inherited style $this->parse_control_styles( $element, $control, $parsed_value['url'] ); $has_styles = true; } else { continue; } } } if ( $has_styles ) { $this->print_styles( $element ); } } /** * Passed through the control names and replaces * css selectors and values * * @param Element_Base $element The Elementor element object * @param Controls_Stack $control The control object * @param string $value The value for the CSS style * @since 2.2.4 * @return void */ private function parse_control_styles( $element, $control, $value ) { $selector = $this->get_element_selector( $element->get_id(), get_the_ID() ); $parsable_selector = $this->elements[ $element->get_type() ][ $control['name'] ]['selector']; $parsable_styles = $this->elements[ $element->get_type() ][ $control['name'] ]['styles']; // Replace selector $this->elements[ $element->get_type() ][ $control['name'] ]['selector'] = str_replace( '{{WRAPPER}}', $selector, $parsable_selector ); // Replace url foreach ( $parsable_styles as $index => $style ) { $this->elements[ $element->get_type() ][ $control['name'] ]['styles'][ $index ]['value'] = $value ? str_replace( '{{URL}}', $value, $parsable_styles[ $index ]['value'] ) : 'none'; // Use none to remove inherited background images } $this->elements[ $element->get_type() ][ $control['name'] ]['print'] = true; } /** * Print Background Image Styles * * @param string $selector The base CSS selector * @param string $url The base CSS selector * @since 2.2.4 * @return void */ private function print_styles( $element ) { $settings = $element->get_settings_for_display(); echo '<style id="ee-template-loop-css-' . $this->template_id . '-' . $element->get_id() . '">'; foreach ( $this->elements[ $element->get_type() ] as $control_name => $control_settings ) { if ( array_key_exists( 'print', $control_settings ) && true === $control_settings['print'] ) { echo $control_settings['selector'] . '{'; foreach ( $control_settings['styles'] as $style ) { echo $style['property'] . ':' . $style['value']; } } } echo '</style>'; } } templates-control/module.php 0000644 00000017044 15112147616 0012230 0 ustar 00 <?php namespace ElementorExtras\Modules\TemplatesControl; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Base\Module_Base; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * @since 2.0.0 */ class Module extends Module_Base { /** * @since 2.0.0 */ public function get_name() { return 'templates'; } /** * @since 2.0.0 */ public function get_widgets() { return []; } /** * @since 2.0.0 */ protected static function get_templates( $args = [] ) { if ( ! method_exists( '\Elementor\TemplateLibrary\Manager', 'get_source' ) || ! method_exists( '\Elementor\TemplateLibrary\Source_Local', 'get_items' ) ) return; return Utils::elementor()->templates_manager->get_source( 'local' )->get_items( $args ); } /** * Markup for when no templates exist * * @since 2.0.0 * @return string */ protected static function empty_templates_message( $template_type = '' ) { return '<div id="elementor-widget-template-empty-templates"> <div class="elementor-widget-template-empty-templates-icon"><i class="eicon-nerd"></i></div> <div class="elementor-widget-template-empty-templates-title">' . sprintf( __( 'You Haven’t Saved %sTemplates Yet.', 'elementor-extras' ), ucfirst( $template_type ) . ' ' ) . '</div> <div class="elementor-widget-template-empty-templates-footer">' . __( 'Want to learn more about Elementor library?', 'elementor-extras' ) . ' <a class="elementor-widget-template-empty-templates-footer-url" href="https://go.elementor.com/docs-library/" target="_blank">' . __( 'Click Here', 'elementor-extras' ) . '</a> </div> </div>'; } /** * Add Render Attributes * * Action that adds additional attributes to the element specific * to the loop * * @param Element_Base $element The Elementor element object * @since 2.2.31 * @return void */ public static function add_render_attributes( $element ) { $unique_id = implode( '-', [ $element->get_id(), get_the_ID() ] ); $element->add_render_attribute( [ '_wrapper' => [ 'data-ee-template-widget-id' => $unique_id, 'class' => [ 'elementor-ee-element-' . $unique_id, ], ], ] ); } /** * Add Controls * * Registers all module controls * * @param Element_Base $object The element object * @param array $args The settings for the controls * @since 2.0.0 */ public static function add_controls( $object, $args = [] ) { $defaults = [ 'type' => [ 'section', 'page', 'widget' ], 'condition' => [], 'prefix' => '', ]; $args = wp_parse_args( $args, $defaults ); self::add_types_control( $object, $args ); if ( ! empty( $args['type'] ) ) { if ( is_array( $args['type'] ) ) { foreach ( $args['type'] as $type ) { self::add_control( $object, $args, $type ); } } else { self::add_control( $object, $args, $args['type'] ); } } } /** * Add Types Control * * Registers a select control for selecting template types * * @param Element_Base $object The element object * @param array $args The settings for the control * @since 2.0.0 */ protected static function add_types_control( $object, $args = [] ) { if ( ! $object ) return; $object->add_control( $args['prefix'] . 'template_type', [ 'label' => __( 'Template Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'section', 'options' => [ 'section' => __( 'Section', 'elementor-extras' ), 'page' => __( 'Page', 'elementor-extras' ), 'widget' => __( 'Widget', 'elementor-extras' ), ], 'condition' => $args['condition'], ] ); } /** * Add Control * * Registers the template selection control * * @param Element_Base $object The element object * @param array $args The settings for the control * @param string $type The type of template * @since 2.0.0 */ protected static function add_control( $object, $args = [], $type = 'section' ) { $defaults = []; $args = wp_parse_args( $args, $defaults ); $templates = self::get_templates( [ 'type' => $type ] ); $options = []; $types = []; $prefix = $args['prefix']; $no_templates_key = $prefix . 'no_' . $type . '_templates'; $templates_key = $prefix . $type . '_template_id'; if ( empty( $templates ) ) { $object->add_control( $no_templates_key, [ 'label' => false, 'type' => Controls_Manager::RAW_HTML, 'raw' => self::empty_templates_message( $type ), 'condition' => array_merge( $args['condition'], [ $args['prefix'] . 'template_type' => $type ] ), ] ); return; } $options['0'] = '— ' . sprintf( __( 'Select %s', 'elementor-extras' ), $type ) . ' —'; foreach ( $templates as $template ) { $options[ $template['template_id'] ] = $template['title'] . ' (' . $template['type'] . ')'; } $object->add_control( $templates_key, [ 'label' => sprintf( __( 'Choose %s', 'elementor-extras' ), $type ), 'type' => Controls_Manager::SELECT, 'default' => '0', 'options' => $options, 'condition' => array_merge( $args['condition'], [ $prefix . 'template_type' => $type, ] ), ] ); } /** * Render Template Content * * Renders the content of an Elementor template for with the specified post ID * * @param int $template_id The template post ID * @param \ElementorExtras\Base\Extras_Widget $widget The widget instance * @since 2.0.0 */ public static function render_template_content( $template_id, \ElementorExtras\Base\Extras_Widget $widget, $in_loop = false ) { if ( 'publish' !== get_post_status( $template_id ) || ! method_exists( '\Elementor\Frontend', 'get_builder_content_for_display' ) ) { return; } if ( ! $template_id ) { if ( method_exists( $widget, 'render_placeholder' ) ) { $widget->render_placeholder([ 'title_tag' => 'h5', 'title' => __( 'Missing Template', 'elementor-extras' ), 'body' => __( 'Set the skin template you want to use in the widget settings.', 'elementor-extras' ), ]); } else { _e( 'No template selected.', 'elementor-extras' ); } } else { global $wp_query; $print_styles = false; if ( $in_loop ) { // If we're inside a loop we need to make sure the global query is replaced with the current post $print_styles = true; // Keep old global wp_query $old_query = $wp_query; // Create a new query from the current post in loop $new_query = new \WP_Query( [ 'post_type' => 'any', 'p' => get_the_ID(), ] ); // Set the global query to the new query $wp_query = $new_query; } $background = new BackgroundImage(); $background->set_template_id( $template_id ); if ( $in_loop ) { // Alter element rendering to account for template add_action( 'elementor/frontend/before_render', [ __CLASS__, 'add_render_attributes' ], 10, 1 ); add_action( 'elementor/frontend/before_render', [ $background, 'add_actions' ], 20, 1 ); } // Fetch the template $template = Utils::elementor()->frontend->get_builder_content_for_display( $template_id, $print_styles ); if ( $in_loop ) { // Remove action remove_action( 'elementor/frontend/before_render', [ $background, 'add_actions' ], 20, 1 ); remove_action( 'elementor/frontend/before_render', [ __CLASS__, 'add_render_attributes' ], 10, 1 ); // Revert to the initial query $wp_query = $old_query; } ?><div class="elementor-template"><?php echo $template; ?></div><?php } } } toggle/skins/skin-base.php 0000644 00000002352 15112147616 0011547 0 ustar 00 <?php namespace ElementorExtras\Modules\Toggle\Skins; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; // Elementor Classes use Elementor\Controls_Manager; use Elementor\Skin_Base as Elementor_Skin_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Toggle\Skins * * @since 2.0.0 */ abstract class Skin_Base extends Elementor_Skin_Base { /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.0.0 * @return void */ protected function _register_controls_actions() { add_action( 'elementor/element/ee-toggle-element/section_items/before_section_end', [ $this, 'register_controls' ] ); } /** * Register Controls * * @since 2.0.0 * @return void * @param $widget Extras_Widget */ public function register_controls( Extras_Widget $widget ) { $this->parent = $widget; $this->register_content_controls(); } /** * Register Content Controls * * @since 2.0.0 * @return void */ public function register_content_controls() {} /** * Render * * Render widget contents on frontend * * @since 2.0.0 * @return void */ public function render() { $this->parent->render(); } } toggle/skins/skin-classic.php 0000644 00000002214 15112147616 0012253 0 ustar 00 <?php namespace ElementorExtras\Modules\Toggle\Skins; // Elementor Classes use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Toggle\Skins * * @since 2.0.0 */ class Skin_Classic extends Skin_Base { /** * Get ID * * Gets the current skin ID * * @since 2.0.0 * @return string */ public function get_id() { return 'classic'; } /** * Get Title * * Gets the current skin title * * @since 2.0.0 * @return string */ public function get_title() { return __( 'Classic', 'elementor-extras' ); } /** * Register Controls Actions * * Registers controls at specific points in the Controls Stack * * @since 2.0.0 * @return void */ protected function _register_controls_actions() { parent::_register_controls_actions(); // add_action( 'elementor/element/ee-toggle-element/section_query/after_section_end', [ $this, 'register_parallax_controls' ] ); } /** * Register Layout Content Controls * * @since 2.0.0 * @return void */ public function register_layout_content_controls() { parent::register_layout_content_controls(); } } toggle/widgets/toggle-element.php 0000644 00000074220 15112147616 0013125 0 ustar 00 <?php namespace ElementorExtras\Modules\Toggle\Widgets; // Extras for Elementor Classes use ElementorExtras\Base\Extras_Widget; use ElementorExtras\Modules\Toggle\Skins; use ElementorExtras\Modules\TemplatesControl\Module as TemplatesControl; use ElementorExtras\Group_Control_Transition; // Elementor Classes use Elementor\Repeater; use Elementor\Icons_Manager; use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Css_Filter; use Elementor\Group_Control_Background; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Toggle_Element * * @since 2.0.0 */ class Toggle_Element extends Extras_Widget { /** * Has template content * * @since 2.0.0 * @var bool */ protected $_has_template_content = false; /** * Get Name * * Get the name of the widget * * @since 2.0.0 * @return string */ public function get_name() { return 'ee-toggle-element'; } /** * Get Title * * Get the title of the widget * * @since 2.0.0 * @return string */ public function get_title() { return __( 'Toggle Element', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 2.0.0 * @return string */ public function get_icon() { return 'nicon nicon-toggle'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 2.0.0 * @return array */ public function get_script_depends() { return [ 'toggle-element', 'gsap-js', 'jquery-resize-ee', ]; } /** * Register Skins * * @since 2.0.0 * @return void */ protected function register_skins() { $this->add_skin( new Skins\Skin_Classic( $this ) ); } /** * Register Widget Controls * * @since 2.0.0 * @return void */ protected function _register_controls() { $this->register_content_controls(); } /** * Register Content Controls * * @since 2.0.0 * @return void */ protected function register_content_controls() { $this->start_controls_section( 'section_elements', [ 'label' => __( 'Elements', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $repeater = new Repeater(); $repeater->start_controls_tabs( 'elements_repeater' ); $repeater->start_controls_tab( 'element_content', [ 'label' => __( 'Content', 'elementor-extras' ) ] ); $repeater->add_control( 'text', [ 'default' => '', 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'label' => __( 'Label', 'elementor-extras' ), 'separator' => 'none', ] ); $repeater->add_control( 'hash', [ 'label' => __( 'Hash', 'elementor-extras' ), 'title' => __( 'Add the hashtag name WITHOUT the # characters', 'elementor-extras' ), 'description' => __('The hashtag is used for automatically activating this element when it\'s present in the URL.', 'elementor-extras'), 'type' => Controls_Manager::TEXT, 'default' => '', 'dynamic' => [ 'active' => true ], ] ); $repeater->add_control( 'selected_icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'icon', ] ); $repeater->add_control( 'icon_align', [ 'label' => __( 'Icon Position', 'elementor-extras' ), 'label_block' => false, 'type' => Controls_Manager::SELECT, 'default' => 'left', 'options' => [ 'left' => __( 'Before', 'elementor-extras' ), 'right' => __( 'After', 'elementor-extras' ), ], 'condition' => [ 'icon!' => '', ], ] ); $repeater->add_control( 'icon_indent', [ 'label' => __( 'Icon Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 50, ], ], 'condition' => [ 'icon!' => '', ], 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}} .ee-icon--right' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}} {{CURRENT_ITEM}} .ee-icon--left' => 'margin-right: {{SIZE}}{{UNIT}};', ], ] ); $repeater->add_control( 'content_type', [ 'label' => __( 'Type', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'text', 'options' => [ 'text' => __( 'Text', 'elementor-extras' ), 'template' => __( 'Template', 'elementor-extras' ), ], ] ); $repeater->add_control( 'content', [ 'label' => __( 'Content', 'elementor-extras' ), 'type' => Controls_Manager::WYSIWYG, 'dynamic' => [ 'active' => true ], 'default' => __( 'I am the content ready to be toggled', 'elementor-extras' ), 'condition' => [ 'content_type' => 'text', ], ] ); TemplatesControl::add_controls( $repeater, [ 'condition' => [ 'content_type' => 'template', ], 'prefix' => 'content_', ] ); $repeater->end_controls_tab(); $repeater->start_controls_tab( 'element_label', [ 'label' => __( 'Style', 'elementor-extras' ) ] ); $repeater->add_control( 'text_color', [ 'label' => __( 'Label Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.ee-toggle-element__controls__item' => 'color: {{VALUE}};', ], ] ); $repeater->add_control( 'text_active_color', [ 'label' => __( 'Active Label Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} {{CURRENT_ITEM}}.ee-toggle-element__controls__item.ee--is-active, {{WRAPPER}} {{CURRENT_ITEM}}.ee-toggle-element__controls__item.ee--is-active:hover' => 'color: {{VALUE}};', ], ] ); $repeater->add_control( 'active_color', [ 'label' => __( 'Indicator Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_PRIMARY, ], ] ); $repeater->end_controls_tab(); $repeater->end_controls_tabs(); $this->add_control( 'elements', [ 'label' => __( 'Elements', 'elementor-extras' ), 'type' => Controls_Manager::REPEATER, 'default' => [ [ 'text' => '', 'content' => __( 'I am the content ready to be toggled', 'elementor-extras' ), ], [ 'text' => '', 'content' => __( 'I am the content of another element ready to be toggled', 'elementor-extras' ), ], ], 'fields' => $repeater->get_controls(), 'title_field' => '{{{ text }}}', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_toggle', [ 'label' => __( 'Toggle', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'toggle_inactive', [ 'label' => __( 'Start Hidden', 'elementor-extras' ), 'description' => __( 'Don\'t show any of the elements initially.', 'elementor-extras' ), 'default' => '', 'type' => Controls_Manager::SWITCHER, 'frontend_available' => true, ] ); $this->add_control( 'toggle_active_index', [ 'label' => __( 'Default Index', 'elementor-extras' ), 'title' => __( 'The index of the default active element.', 'elementor-extras' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'step' => 1, 'frontend_available' => true, 'condition' => [ 'toggle_inactive' => '', ], ] ); $this->add_control( 'toggle_hash_load', [ 'label' => __( 'Load Hash', 'elementor-extras' ), 'description' => __( 'When the page loads, if the hash of an element is present in the URL, that element will be activated.', 'elementor-extras' ), 'default' => '', 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'frontend_available' => true, ] ); /* // TODO: Hash Navigation control $this->add_control( 'toggle_hash_navigation', [ 'label' => __( 'Navigation Hash', 'elementor-extras' ), 'description' => __( 'If clicking on a link to containing any of the hashes, the page will scroll to this widget and toggle the element specified by the hash.', 'elementor-extras' ), 'default' => '', 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'frontend_available' => true, ] ); */ $this->add_control( 'toggle_hash', [ 'label' => __( 'Toggle Hash', 'elementor-extras' ), 'description' => __( 'When toggling, a hashtag will be added to the current URL. If turned off, you can still activate an element by including its hash in the URL.', 'elementor-extras' ), 'default' => '', 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'toggle_position', [ 'label' => __( 'Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'before', 'options' => [ 'before' => __( 'Before', 'elementor-extras' ), 'after' => __( 'After', 'elementor-extras' ), ], ] ); $this->add_control( 'indicator_speed', [ 'label' => __( 'Indicator Speed', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0.1, 'max' => 2, 'step' => 0.1, ], ], 'default' => [ 'size' => 0.3 ], 'frontend_available' => true, ] ); $this->add_control( 'toggle_hide_empty', [ 'label' => __( 'Hide Empty Items', 'elementor-extras' ), 'default' => '', 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', ] ); $this->add_control( 'refresh_widgets', [ 'label' => __( 'Refresh Template Widgets', 'elementor-extras' ), 'description' => __( 'If you are using templates as content for the elements, this option will refresh any frontend functionality for all elements inside those template when toggling. Turn this off if you notice strange behaviour or broken elements inside the template.', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'frontend_available' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_toggler', [ 'label' => __( 'Toggler', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'toggle_style', [ 'label' => __( 'Style', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'round', 'options' => [ 'round' => __( 'Round', 'elementor-extras' ), 'square' => __( 'Square', 'elementor-extras' ), ], 'prefix_class' => 'ee-toggle-element--', ] ); $this->add_responsive_control( 'toggle_align', [ 'label' => __( 'Align', 'elementor-extras' ), 'label_block' => false, 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], ], 'default' => 'center', 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__toggle' => 'text-align: {{VALUE}};', ], ] ); $this->add_responsive_control( 'toggle_zoom', [ 'label' => __( 'Zoom', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 16, ], 'range' => [ 'px' => [ 'max' => 28, 'min' => 12, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__controls-wrapper' => 'font-size: {{SIZE}}px;', ], ] ); $this->add_control( 'toggle_spacing', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 24, ], 'range' => [ 'px' => [ 'max' => 100, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__controls-wrapper--before' => 'margin-bottom: {{SIZE}}px;', '{{WRAPPER}} .ee-toggle-element__controls-wrapper--after' => 'margin-top: {{SIZE}}px;', ], ] ); $this->add_control( 'toggle_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 6, ], 'range' => [ 'px' => [ 'max' => 10, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__indicator' => 'margin: {{SIZE}}px;', '{{WRAPPER}} .ee-toggle-element__controls-wrapper' => 'padding: {{SIZE}}px;', ], ] ); $this->add_responsive_control( 'toggle_width', [ 'label' => __( 'Width (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 100, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__controls-wrapper' => 'width: {{SIZE}}%;', ], ] ); $this->add_responsive_control( 'toggle_radius', [ 'label' => __( 'Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 4, ], 'range' => [ 'px' => [ 'max' => 10, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}}.ee-toggle-element--square .ee-toggle-element__controls-wrapper' => 'border-radius: {{SIZE}}px;', '{{WRAPPER}}.ee-toggle-element--square .ee-toggle-element__indicator' => 'border-radius: calc( {{SIZE}}px - 2px );', ], 'condition' => [ 'toggle_style' => 'square', ] ] ); $this->add_control( 'toggle_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__controls-wrapper' => 'background-color: {{VALUE}};' ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'toggle', 'selector' => '{{WRAPPER}} .ee-toggle-element__controls-wrapper', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_indicator', [ 'label' => __( 'Indicator', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'indicator_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'active' => false, ], 'frontend_available' => true, ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'indicator', 'selector' => '{{WRAPPER}} .ee-toggle-element__indicator', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_labels', [ 'label' => __( 'Labels', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'labels_info', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'After adjusting some of these settings, interact with the toggler so that the position of the indicator is updated. ', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', ] ); $this->add_control( 'labels_stack', [ 'label' => __( 'Stack On', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'None', 'elementor-extras' ), 'desktop' => __( 'All', 'elementor-extras' ), 'tablet' => __( 'Tablet & Mobile', 'elementor-extras' ), 'mobile' => __( 'Mobile', 'elementor-extras' ), ], 'prefix_class' => 'ee-toggle-element--stack-', ] ); $this->add_responsive_control( 'labels_align', [ 'label' => __( 'Inline Align', 'elementor-extras' ), 'description' => __( 'Label alignment only works if you set a custom width for the toggler.', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], 'stretch' => [ 'title' => __( 'Justify', 'elementor-extras' ), 'icon' => 'eicon-h-align-stretch', ], ], 'default' => 'center', 'prefix_class' => 'ee-labels-align%s--', ] ); $this->add_responsive_control( 'stacked_labels_align', [ 'label' => __( 'Stacked Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'start' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'end' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], 'stretch' => [ 'title' => __( 'Justify', 'elementor-extras' ), 'icon' => 'eicon-h-align-stretch', ], ], 'default' => 'center', 'prefix_class' => 'ee-labels-align-stacked%s--', ] ); $this->add_responsive_control( 'text_align', [ 'label' => __( 'Align Label Text', 'elementor-extras' ), 'description' => __( 'Label text alignment only works if your labels have text.', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'default' => '', 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__controls__item' => 'text-align: {{VALUE}};', ] ] ); $this->add_control( 'labels_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 2, 'min' => 0, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__controls__item' => 'padding: {{SIZE}}em;', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'labels_typography', 'selector' => '{{WRAPPER}} .ee-toggle-element__controls__item', 'exclude' => ['font_size', 'line_height'], 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->add_group_control( Group_Control_Transition::get_type(), [ 'name' => 'labels', 'selector' => '{{WRAPPER}} .ee-toggle-element__controls__item', ] ); $this->start_controls_tabs( 'labels_style' ); $this->start_controls_tab( 'labels_style_default', [ 'label' => __( 'Default', 'elementor-extras' ) ] ); $this->add_control( 'labels_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__controls__item' => 'color: {{VALUE}};' ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'labels_style_hover', [ 'label' => __( 'Hover', 'elementor-extras' ) ] ); $this->add_control( 'labels_color_hover', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__controls__item:hover' => 'color: {{VALUE}};' ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'labels_style_active', [ 'label' => __( 'Active', 'elementor-extras' ) ] ); $this->add_control( 'labels_color_active', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__controls__item.ee--is-active, {{WRAPPER}} .ee-toggle-element__controls__item.ee--is-active:hover' => 'color: {{VALUE}};' ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_style_content', [ 'label' => __( 'Content', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'content', 'selector' => '{{WRAPPER}} .ee-toggle-element__element', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->add_control( 'content_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__element' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'content_margin', [ 'label' => __( 'Margin', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__element' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'content', 'label' => __( 'Border', 'elementor-extras' ), 'selector' => '{{WRAPPER}} .ee-toggle-element__element', ] ); $this->add_responsive_control( 'content_border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 10, 'min' => 0, 'step' => 1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__element' => 'border-radius: {{SIZE}}px;', ], ] ); $this->add_control( 'content_foreground', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'separator' => 'before', 'selectors' => [ '{{WRAPPER}} .ee-toggle-element__element' => 'color: {{VALUE}};' ] ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'content_background', 'selector' => '{{WRAPPER}} .ee-toggle-element__element', 'types' => [ 'classic', 'gradient' ], 'default' => 'classic', ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 2.0.0 * @return void */ public function render() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'wrapper' => [ 'class' => [ 'ee-toggle-element', ], ], 'toggle' => [ 'class' => [ 'ee-toggle-element__toggle', ], ], 'controls-wrapper' => [ 'class' => [ 'ee-toggle-element__controls-wrapper', 'ee-toggle-element__controls-wrapper--' . $settings['toggle_position'], ], ], 'indicator' => [ 'class' => [ 'ee-toggle-element__indicator', ], ], 'controls' => [ 'class' => [ 'ee-toggle-element__controls', ], ], 'elements' => [ 'class' => [ 'ee-toggle-element__elements', ], ], ] ); ?> <div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>> <div <?php echo $this->get_render_attribute_string( 'toggle' ); ?>> <?php if ( 'before' === $settings['toggle_position'] ) $this->render_toggle(); ?> <div <?php echo $this->get_render_attribute_string( 'elements' ); ?>> <?php foreach ( $settings['elements'] as $index => $item ) { if ( 'yes' === $settings['toggle_hide_empty'] ) { if ( ! $this->has_item_content( $item ) ) { continue; } } $element_key = $this->get_repeater_setting_key( 'element', 'elements', $index ); $this->add_render_attribute( $element_key, [ 'class' => [ 'ee-toggle-element__element', 'elementor-repeater-item-' . $item['_id'], ] ] ); ?><div <?php echo $this->get_render_attribute_string( $element_key ); ?>><?php switch ( $item['content_type'] ) { case 'text': $this->render_text( $index, $item ); break; case 'template': $template_key = 'content_' . $item['content_template_type'] . '_template_id'; if ( array_key_exists( $template_key, $item ) ) TemplatesControl::render_template_content( $item[ $template_key ], $this ); break; default: break; } ?></div><?php } ?> </div> <?php if ( 'after' === $settings['toggle_position'] ) $this->render_toggle(); ?> </div> </div> <?php } /** * Has Item Content * * @since 2.2.5 * @param $item. array The item to check * @return void */ protected function has_item_content( $item ) { $settings = $this->get_settings_for_display(); $has_content = false; switch ( $item['content_type'] ) { case 'text': if ( trim($item['content']) ) { $has_content = true; } break; case 'template': $template_id = $item[ 'content_' . $item['content_template_type'] . '_template_id' ]; if ( '0' !== $template_id && false !== get_post_status( $template_id ) ) { $has_content = true; } break; default: break; } return $has_content; } /** * Render Toggle Control * * @since 2.0.0 * @return void */ public function render_toggle() { $settings = $this->get_settings_for_display(); ?><div <?php echo $this->get_render_attribute_string( 'controls-wrapper' ); ?>> <div <?php echo $this->get_render_attribute_string( 'indicator' ); ?>></div><?php if ( $settings['elements'] ) { ?><ul <?php echo $this->get_render_attribute_string( 'controls' ); ?>><?php foreach ( $settings['elements'] as $index => $item ) { if ( 'yes' === $settings['toggle_hide_empty'] ) { if ( ! $this->has_item_content( $item ) ) { continue; } } $control_key = $this->get_repeater_setting_key( 'control', 'elements', $index ); $control_text_key = $this->get_repeater_setting_key( 'control-text', 'elements', $index ); $has_icon = ! empty( $item['icon'] ) || ! empty( $item['selected_icon']['value'] ); $this->add_render_attribute( [ $control_key => [ 'class' => [ 'ee-toggle-element__controls__item', 'elementor-repeater-item-' . $item['_id'], ] ], $control_text_key => [ 'class' => 'ee-toggle-element__controls__text', 'unselectable' => 'on', ], ] ); if ( '' !== $item['hash'] ) { $hash = $item['hash']; } else { $hash = $item['_id']; } $this->add_render_attribute( $control_key, 'data-hash', $hash ); if ( '' !== $item['active_color'] ) { $this->add_render_attribute( $control_key, 'data-color', $item['active_color'] ); } if ( ! empty( $item['text'] ) ) { $this->add_render_attribute( $control_key, 'class', 'ee--is-empty' ); } ?><li <?php echo $this->get_render_attribute_string( $control_key ); ?>><?php if ( $has_icon ) { $this->render_toggle_item_icon( $index, $item ); } if ( ! empty( $item['text'] ) && ! $has_icon ) { ?><span <?php echo $this->get_render_attribute_string( $control_text_key ); ?>><?php } if ( ! empty( $item['text'] ) ) { echo $item['text']; } else if ( ! $has_icon ) { echo ' '; } if ( ! empty( $item['text'] ) && ! $has_icon ) { ?></span><?php } ?></li><?php } ?></ul><?php } ?></div><?php } /** * Render Toggle Item Icon * * @since 2.1.5 * @return void */ protected function render_toggle_item_icon( $index, $item ) { $icon_key = $this->get_repeater_setting_key( 'icon', 'elements', $index ); $migrated = isset( $item['__fa4_migrated']['selected_icon'] ); $is_new = empty( $item['icon'] ) && Icons_Manager::is_migration_allowed(); $this->add_render_attribute( $icon_key, 'class', [ 'ee-toggle-element__controls__icon', 'ee-icon', 'ee-icon-support--svg', 'ee-icon--' . $item['icon_align'], ] ); if ( '' === $item['text'] ) { $this->add_render_attribute( $icon_key, 'class', [ 'ee-icon--flush', ] ); } ?><span <?php echo $this->get_render_attribute_string( $icon_key ); ?>><?php if ( $is_new || $migrated ) { Icons_Manager::render_icon( $item['selected_icon'], [ 'aria-hidden' => 'true' ] ); } else { ?><i class="<?php echo esc_attr( $item['icon'] ); ?>" aria-hidden="true"></i><?php } ?></span><?php } /** * Render Text * * Renders the WYSIWYG content * * @since 2.0.0 * @return void */ protected function render_text( $index, $item ) { echo $this->parse_text_editor( $item['content'] ); } /** * Content Template * * Javascript content template for quick rendering. None in this case * * @since 2.0.0 * @return void */ public function content_template() {} } toggle/module.php 0000644 00000001134 15112147616 0010026 0 ustar 00 <?php namespace ElementorExtras\Modules\Toggle; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Toggle\Module * * @since 2.0.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 2.0.0 * @return string */ public function get_name() { return 'toggle'; } /** * Get Widgets * * Get the modules' widgets * * @since 2.0.0 * @return array */ public function get_widgets() { return [ 'Toggle_Element', ]; } } unfold/widgets/unfold.php 0000644 00000075213 15112147616 0011515 0 ustar 00 <?php namespace ElementorExtras\Modules\Unfold\Widgets; // Extras for Elementor Classes use ElementorExtras\Utils; use ElementorExtras\Base\Extras_Widget; // Elementor Classes use Elementor\Icons_Manager; use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Background; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * Unfold * * @since 1.2.0 */ class Unfold extends Extras_Widget { /** * Get Name * * Get the name of the widget * * @since 1.2.0 * @return string */ public function get_name() { return 'unfold'; } /** * Get Title * * Get the title of the widget * * @since 1.2.0 * @return string */ public function get_title() { return __( 'Unfold', 'elementor-extras' ); } /** * Get Icon * * Get the icon of the widget * * @since 1.2.0 * @return string */ public function get_icon() { return 'nicon nicon-unfold'; } /** * Get Script Depends * * A list of scripts that the widgets is depended in * * @since 1.2.0 * @return array */ public function get_script_depends() { return [ 'unfold', 'gsap-js', 'jquery-visible', ]; } /** * Register Widget Controls * * @since 1.2.0 * @return void */ protected function _register_controls() { $this->start_controls_section( 'section_content', [ 'label' => __( 'Content', 'elementor-extras' ), ] ); $this->add_control( 'content', [ 'label' => '', 'type' => Controls_Manager::WYSIWYG, 'dynamic' => [ 'active' => true ], 'default' => __( 'A Cultural Response to Cimate Change profiles the work of the artists in the Unfold exhibition and also proposes a number of creative and innovative responses to climate change aimed at stimulating discourse and a wider engagement with the climate debate. The texts by Gerald Bast, Steve Kapelke, Chris Rapley, David Buckland, Chris Wainwright and Helga Kromp-Kolb provoke, within an educational context, a discussion around what are the legitimate agendas for arts education and arts practitioners, in relation to some of the most pressing and urgent issues of our times.', 'elementor-extras' ), ] ); $this->add_responsive_control( 'text_align', [ 'label' => __( 'Text Align', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'fa fa-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'fa fa-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'fa fa-align-right', ], ], 'selectors' => [ '{{WRAPPER}} .ee-unfold__content' => 'text-align: {{VALUE}}', ], 'default' => '', ] ); $this->add_control( 'visible_type', [ 'label' => __( 'Visible', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => '', 'options' => [ '' => __( 'Percentage', 'elementor-extras' ), 'lines' => __( 'Lines', 'elementor-extras' ), ], 'frontend_available' => 'true' ] ); $this->add_control( 'visible_percentage', [ 'label' => __( 'Visible Amount (%)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'dynamic' => [ 'active' => true ], 'default' => [ 'size' => 50, ], 'range' => [ 'px' => [ 'max' => 100, 'min' => 10, ], ], 'condition' => [ 'visible_type' => '' ], 'frontend_available' => true, ] ); $this->add_control( 'visible_lines', [ 'label' => __( 'Visible Amount (lines)', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'dynamic' => [ 'active' => true ], 'default' => [ 'size' => 3, ], 'range' => [ 'px' => [ 'max' => 50, 'min' => 1, ], ], 'condition' => [ 'visible_type' => 'lines' ], 'frontend_available' => true, ] ); $this->add_control( 'content_valid_warning', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => __( 'Make sure your WYSIWYG content is valid HTML (no unclosed tags) in order for the widget to calculate the number of lines shown correctly.', 'elementor-extras' ), 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning', 'condition' => [ 'visible_type' => 'lines' ] ] ); $this->end_controls_section(); $this->start_controls_section( 'section_settings', [ 'label' => __( 'Settings', 'elementor-extras' ), ] ); $this->start_controls_tabs( 'tabs_folds' ); $this->start_controls_tab( 'tab_unfold', [ 'label' => __( 'Unfold', 'elementor-extras' ), ] ); $this->add_control( 'duration_unfold', [ 'label' => __( 'Duration', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'dynamic' => [ 'active' => true ], 'default' => [ 'size' => 0.5, ], 'range' => [ 'px' => [ 'max' => 2, 'min' => 0.1, 'step'=> 0.1, ], ], 'frontend_available' => true, ] ); $this->add_control( 'animation_unfold', [ 'label' => __( 'Animation', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'Power4', 'options' => [ 'Power0' => __( 'Linear', 'elementor-extras' ), 'Power4' => __( 'Break', 'elementor-extras' ), 'Back' => __( 'Back', 'elementor-extras' ), 'Elastic' => __( 'Elastic', 'elementor-extras' ), 'Bounce' => __( 'Bounce', 'elementor-extras' ), 'SlowMo' => __( 'SlowMo', 'elementor-extras' ), 'SteppedEase' => __( 'Step', 'elementor-extras' ), ], 'frontend_available' => true ] ); $this->add_control( 'easing_unfold', [ 'label' => __( 'Easing', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'easeInOut', 'options' => [ 'easeInOut' => __( 'Ease In Out', 'elementor-extras' ), 'easeIn' => __( 'Ease In', 'elementor-extras' ), 'easeOut' => __( 'Ease Out', 'elementor-extras' ), ], 'condition' => [ 'animation_unfold!' => [ 'SlowMo', 'SteppedEase' ] ], 'frontend_available' => true ] ); $this->add_control( 'steps_unfold', [ 'label' => __( 'Steps', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'dynamic' => [ 'active' => true ], 'default' => [ 'size' => 10, ], 'range' => [ 'px' => [ 'max' => 20, 'min' => 5, ], ], 'condition' => [ 'animation_unfold' => 'SteppedEase' ], 'frontend_available' => true, ] ); $this->add_control( 'slow_unfold', [ 'label' => __( 'Slow Amount', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'dynamic' => [ 'active' => true ], 'default' => [ 'size' => 0.7, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.1, 'step'=> 0.1, ], ], 'condition' => [ 'animation_unfold' => 'SlowMo' ], 'frontend_available' => true, ] ); $this->add_control( 'focus_open', [ 'label' => __( 'Keep Focus', 'elementor-extras' ), 'description' => __( 'When unfolding, keep focus on top of content or the scroll position at the time of starting the unfold.', 'elementor-extras' ), 'options' => [ '' => __( 'Default', 'elementor-extras' ), 'top' => __( 'Top of Content', 'elementor-extras' ), 'scroll' => __( 'Scroll Position', 'elementor-extras' ), ], 'type' => Controls_Manager::SELECT, 'default' => '', 'frontend_available' => true, ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_fold', [ 'label' => __( 'Fold', 'elementor-extras' ), ] ); $this->add_control( 'duration_fold', [ 'label' => __( 'Duration', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'dynamic' => [ 'active' => true ], 'default' => [ 'size' => 0.5, ], 'range' => [ 'px' => [ 'max' => 2, 'min' => 0.1, 'step'=> 0.1, ], ], 'frontend_available' => true, ] ); $this->add_control( 'animation_fold', [ 'label' => __( 'Animation', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'Power4', 'options' => [ 'Power0' => __( 'Linear', 'elementor-extras' ), 'Power4' => __( 'Break', 'elementor-extras' ), 'Back' => __( 'Back', 'elementor-extras' ), 'Elastic' => __( 'Elastic', 'elementor-extras' ), 'Bounce' => __( 'Bounce', 'elementor-extras' ), 'SlowMo' => __( 'SlowMo', 'elementor-extras' ), 'SteppedEase' => __( 'Step', 'elementor-extras' ), ], 'frontend_available' => true ] ); $this->add_control( 'easing_fold', [ 'label' => __( 'Easing', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'easeInOut', 'options' => [ 'easeInOut' => __( 'Ease In Out', 'elementor-extras' ), 'easeIn' => __( 'Ease In', 'elementor-extras' ), 'easeOut' => __( 'Ease Out', 'elementor-extras' ), ], 'condition' => [ 'animation_fold!' => [ 'SlowMo', 'SteppedEase' ] ], 'frontend_available' => true ] ); $this->add_control( 'steps_fold', [ 'label' => __( 'Steps', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'dynamic' => [ 'active' => true ], 'default' => [ 'size' => 10, ], 'range' => [ 'px' => [ 'max' => 20, 'min' => 5, ], ], 'condition' => [ 'animation_fold' => 'SteppedEase' ], 'frontend_available' => true, ] ); $this->add_control( 'slow_fold', [ 'label' => __( 'Slow Amount', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'dynamic' => [ 'active' => true ], 'default' => [ 'size' => 0.7, ], 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.1, 'step'=> 0.1, ], ], 'condition' => [ 'animation_fold' => 'SlowMo' ], 'frontend_available' => true, ] ); $this->add_control( 'focus_close', [ 'label' => __( 'Keep Focus', 'elementor-extras' ), 'description' => __( 'When folding, keep focus on content', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'frontend_available' => true, ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'section_separator_content', [ 'label' => __( 'Separator', 'elementor-extras' ), ] ); $this->add_control( 'separator', [ 'label' => __( 'Hide Separator', 'elementor-extras' ), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'return_value' => 'yes', 'selectors' => [ "{{WRAPPER}} .ee-unfold__separator" => 'display: none', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_trigger', [ 'label' => __( 'Button', 'elementor-extras' ), ] ); $this->start_controls_tabs( 'tabs_trigger_content' ); $this->start_controls_tab( 'tab_trigger_closed', [ 'label' => __( 'Folded', 'elementor-extras' ), ] ); $this->add_control( 'text_closed', [ 'label' => __( 'Label', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => __( 'Read more', 'elementor-extras' ), 'placeholder' => __( 'Read more', 'elementor-extras' ), ] ); $this->add_control( 'selected_icon', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'icon', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_trigger_open', [ 'label' => __( 'Unfolded', 'elementor-extras' ), ] ); $this->add_control( 'text_open', [ 'label' => __( 'Label', 'elementor-extras' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true ], 'default' => __( 'Read less', 'elementor-extras' ), 'placeholder' => __( 'Read less', 'elementor-extras' ), ] ); $this->add_control( 'selected_icon_open', [ 'label' => __( 'Icon', 'elementor-extras' ), 'type' => Controls_Manager::ICONS, 'label_block' => true, 'fa4compatibility' => 'icon_open', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_responsive_control( 'align', [ 'label' => __( 'Alignment', 'elementor-extras' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => __( 'Left', 'elementor-extras' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => __( 'Center', 'elementor-extras' ), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => __( 'Right', 'elementor-extras' ), 'icon' => 'eicon-h-align-right', ], 'justify' => [ 'title' => __( 'Stretch', 'elementor-extras' ), 'icon' => 'eicon-h-align-stretch', ], ], 'prefix_class' => 'ee-trigger%s-align--', 'default' => '', 'separator' => 'before', ] ); $this->add_control( 'size', [ 'label' => __( 'Size', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'sm', 'options' => Utils::get_button_sizes(), ] ); $this->add_control( 'icon_align', [ 'label' => __( 'Icon Position', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'default' => 'left', 'options' => [ 'left' => __( 'Before', 'elementor-extras' ), 'right' => __( 'After', 'elementor-extras' ), ], 'conditions'=> [ 'relation' => 'or', 'terms' => [ [ 'name' => 'selected_icon[value]', 'operator' => '!==', 'value' => '', ], [ 'name' => 'selected_icon_open[value]', 'operator' => '!==', 'value' => '', ], ] ], ] ); $this->add_control( 'icon_indent', [ 'label' => __( 'Icon Spacing', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'dynamic' => [ 'active' => true ], 'range' => [ 'px' => [ 'max' => 50, ], ], 'condition' => [ 'icon!' => '', ], 'selectors' => [ '{{WRAPPER}} .ee-button .ee-icon--right' => 'margin-left: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .ee-button .ee-icon--left' => 'margin-right: {{SIZE}}{{UNIT}};', ], 'conditions'=> [ 'relation' => 'or', 'terms' => [ [ 'name' => 'selected_icon[value]', 'operator' => '!==', 'value' => '', ], [ 'name' => 'selected_icon_open[value]', 'operator' => '!==', 'value' => '', ], ] ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_style_content', [ 'label' => __( 'Content', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $text_columns = range( 1, 10 ); $text_columns = array_combine( $text_columns, $text_columns ); $text_columns[''] = __( 'Default', 'elementor-extras' ); $this->add_responsive_control( 'text_columns', [ 'label' => __( 'Columns', 'elementor-extras' ), 'type' => Controls_Manager::SELECT, 'separator' => 'before', 'options' => $text_columns, 'selectors' => [ '{{WRAPPER}} .ee-unfold__content' => 'columns: {{VALUE}};', ], ] ); $this->add_responsive_control( 'column_gap', [ 'label' => __( 'Columns Gap', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'vw' ], 'range' => [ 'px' => [ 'max' => 100, ], '%' => [ 'max' => 10, 'step' => 0.1, ], 'vw' => [ 'max' => 10, 'step' => 0.1, ], 'em' => [ 'max' => 10, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} .ee-unfold__content' => 'column-gap: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'content_color', [ 'label' => __( 'Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-unfold__content' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'content_background', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ee-unfold__content' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'content_padding', [ 'label' => __( 'Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px' ], 'selectors' => [ '{{WRAPPER}} .ee-unfold__content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'content_typography', 'selector' => '{{WRAPPER}} .ee-unfold__content', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_separator_style', [ 'label' => __( 'Separator', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'separator!' => 'yes' ] ] ); $this->add_control( 'separator_height', [ 'label' => __( 'Height', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'dynamic' => [ 'active' => true ], 'default' => [ 'size' => 48, ], 'range' => [ 'px' => [ 'max' => 100, 'min' => 0, ], '%' => [ 'max' => 100, 'min' => 0, ], ], 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} .ee-unfold__separator' => 'height: {{SIZE}}{{UNIT}}' ], 'condition' => [ 'separator!' => 'yes' ] ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'gradient', 'types' => [ 'gradient', 'classic' ], 'selector' => '{{WRAPPER}} .ee-unfold__separator', 'default' => 'gradient', 'condition' => [ 'separator!' => 'yes' ] ] ); $this->end_controls_section(); $this->start_controls_section( 'section_trigger_style', [ 'label' => __( 'Button', 'elementor-extras' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'trigger_distance', [ 'label' => __( 'Distance', 'elementor-extras' ), 'type' => Controls_Manager::SLIDER, 'dynamic' => [ 'active' => true ], 'default' => [ 'size' => 24, ], 'range' => [ 'px' => [ 'max' => 96, ], ], 'selectors' => [ '{{WRAPPER}} .ee-unfold__trigger' => 'margin-top: {{SIZE}}px', ] ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'typography', 'label' => __( 'Typography', 'elementor-extras' ), 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_TEXT, ], 'selector' => '{{WRAPPER}} a.ee-button, {{WRAPPER}} .ee-button', ] ); $this->start_controls_tabs( 'tabs_button_style' ); $this->start_controls_tab( 'tab_button_normal', [ 'label' => __( 'Normal', 'elementor-extras' ), ] ); $this->add_control( 'button_text_color', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'default' => '', 'selectors' => [ '{{WRAPPER}} a.ee-button, {{WRAPPER}} .ee-button' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'background_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_SECONDARY, ], 'selectors' => [ '{{WRAPPER}} a.ee-button, {{WRAPPER}} .ee-button' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_button_hover', [ 'label' => __( 'Hover', 'elementor-extras' ), ] ); $this->add_control( 'hover_color', [ 'label' => __( 'Text Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} a.ee-button:hover, {{WRAPPER}} .ee-button:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_background_hover_color', [ 'label' => __( 'Background Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} a.ee-button:hover, {{WRAPPER}} .ee-button:hover' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'button_hover_border_color', [ 'label' => __( 'Border Color', 'elementor-extras' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'border_border!' => '', ], 'selectors' => [ '{{WRAPPER}} a.ee-button:hover, {{WRAPPER}} .ee-button:hover' => 'border-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'border', 'label' => __( 'Border', 'elementor-extras' ), 'placeholder' => '1px', 'default' => '1px', 'selector' => '{{WRAPPER}} .ee-button', 'separator' => 'before', ] ); $this->add_control( 'border_radius', [ 'label' => __( 'Border Radius', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%' ], 'selectors' => [ '{{WRAPPER}} a.ee-button, {{WRAPPER}} .ee-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'button_box_shadow', 'selector' => '{{WRAPPER}} .ee-button', ] ); $this->add_control( 'text_padding', [ 'label' => __( 'Text Padding', 'elementor-extras' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} a.ee-button, {{WRAPPER}} .ee-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->end_controls_section(); } /** * Render * * Render widget contents on frontend * * @since 1.2.0 * @return void */ protected function render() { $settings = $this->get_settings_for_display(); if ( empty( $settings['content'] ) ) { return; } $this->add_render_attribute( [ 'wrapper' => [ 'class' => 'ee-unfold', ], 'mask' => [ 'class' => 'ee-unfold__mask', ], 'button' => [ 'class' => [ 'ee-button', ], ], 'button-wrapper' => [ 'class' => 'ee-button-wrapper', ], 'separator' => [ 'class' => 'ee-unfold__separator', ], 'content' => [ 'class' => 'ee-unfold__content', ], 'trigger' => [ 'class' => 'ee-unfold__trigger', ], ] ); $this->add_inline_editing_attributes( 'content', 'advanced' ); if ( ! empty( $settings['size'] ) ) { $this->add_render_attribute( 'button', 'class', 'ee-size-' . $settings['size'] ); } ?><div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?>> <div <?php echo $this->get_render_attribute_string( 'mask' ); ?>> <div <?php echo $this->get_render_attribute_string( 'content' ); ?>> <?php echo $this->parse_text_editor( $settings['content'] ); ?> </div> <div <?php echo $this->get_render_attribute_string( 'separator' ); ?>></div> </div> <div <?php echo $this->get_render_attribute_string( 'trigger' ); ?>> <span <?php echo $this->get_render_attribute_string( 'button-wrapper' ); ?>> <span <?php echo $this->get_render_attribute_string( 'button' ); ?>> <?php $this->render_text(); ?> </span> </span> </div> </div><?php } /** * Render text * * Renders the markup for content of the unfold * * @since 1.2.0 * @return void */ protected function render_text() { $settings = $this->get_settings_for_display(); $this->add_render_attribute( [ 'content-wrapper' => [ 'class' => 'ee-button-content-wrapper' ], 'text' => [ 'class' => 'ee-button-text', 'data-close-label' => $settings['text_open'], 'data-open-label' => $settings['text_closed'], ], ] ); ?><span <?php echo $this->get_render_attribute_string( 'content-wrapper' ); ?>><?php $this->render_icon( 'icon', 'closed' ); $this->render_icon( 'icon_open', 'open' ); ?><span <?php echo $this->get_render_attribute_string( 'text' ); ?>><?php echo $settings['text_closed']; ?></span> </span> <?php } protected function render_icon( $setting_key, $type = 'closed' ) { $settings = $this->get_settings(); if ( empty( $settings[ $setting_key ] ) && empty( $settings[ 'selected_' . $setting_key ]['value'] ) ) { return; } $migrated = isset( $settings['__fa4_migrated']['selected_' . $setting_key ] ); $is_new = empty( $settings[ $setting_key ] ) && Icons_Manager::is_migration_allowed(); $this->add_render_attribute( [ 'icon-wrapper-' . $type => [ 'class' => [ 'ee-icon', 'ee-icon-support--svg', 'ee-icon--' . $settings['icon_align'], 'ee-button-icon', 'ee-unfold__icon', 'ee-unfold__icon--' . $type, ], ], ] ); if ( ! empty( $settings[ $setting_key ] ) ) { $this->add_render_attribute( [ 'icon-' . $type => [ 'class' => $settings[ $setting_key ], 'aria-hidden' => 'true', ], ] ); } ?><span <?php echo $this->get_render_attribute_string( 'icon-wrapper-' . $type ); ?>><?php if ( $is_new || $migrated ) { Icons_Manager::render_icon( $settings['selected_' . $setting_key ], [ 'aria-hidden' => 'true' ] ); } else { ?><i <?php echo $this->get_render_attribute_string( 'icon-' . $type ); ?>></i><?php } ?></span><?php } /** * Content Template * * Javascript content template for quick rendering. * * @since 1.2.0 * @return void */ protected function content_template() { ?><# if ( ! settings.content ) { return; } view.addRenderAttribute( { 'wrapper' : { 'class' : 'ee-unfold', }, 'mask' : { 'class' : 'ee-unfold__mask', }, 'button' : { 'class' : [ 'ee-button', ], }, 'button-wrapper' : { 'class' : 'ee-button-wrapper', }, 'separator' : { 'class' : 'ee-unfold__separator', }, 'content' : { 'class' : 'ee-unfold__content', }, 'trigger' : { 'class' : 'ee-unfold__trigger', }, } ); view.addInlineEditingAttributes( 'content', 'advanced' ); if ( '' !== settings.size ) { view.addRenderAttribute( 'button', 'class', 'ee-size-' + settings.size ); } #><div {{{ view.getRenderAttributeString( 'wrapper' ) }}}> <div {{{ view.getRenderAttributeString( 'mask' ) }}}> <div {{{ view.getRenderAttributeString( 'content' ) }}}> {{{ settings.content }}} </div> <div {{{ view.getRenderAttributeString( 'separator' ) }}}></div> </div> <div {{{ view.getRenderAttributeString( 'trigger' ) }}}> <span {{{ view.getRenderAttributeString( 'button-wrapper' ) }}}> <span {{{ view.getRenderAttributeString( 'button' ) }}}> <?php echo $this->_text_template(); ?> </span> </span> </div> </div><?php } /** * Text Template * * @since 1.7.0 * @return void */ protected function _text_template() { ?><# var iconHTML = elementor.helpers.renderIcon( view, settings.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ), iconMigrated = elementor.helpers.isIconMigrated( settings, 'selected_icon' ); var openIconHTML = elementor.helpers.renderIcon( view, settings.selected_icon_open, { 'aria-hidden': true }, 'i' , 'object' ), openIconMigrated = elementor.helpers.isIconMigrated( settings, 'selected_icon_open' ); view.addRenderAttribute( { 'content-wrapper' : { 'class' : 'ee-button-content-wrapper' }, 'icon-wrapper-closed' : { 'class' : [ 'ee-icon', 'ee-icon-support--svg', 'ee-icon--' + settings.icon_align, 'ee-button-icon', 'ee-unfold__icon', 'ee-unfold__icon--closed', ], }, 'icon-wrapper-open' : { 'class' : [ 'ee-icon', 'ee-icon-support--svg', 'ee-icon--' + settings.icon_align, 'ee-button-icon', 'ee-unfold__icon', 'ee-unfold__icon--open', ], }, 'icon-closed' : { 'class' : settings.icon, 'aria-hidden' : 'true', }, 'icon-open' : { 'class' : settings.icon_open, 'aria-hidden' : 'true', }, 'text' : { 'class' : 'ee-button-text', 'data-close-label' : settings.text_open, 'data-open-label' : settings.text_closed, }, } ); #><span {{{ view.getRenderAttributeString( 'content-wrapper' ) }}}> <# if ( settings.icon || settings.selected_icon.value ) { #> <span {{{ view.getRenderAttributeString( 'icon-wrapper-closed' ) }}}> <# if ( ( iconMigrated || ! settings.icon ) && iconHTML.rendered ) { #> {{{ iconHTML.value }}} <# } else { #> <i {{{ view.getRenderAttributeString( 'icon-closed' ) }}}></i> <# } #> </span> <# } #> <# if ( settings.icon_open || settings.selected_icon_open.value ) { #> <span {{{ view.getRenderAttributeString( 'icon-wrapper-open' ) }}}> <# if ( ( openIconMigrated || ! settings.icon_open ) && openIconHTML.rendered ) { #> {{{ openIconHTML.value }}} <# } else { #> <i {{{ view.getRenderAttributeString( 'icon-open' ) }}}></i> <# } #> </span> <# } #> <span {{{ view.getRenderAttributeString( 'text' ) }}}>{{{ settings.text_closed }}}</span> </span><?php } } unfold/module.php 0000644 00000001124 15112147616 0010033 0 ustar 00 <?php namespace ElementorExtras\Modules\Unfold; // Extras for Elementor Classes use ElementorExtras\Base\Module_Base; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly /** * \Modules\Unfold\Module * * @since 1.6.0 */ class Module extends Module_Base { /** * Get Name * * Get the name of the module * * @since 1.6.0 * @return string */ public function get_name() { return 'unfold'; } /** * Get Widgets * * Get the modules' widgets * * @since 1.6.0 * @return array */ public function get_widgets() { return [ 'Unfold', ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0.18 |
proxy
|
phpinfo
|
Настройка