Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

jsarnowski / jsarnowski/jet-elements   php

Repository URL to install this package:

Version: 2.5.6 

/ addons / jet-elements-dropbar.php

<?php
/**
 * Class: Jet_Elements_Dropbar
 * Name: Dropbar
 * Slug: jet-dropbar
 */

namespace Elementor;

use Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Typography;
use Elementor\Repeater;
use Elementor\Scheme_Color;
use Elementor\Scheme_Typography;
use Elementor\Widget_Base;

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

class Jet_Elements_Dropbar extends Jet_Elements_Base {

	public function get_name() {
		return 'jet-dropbar';
	}

	public function get_title() {
		return esc_html__( 'Dropbar', 'jet-elements' );
	}

	public function get_icon() {
		return 'jet-elements-icon-dropbar';
	}

	public function get_jet_help_url() {
		return 'https://crocoblock.com/knowledge-base/articles/jetelements-dropbar-widget-how-to-add-a-compact-dropbar-widget-to-your-website/';
	}

	public function get_categories() {
		return array( 'cherry' );
	}

	protected function _register_controls() {
		$css_scheme = apply_filters(
			'jet-elements/dropbar/css-scheme',
			array(
				'dropbar'         => '.jet-dropbar',
				'inner'           => '.jet-dropbar__inner',
				'button'          => '.jet-dropbar__button',
				'button_icon'     => '.jet-dropbar__button-icon',
				'button_text'     => '.jet-dropbar__button-text',
				'content_wrapper' => '.jet-dropbar__content-wrapper',
				'content'         => '.jet-dropbar__content',
			)
		);

		/**
		 * `Dropbar` Section
		 */
		$this->start_controls_section(
			'section_dropbar_content',
			array(
				'label' => esc_html__( 'Dropbar', 'jet-elements' ),
			)
		);

		$this->add_control(
			'button_heading',
			array(
				'label' => esc_html__( 'Button', 'jet-elements' ),
				'type'  => Controls_Manager::HEADING,
			)
		);

		$this->add_control(
			'button_type',
			array(
				'label'   => esc_html__( 'Button type', 'jet-elements' ),
				'type'    => Controls_Manager::SELECT,
				'default' => 'text',
				'options' => array(
					'text'  => esc_html__( 'Text', 'jet-elements' ),
					'image' => esc_html__( 'Image', 'jet-elements' ),
				),
			)
		);

		$this->add_control(
			'button_text',
			array(
				'label'     => esc_html__( 'Text', 'jet-elements' ),
				'type'      => Controls_Manager::TEXT,
				'default'   => esc_html__( 'Dropbar', 'jet-elements' ),
				'dynamic'   => array( 'active' => true ),
				'condition' => array(
					'button_type' => 'text',
				),
			)
		);

		$this->add_control(
			'image',
			array(
				'label'   => esc_html__( 'Image', 'jet-elements' ),
				'type'    => Controls_Manager::MEDIA,
				'default' => array(
					'url' => Utils::get_placeholder_image_src(),
				),
				'dynamic'   => array( 'active' => true ),
				'condition' => array(
					'button_type' => 'image',
				),
			)
		);

		$this->add_group_control(
			Group_Control_Image_Size::get_type(),
			array(
				'name'      => 'image',
				'default'   => 'thumbnail',
				'separator' => 'none',
				'condition' => array(
					'button_type' => 'image',
				),
			)
		);
		
		$this->_add_advanced_icon_control(
			'button_before_icon',
			array(
				'label'       => esc_html__( 'Before icon', 'jet-elements' ),
				'label_block' => false,
				'type'        => Controls_Manager::ICON,
				'skin'        => 'inline',
			)
		);

		$this->_add_advanced_icon_control(
			'button_after_icon',
			array(
				'label'       => esc_html__( 'After icon', 'jet-elements' ),
				'label_block' => false,
				'type'        => Controls_Manager::ICON,
				'skin'        => 'inline',
			)
		);

		$this->add_responsive_control(
			'button_align',
			array(
				'label' => esc_html__( 'Alignment', 'jet-elements' ),
				'type'  => Controls_Manager::CHOOSE,
				'options' => array(
					'left' => array(
						'title' => esc_html__( 'Left', 'jet-elements' ),
						'icon' => 'eicon-h-align-left',
					),
					'center' => array(
						'title' => esc_html__( 'Center', 'jet-elements' ),
						'icon' => 'eicon-h-align-center',
					),
					'right' => array(
						'title' => esc_html__( 'Right', 'jet-elements' ),
						'icon' => 'eicon-h-align-right',
					),
					'justify' => array(
						'title' => esc_html__( 'Justified', 'jet-elements' ),
						'icon' => 'eicon-h-align-stretch',
					),
				),
				'selectors_dictionary' => array(
					'left'    => 'margin-left: 0; margin-right: auto; width: auto;',
					'center'  => 'margin-left: auto; margin-right: auto; width: auto;',
					'right'   => 'margin-left: auto; margin-right: 0; width: auto;',
					'justify' => 'margin-left: 0; margin-right: 0; width: 100%;',
				),
				'selectors' => array(
					'{{WRAPPER}} ' . $css_scheme['inner'] => '{{VALUE}}',
				),
			)
		);

		$this->add_control(
			'content_heading',
			array(
				'label'     => esc_html__( 'Content', 'jet-elements' ),
				'type'      => Controls_Manager::HEADING,
				'separator' => 'before',
			)
		);

		$this->add_control(
			'content_type',
			array(
				'label'   => esc_html__( 'Content Type', 'jet-elements' ),
				'type'    => Controls_Manager::CHOOSE,
				'default' => 'simple',
				'toggle'  => false,
				'options' => array(
					'simple' => array(
						'title' => esc_html__( 'Simple Text', 'jet-elements' ),
						'icon'  => 'fa fa-text-width',
					),
					'wysiwyg' => array(
						'title' => esc_html__( 'WYSIWYG', 'jet-elements' ),
						'icon'  => 'fa fa-edit',
					),
					'template' => array(
						'title' => esc_html__( 'Template', 'jet-elements' ),
						'icon'  => 'fa fa-file',
					),
				),
			)
		);

		$this->add_control(
			'simple_content',
			array(
				'label'   => esc_html__( 'Simple Text', 'jet-elements' ),
				'type'    => Controls_Manager::TEXTAREA,
				'default' => esc_html__( 'Dropbar Content', 'jet-elements' ),
				'condition' => array(
					'content_type' => 'simple',
				),
				'dynamic' => array( 'active' => true ),
			)
		);

		$this->add_control(
			'wysiwyg_editor',
			array(
				'label'   => esc_html__( 'WYSIWYG Editor', 'jet-elements' ),
				'type' => Controls_Manager::WYSIWYG,
				'show_label' => false,
				'condition' => array(
					'content_type' => 'wysiwyg',
				),
				'dynamic' => array( 'active' => true ),
			)
		);

		$this->add_control(
			'template_id',
			array(
				'label'       => esc_html__( 'Choose Template', 'jet-elements' ),
				'label_block' => 'true',
				'type'        => 'jet-query',
				'query_type'  => 'elementor_templates',
				'condition'   => array(
					'content_type' => 'template',
				),
			)
		);

		$this->end_controls_section();

		/**
		 * `Settings` Section
		 */
		$this->start_controls_section(
			'section_dropbar_settings',
			array(
				'label' => esc_html__( 'Settings', 'jet-elements' ),
			)
		);

		$this->add_responsive_control(
			'position',
			array(
				'label'   => esc_html__( 'Position', 'jet-elements' ),
				'type'    => Controls_Manager::SELECT,
				'default' => 'bottom-left',
				'label_block' => true,
				'options' => array(
					'top-left'      => esc_html__( 'Top Left', 'jet-elements' ),
					'top-center'    => esc_html__( 'Top Center', 'jet-elements' ),
					'top-right'     => esc_html__( 'Top Right', 'jet-elements' ),
					'bottom-left'   => esc_html__( 'Bottom Left', 'jet-elements' ),
					'bottom-center' => esc_html__( 'Bottom Center', 'jet-elements' ),
					'bottom-right'  => esc_html__( 'Bottom Right', 'jet-elements' ),
					'left-top'      => esc_html__( 'Left Top', 'jet-elements' ),
					'left-center'   => esc_html__( 'Left Center', 'jet-elements' ),
					'left-bottom'   => esc_html__( 'Left Bottom', 'jet-elements' ),
					'right-top'     => esc_html__( 'Right Top', 'jet-elements' ),
					'right-center'  => esc_html__( 'Right Center', 'jet-elements' ),
					'right-bottom'  => esc_html__( 'Right Bottom', 'jet-elements' ),
				),
				'selectors_dictionary' => array(
					'top-left'      => 'top: auto; bottom: 100%; left: 0; right: auto; transform: none;',
					'top-center'    => 'top: auto; bottom: 100%; left: 50%; right: auto; transform: translateX(-50%);',
					'top-right'     => 'top: auto; bottom: 100%; left: auto; right: 0; transform: none;',

					'bottom-left'   => 'top: 100%; bottom: auto; left: 0; right: auto; transform: none;',
					'bottom-center' => 'top: 100%; bottom: auto; left: 50%; right: auto; transform: translateX(-50%);',
					'bottom-right'  => 'top: 100%; bottom: auto; left: auto; right: 0; transform: none;',

					'left-top'      => 'top: 0; bottom: auto; left: auto; right: 100%; transform: none;',
					'left-center'   => 'top: 50%; bottom: auto; left: auto; right: 100%; transform: translateY(-50%);',
					'left-bottom'   => 'top: auto; bottom: 0; left: auto; right: 100%; transform: none;',

					'right-top'     => 'top: 0; bottom: auto; left: 100%; right: auto; transform: none;',
					'right-center'  => 'top: 50%; bottom: auto; left: 100%; right: auto; transform: translateY(-50%);',
					'right-bottom'  => 'top: auto; bottom: 0; left: 100%; right: auto; transform: none;',
				),
				'prefix_class' => 'jet-dropbar%s-position-',
				'selectors' => array(
					'{{WRAPPER}} ' . $css_scheme['content_wrapper'] => '{{VALUE}}',
				),
			)
		);

		$this->add_control(
			'mode',
			array(
				'label'   => esc_html__( 'Mode', 'jet-elements' ),
				'type'    => Controls_Manager::SELECT,
				'default' => 'hover',
				'options' => array(
					'hover' => esc_html__( 'Hover', 'jet-elements' ),
					'click' => esc_html__( 'Click', 'jet-elements' ),
				),
			)
		);

		$this->add_control(
			'hide_delay',
			array(
				'label'   => esc_html__( 'Hide Delay', 'jet-elements' ),
				'type'    => Controls_Manager::NUMBER,
				'default' => 500,
				'min'     => 0,
				'max'     => 5000,
				'condition' => array(
					'mode' => 'hover',
				),
			)
		);

		$this->add_control(
			'show_effect',
			array(
				'label'   => esc_html__( 'Show Effect', 'jet-elements' ),
				'type'    => Controls_Manager::SELECT,
				'default' => 'none',
				'options' => array(
Loading ...