* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_image',
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Scheme_Color;
+use Elementor\Repeater;
+
+use function App\asset_path;
+use function App\template;
class ModalList extends Widget_Base {
*/
public function get_script_depends() {
- wp_register_script('lity', \App\asset_path('scripts/lity.js'), ['jquery'], null, true);
+ wp_register_script('lity', asset_path('scripts/lity.js'), ['jquery'], null, true);
wp_register_script(
'cube-modal-list',
- \App\asset_path('scripts/modal-list.js'),
+ asset_path('scripts/modal-list.js'),
['jquery', 'lity'], // Dependencies
null, // Version
true // In footer?
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'title',
+ [
+ 'label' => __( 'Title', 'elementor' ),
+ 'type' => Controls_Manager::TEXT,
+ 'placeholder' => __( 'Enter your title', 'elementor' ),
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'body',
+ [
+ 'label' => __('Body', 'cube'),
+ 'type' => Controls_Manager::WYSIWYG,
+ 'default' => '',
+ ]
+ );
+
$this->add_control(
'items',
[
'label' => __( 'Items', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'title',
- 'label' => __( 'Title', 'elementor' ),
- 'type' => Controls_Manager::TEXT,
- 'placeholder' => __( 'Enter your title', 'elementor' ),
- 'default' => '',
- ],
- [
- 'name' => 'body',
- 'label' => __('Body', 'cube'),
- 'type' => Controls_Manager::WYSIWYG,
- 'default' => '',
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
$items = $this->get_settings('items');
- echo \App\template('widgets/modal-list', compact('items'));
+ echo template('widgets/modal-list', compact('items'));
}
}
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Utils as ElementorUtils;
+use Elementor\Repeater;
use PhysioAssist\Elementor\Utils;
public function get_script_depends() {
wp_register_script('lity', asset_path('scripts/lity.js'), ['jquery'], null, true);
+ wp_register_script('slick', asset_path('scripts/slick.js'), ['jquery'], null, true);
wp_register_script(
'cube-multimedia-carousel',
asset_path('scripts/multimedia-carousel.js'),
- ['jquery', 'lity'], // Dependencies
+ ['jquery', 'lity', 'slick'], // Dependencies
null, // Version
true // In footer?
);
- // Use script already registered by Elementor so we don't have to include another copy of Slick
- return ['jquery-slick', 'cube-multimedia-carousel'];
+ return ['cube-multimedia-carousel'];
}
/**
* Register the widget controls.
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'type',
+ [
+ 'label' => __('Slide Type', 'cube'),
+ 'type' => Controls_Manager::SELECT,
+ 'default' => '',
+ 'options' => [
+ '' => __('(Select)'),
+ 'video' => __( 'Video', 'cube' ),
+ 'text' => __( 'Text', 'cube' ),
+ ],
+ ]
+ );
+
+ $repeater->add_control(
+ 'image',
+ [
+ 'label' => __('Image', 'cube'),
+ 'label_block' => true,
+ 'type' => Controls_Manager::MEDIA,
+ 'default' => [
+ 'url' => ElementorUtils::get_placeholder_image_src(),
+ ],
+ 'condition' => [
+ 'type' => ['text', 'video']
+ ],
+ ]
+ );
+
+ // Video URL only used for video slides
+ $repeater->add_control(
+ 'url',
+ [
+ 'label' => __( 'Video URL', 'cube' ),
+ 'placeholder' => __( 'Enter YouTube link', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ 'condition' => [
+ 'type' => 'video'
+ ],
+ ]
+ );
+
+ $repeater->add_control(
+ 'title',
+ [
+ 'label' => __( 'Title', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ 'default' => '',
+ 'condition' => [
+ 'type' => ['text', 'video']
+ ],
+ ]
+ );
+
+ $repeater->add_control(
+ 'subtitle',
+ [
+ 'label' => __( 'Subtitle', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ 'condition' => [
+ 'type' => ['text', 'video']
+ ],
+ ]
+ );
+
+ // Body field is only used for "text" slides
+ $repeater->add_control(
+ 'body',
+ [
+ 'label' => __('Body', 'cube'),
+ 'type' => Controls_Manager::WYSIWYG,
+ 'default' => '',
+ 'dynamic' => [
+ 'active' => false,
+ ],
+ 'condition' => [
+ 'type' => 'text'
+ ],
+ ]
+ );
+
$this->add_control(
'items',
[
'label' => __( 'Items', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
-
-
- // TODO: finish video / text fields integration. Think about which fields can be used by both (image?)
- // TODO: refactor blade partials so same partial can be used by individual carousels + mixed carousel to output content (switch based on item type)
-
-
-
- [
- 'name' => 'type',
- 'label' => __('Slide Type', 'cube'),
- 'type' => Controls_Manager::SELECT,
- 'default' => '',
- 'options' => [
- '' => __('(Select)'),
- 'video' => __( 'Video', 'cube' ),
- 'text' => __( 'Text', 'cube' ),
- ],
- ],
-
-
- [
- 'name' => 'image',
- 'label' => __('Image', 'cube'),
- 'label_block' => true,
- 'type' => Controls_Manager::MEDIA,
- 'default' => [
- 'url' => ElementorUtils::get_placeholder_image_src(),
- ],
- 'condition' => [
- 'type' => ['text', 'video']
- ],
- ],
-
- // Video URL only used for video slides
- [
- 'name' => 'url',
- 'label' => __( 'Video URL', 'cube' ),
- 'placeholder' => __( 'Enter YouTube link', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- 'condition' => [
- 'type' => 'video'
- ],
- ],
-
- [
- 'name' => 'title',
- 'label' => __( 'Title', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- 'default' => '',
- 'condition' => [
- 'type' => ['text', 'video']
- ],
- ],
- [
- 'name' => 'subtitle',
- 'label' => __( 'Subtitle', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- 'condition' => [
- 'type' => ['text', 'video']
- ],
- ],
-
- // Body field is only used for "text" slides
- [
- 'name' => 'body',
- 'label' => __('Body', 'cube'),
- 'type' => Controls_Manager::WYSIWYG,
- 'default' => '',
- 'dynamic' => [
- 'active' => false,
- ],
- 'condition' => [
- 'type' => 'text'
- ],
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ type == "text" ? \'<i class="eicon-text-align-left"></i>\' : "" }}} {{{ type == "video" ? \'<i class="eicon-video-camera"></i>\' : "" }}} {{{ title }}}',
]
);
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Utils;
+use Elementor\Repeater;
+use function App\asset_path;
+use function App\template;
class ProfileGrid extends Widget_Base {
*/
public function get_script_depends() {
- wp_register_script('lity', \App\asset_path('scripts/lity.js'), ['jquery'], null, true);
+ wp_register_script('lity', asset_path('scripts/lity.js'), ['jquery'], null, true);
+ wp_register_script('slick', asset_path('scripts/slick.js'), ['jquery'], null, true);
wp_register_script(
'cube-profile-grid',
- \App\asset_path('scripts/profile-grid.js'),
- ['jquery', 'lity'], // Dependencies
+ asset_path('scripts/profile-grid.js'),
+ ['jquery', 'lity', 'slick'], // Dependencies
null, // Version
true // In footer?
);
- // Use script already registered by Elementor so we don't have to include another copy of Slick
- return ['jquery-slick', 'cube-profile-grid'];
+ return ['cube-profile-grid'];
}
/**
* Register the widget controls.
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'image',
+ [
+ 'label' => __('Image', 'cube'),
+ 'label_block' => true,
+ 'type' => Controls_Manager::MEDIA,
+ 'default' => [
+ 'url' => Utils::get_placeholder_image_src(),
+ ],
+ ]
+ );
+
+ $repeater->add_control(
+ 'title',
+ [
+ 'label' => __( 'Title', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'subtitle',
+ [
+ 'label' => __( 'Subtitle', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ ]
+ );
+
+ $repeater->add_control(
+ 'body',
+ [
+ 'label' => __('Body', 'cube'),
+ 'type' => Controls_Manager::WYSIWYG,
+ 'default' => '',
+ 'dynamic' => [
+ 'active' => false,
+ ],
+ ]
+ );
+
+ $repeater->add_control(
+ 'cta_text',
+ [
+ 'label' => __('Call to Action text', 'cube'),
+ 'type' => Controls_Manager::TEXT,
+ 'default' => ''
+ ]
+ );
+
+ $repeater->add_control(
+ 'cta_link',
+ [
+ 'label' => __('Call to Action link', 'cube'),
+ 'type' => Controls_Manager::URL,
+ 'default' => [
+ 'url' => '',
+ 'is_external' => false,
+ ],
+ 'show_external' => true
+ ]
+ );
+
$this->add_control(
'items',
[
'label' => __( 'Items', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'image',
- 'label' => __('Image', 'cube'),
- 'label_block' => true,
- 'type' => Controls_Manager::MEDIA,
- 'default' => [
- 'url' => Utils::get_placeholder_image_src(),
- ],
- ],
- [
- 'name' => 'title',
- 'label' => __( 'Title', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- 'default' => '',
- ],
- [
- 'name' => 'subtitle',
- 'label' => __( 'Subtitle', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- ],
- [
- 'name' => 'body',
- 'label' => __('Body', 'cube'),
- 'type' => Controls_Manager::WYSIWYG,
- 'default' => '',
- 'dynamic' => [
- 'active' => false,
- ],
- ],
- [
- 'name' => 'cta_text',
- 'label' => __('Call to Action text', 'cube'),
- 'type' => Controls_Manager::TEXT,
- 'default' => ''
- ],
- [
- 'name' => 'cta_link',
- 'label' => __('Call to Action link', 'cube'),
- 'type' => Controls_Manager::URL,
- 'default' => [
- 'url' => '',
- 'is_external' => false,
- ],
- 'show_external' => true
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
$truncate_lines = $this->get_settings('truncate_lines');
if ($display_type == 'carousel') {
- echo \App\template('widgets/profile-carousel', compact('items', 'ID'));
+ echo template('widgets/profile-carousel', compact('items', 'ID'));
} else {
- echo \App\template('widgets/profile-grid', compact('items', 'truncate_lines'));
+ echo template('widgets/profile-grid', compact('items', 'truncate_lines'));
}
}
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Utils;
+use Elementor\Repeater;
+
+use function App\asset_path;
+use function App\template;
class ResourceGrid extends Widget_Base {
*/
public function get_script_depends() {
+ wp_register_script('slick', asset_path('scripts/slick.js'), ['jquery'], null, true);
+
wp_register_script(
'cube-resource-carousel',
- \App\asset_path('scripts/resource-carousel.js'),
- ['jquery'], // Dependencies
+ asset_path('scripts/resource-carousel.js'),
+ ['jquery', 'slick'], // Dependencies
null, // Version
true // In footer?
);
// Use script already registered by Elementor so we don't have to include another copy of Slick
- return [ 'jquery-slick', 'cube-resource-carousel' ];
+ return ['cube-resource-carousel'];
}
/**
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'image',
+ [
+ 'label' => __('Preview Image', 'cube'),
+ 'label_block' => true,
+ 'type' => Controls_Manager::MEDIA,
+ 'default' => [
+ 'url' => Utils::get_placeholder_image_src(),
+ ],
+ ]
+ );
+
+ $repeater->add_control(
+ 'title',
+ [
+ 'label' => __( 'Title', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'interactive_version',
+ [
+ 'label' => __( 'Interactive version link', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ ]
+ );
+
+ $repeater->add_control(
+ 'pdf',
+ [
+ 'type' => 'file-select', // Using the file-select-control-for-elementor plugin
+ 'label' => __( 'PDF link', 'cube' ),
+ 'label_block' => true,
+ 'placeholder' => __('PDF URL', 'cube'),
+ ]
+ );
+
$this->add_control(
'items',
[
'label' => __( 'Items', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'image',
- 'label' => __('Preview Image', 'cube'),
- 'label_block' => true,
- 'type' => Controls_Manager::MEDIA,
- 'default' => [
- 'url' => Utils::get_placeholder_image_src(),
- ],
- ],
- [
- 'name' => 'title',
- 'label' => __( 'Title', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- 'default' => '',
- ],
-
- // Todo: revisit this to see if we can have a more user-friendly file control
- // See: https://github.com/pojome/elementor/issues/4468
- // See also: https://github.com/elementor/elementor/issues/1573#issuecomment-561405541
- // A searchable URL field might be enough but the text control isn't compatible with the
- // data structure of the URL control so that would need to be handled or transitioned
- [
- 'name' => 'interactive_version',
- 'label' => __( 'Interactive version link', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- ],
- [
- 'name' => 'pdf',
- 'label' => __( 'PDF link', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
+
$this->end_controls_section();
}
/**
$items = $this->get_settings('items');
if ($display_type == 'carousel') {
- echo \App\template('widgets/resource-carousel', compact('items'));
+ echo template('widgets/resource-carousel', compact('items'));
} else {
- echo \App\template('widgets/resource-grid', compact('items'));
+ echo template('widgets/resource-grid', compact('items'));
}
}
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
namespace PhysioAssist\Elementor\Widgets;
+use Elementor\Repeater;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Scheme_Color;
+use function App\asset_path;
+use function App\template;
class TextCarousel extends Widget_Base {
*/
public function get_script_depends() {
+ wp_register_script('slick', asset_path('scripts/slick.js'), ['jquery'], null, true);
+
wp_register_script(
'cube-text-carousel',
- \App\asset_path('scripts/text-carousel.js'),
- ['jquery'], // Dependencies
+ asset_path('scripts/text-carousel.js'),
+ ['jquery', 'slick'], // Dependencies
null, // Version
true // In footer?
);
// Use script already registered by Elementor so we don't have to include another copy of Slick
- return ['jquery-slick', 'cube-text-carousel'];
+ return ['cube-text-carousel'];
}
/**
* Register the widget controls.
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'title',
+ [
+ 'label' => __( 'Title', 'elementor' ),
+ 'type' => Controls_Manager::TEXT,
+ 'placeholder' => __( 'Enter your title', 'elementor' ),
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'subtitle',
+ [
+ 'label' => __( 'Subtitle', 'cube' ),
+ 'type' => Controls_Manager::TEXTAREA,
+ 'label_block' => true,
+ ]
+ );
+
+ $repeater->add_control(
+ 'body',
+ [
+ 'label' => __('Body', 'cube'),
+ 'type' => Controls_Manager::WYSIWYG,
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'cta_text',
+ [
+ 'label' => __('Call to Action text', 'cube'),
+ 'type' => Controls_Manager::TEXT,
+ 'default' => ''
+ ]
+ );
+
+ $repeater->add_control(
+ 'cta_link',
+ [
+ 'label' => __('Call to Action link', 'cube'),
+ 'type' => Controls_Manager::URL,
+ 'default' => [
+ 'url' => '',
+ 'is_external' => false,
+ ],
+ 'show_external' => true
+ ]
+ );
+
$this->add_control(
'items',
[
'label' => __( 'Items', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'title',
- 'label' => __( 'Title', 'elementor' ),
- 'type' => Controls_Manager::TEXT,
- 'placeholder' => __( 'Enter your title', 'elementor' ),
- 'default' => '',
- ],
- [
- 'name' => 'subtitle',
- 'label' => __( 'Subtitle', 'cube' ),
- 'type' => Controls_Manager::TEXTAREA,
- 'label_block' => true,
- ],
- [
- 'name' => 'body',
- 'label' => __('Body', 'cube'),
- 'type' => Controls_Manager::WYSIWYG,
- 'default' => '',
- ],
- [
- 'name' => 'cta_text',
- 'label' => __('Call to Action text', 'cube'),
- 'type' => Controls_Manager::TEXT,
- 'default' => ''
- ],
- [
- 'name' => 'cta_link',
- 'label' => __('Call to Action link', 'cube'),
- 'type' => Controls_Manager::URL,
- 'default' => [
- 'url' => '',
- 'is_external' => false,
- ],
- 'show_external' => true
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
$items = $this->get_settings('items');
- echo \App\template('widgets/text-carousel', compact('items'));
+ echo template('widgets/text-carousel', compact('items'));
}
}
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
+use Elementor\Repeater;
use Elementor\Utils as ElementorUtils;
use Elementor\Embed;
use PhysioAssist\Elementor\Utils;
+use function App\asset_path;
use function App\template;
class VideoGallery extends Widget_Base {
*/
public function get_script_depends() {
+ wp_register_script('slick', asset_path('scripts/slick.js'), ['jquery'], null, true);
+
wp_register_script(
'cube-video-carousel',
- \App\asset_path('scripts/video-carousel.js'),
- ['jquery'], // Dependencies
+ asset_path('scripts/video-carousel.js'),
+ ['jquery', 'slick'], // Dependencies
null, // Version
true // In footer?
);
- // Use script already registered by Elementor so we don't have to include another copy of Slick
- return [ 'jquery-slick', 'cube-video-carousel' ];
+ return ['cube-video-carousel'];
}
/**
* Register the widget controls.
* @since 1.0.0
* @access protected
*/
- protected function _register_controls() {
+ protected function register_controls() {
$this->start_controls_section(
'section_content',
]
);
+ $repeater = new Repeater();
+
+ $repeater->add_control(
+ 'url',
+ [
+ 'label' => __( 'Video URL', 'cube' ),
+ 'placeholder' => __( 'Enter YouTube link', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ ]
+ );
+
+ $repeater->add_control(
+ 'title',
+ [
+ 'label' => __( 'Title', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ 'default' => '',
+ ]
+ );
+
+ $repeater->add_control(
+ 'details',
+ [
+ 'label' => __( 'Additional Details', 'cube' ),
+ 'placeholder' => __( 'Extra information for slider view', 'cube' ),
+ 'type' => Controls_Manager::TEXT,
+ 'label_block' => true,
+ ]
+ );
+
+ $repeater->add_control(
+ 'image',
+ [
+ 'label' => __('Preview Image (optional)', 'cube'),
+ 'label_block' => true,
+ 'type' => Controls_Manager::MEDIA,
+ 'default' => [
+ 'url' => ElementorUtils::get_placeholder_image_src(),
+ ],
+ ]
+ );
+
$this->add_control(
'videos',
[
'label' => __( 'Videos', 'cube' ),
'type' => Controls_Manager::REPEATER,
- 'fields' => [
- [
- 'name' => 'url',
- 'label' => __( 'Video URL', 'cube' ),
- 'placeholder' => __( 'Enter YouTube link', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- ],
- [
- 'name' => 'title',
- 'label' => __( 'Title', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- 'default' => '',
- ],
- [
- 'name' => 'details',
- 'label' => __( 'Additional Details', 'cube' ),
- 'placeholder' => __( 'Extra information for slider view', 'cube' ),
- 'type' => Controls_Manager::TEXT,
- 'label_block' => true,
- ],
- [
- 'name' => 'image',
- 'label' => __('Preview Image (optional)', 'cube'),
- 'label_block' => true,
- 'type' => Controls_Manager::MEDIA,
- 'default' => [
- 'url' => ElementorUtils::get_placeholder_image_src(),
- ],
- ],
- ],
+ 'fields' => $repeater->get_controls(),
'title_field' => '{{{ title }}}',
]
);
--- /dev/null
+# Elementor File Select Control
+Adds a new control for Elementor page builder which allows you to choose any kind of file from WordPress Media Library. Its Created for developers to take the code and use in your own project.
+
+Additionally this plugin comes with an Elementor Widget just to demonstrate how to integrate manily but that let's you create simple links to Media Files.
+
+## How To Use ?
+Please find detailed instructions on the following blog post on my blog: https://abdulawal.com/elementor-file-select-control
+
+## Notes
+As its a standalone plugin itself, you can actually just install this plugin on your site and use the control & widget that comes with this plugin if you're working on a website instead of a Theme or Plugin project. I'll try to put this on WordPress Repository as well, Will update the link here when its uploaded there.
+
+## Need Support ?
+Please feel free to use the comment section of my blog or issues section here on github or Twitter <a href="https://twitter.com/abdulawaluzzal">@abdulawaluzzal</a>
--- /dev/null
+<?php
+/**
+ * FileSelect control.
+ *
+ * A control for selecting any type of files.
+ *
+ * @since 1.0.0
+ */
+class FileSelect_Control extends \Elementor\Base_Data_Control {
+
+ /**
+ * Get control type.
+ *
+ * Retrieve the control type, in this case `FILESELECT`.
+ *
+ * @since 1.0.0
+ * @access public
+ *
+ * @return string Control type.
+ */
+ public function get_type() {
+ return 'file-select';
+ }
+
+ /**
+ * Enqueue control scripts and styles.
+ *
+ * Used to register and enqueue custom scripts and styles
+ * for this control.
+ *
+ * @since 1.0.0
+ * @access public
+ */
+ public function enqueue() {
+ wp_enqueue_media();
+ wp_enqueue_style('thickbox');
+ wp_enqueue_script('media-upload');
+ wp_enqueue_script('thickbox');
+ // Scripts
+ wp_register_script( 'fileselect-control', plugins_url( '/js/fileselect-control.js', __FILE__ ), [ 'jquery' ], '1.0.0', true );
+ wp_enqueue_script( 'fileselect-control' );
+ }
+
+ /**
+ * Get default settings.
+ *
+ * @since 1.0.0
+ * @access protected
+ *
+ * @return array Control default settings.
+ */
+ protected function get_default_settings() {
+ return [
+ 'label_block' => true,
+ ];
+ }
+
+ /**
+ * Render control output in the editor.
+ *
+ * @since 1.0.0
+ * @access public
+ */
+ public function content_template() {
+ $control_uid = $this->get_control_uid();
+ ?>
+ <div class="elementor-control-field">
+ <label for="<?php echo esc_attr( $control_uid ); ?>" class="elementor-control-title">{{{ data.label }}}</label>
+ <div class="elementor-control-input-wrapper">
+ <a href="#" class="tnc-select-file elementor-button elementor-button-success" style="padding: 10px 15px; display: block;text-align: center;" id="select-file-<?php echo esc_attr( $control_uid ); ?>" ><?php echo esc_html__( "Choose / Upload File", 'file-select-control-for-elementor' ); ?></a> <br />
+
+ <input type="text" class="tnc-selected-fle-url" id="<?php echo esc_attr( $control_uid ); ?>" data-setting="{{ data.name }}" placeholder="{{ data.placeholder }}">
+ </div>
+ </div>
+ <# if ( data.description ) { #>
+ <div class="elementor-control-field-description">{{{ data.description }}}</div>
+ <# } #>
+ <?php
+ }
+}
\ No newline at end of file
--- /dev/null
+var fileselectItemView = elementor.modules.controls.BaseData.extend({
+
+ onReady: function () {
+
+ var file_input_id = this.$el.find( '.tnc-selected-fle-url' ).attr('id');
+
+ this.$el.find( '.tnc-select-file' ).click( function() {
+ var tnc_file_uploader = wp.media({
+ title: 'Upload File',
+ button: {
+ text: 'Get Link'
+ },
+ multiple: false
+ })
+ .on('select', function() {
+ var attachment = tnc_file_uploader.state().get('selection').first().toJSON();
+ jQuery( "#" + file_input_id ).val( attachment.url );
+ jQuery( "#" + file_input_id ).trigger( "input" );
+ })
+ .open();
+ } );
+ },
+});
+
+elementor.addControlView('file-select', fileselectItemView);
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Plugin Name: File Select Control for Elementor
+ * Description: This addon adds a new control file-select to use in your widgets. Specially for developers.
+ * Plugin URI: https://abdulawal.com/elementor-file-select-control/
+ * Version: 1.2
+ * Author: ThemeNcode
+ * Author URI: https://themencode.com/
+ * Text Domain: file-select-control-for-elementor
+ * License: GPLv2 (or later)
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Main File Select Control for Elementor Class
+ *
+ * The main class that initiates and runs the plugin.
+ *
+ * @since 1.0.0
+ */
+final class Elementor_File_Select_Control_Addon {
+
+ /**
+ * Plugin Version
+ *
+ * @since 1.0.0
+ *
+ * @var string The plugin version.
+ */
+ const VERSION = '1.2';
+
+ /**
+ * Minimum Elementor Version
+ *
+ * @since 1.0.0
+ *
+ * @var string Minimum Elementor version required to run the plugin.
+ */
+ const MINIMUM_ELEMENTOR_VERSION = '2.0.0';
+
+ /**
+ * Minimum PHP Version
+ *
+ * @since 1.0.0
+ *
+ * @var string Minimum PHP version required to run the plugin.
+ */
+ const MINIMUM_PHP_VERSION = '7.0';
+
+ /**
+ * Instance
+ *
+ * @since 1.0.0
+ *
+ * @access private
+ * @static
+ *
+ * @var Elementor_File_Select_Control_Addon The single instance of the class.
+ */
+ private static $_instance = null;
+
+ /**
+ * Instance
+ *
+ * Ensures only one instance of the class is loaded or can be loaded.
+ *
+ * @since 1.0.0
+ *
+ * @access public
+ * @static
+ *
+ * @return Elementor_File_Select_Control_Addon An instance of the class.
+ */
+ public static function instance() {
+
+ if ( is_null( self::$_instance ) ) {
+ self::$_instance = new self();
+ }
+ return self::$_instance;
+
+ }
+
+ /**
+ * Constructor
+ *
+ * @since 1.0.0
+ *
+ * @access public
+ */
+ public function __construct() {
+
+ add_action( 'init', [ $this, 'i18n' ] );
+ add_action( 'plugins_loaded', [ $this, 'init' ] );
+
+ }
+
+ /**
+ * Load Textdomain
+ *
+ * Load plugin localization files.
+ *
+ * Fired by `init` action hook.
+ *
+ * @since 1.0.0
+ *
+ * @access public
+ */
+ public function i18n() {
+
+ load_plugin_textdomain( 'file-select-control-for-elementor' );
+
+ }
+
+ /**
+ * Initialize the plugin
+ *
+ * Load the plugin only after Elementor (and other plugins) are loaded.
+ * Checks for basic plugin requirements, if one check fail don't continue,
+ * if all check have passed load the files required to run the plugin.
+ *
+ * Fired by `plugins_loaded` action hook.
+ *
+ * @since 1.0.0
+ *
+ * @access public
+ */
+ public function init() {
+
+ // Check if Elementor installed and activated
+ if ( ! did_action( 'elementor/loaded' ) ) {
+ add_action( 'admin_notices', [ $this, 'admin_notice_missing_main_plugin' ] );
+ return;
+ }
+
+ // Check for required Elementor version
+ if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) {
+ add_action( 'admin_notices', [ $this, 'admin_notice_minimum_elementor_version' ] );
+ return;
+ }
+
+ // Check for required PHP version
+ if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
+ add_action( 'admin_notices', [ $this, 'admin_notice_minimum_php_version' ] );
+ return;
+ }
+
+ // Add Plugin actions
+ add_action( 'elementor/controls/controls_registered', [ $this, 'init_controls' ] );
+ add_action( 'elementor/widgets/widgets_registered', [ $this, 'init_widgets' ] );
+ }
+
+ /**
+ * Admin notice
+ *
+ * Warning when the site doesn't have Elementor installed or activated.
+ *
+ * @since 1.0.0
+ *
+ * @access public
+ */
+ public function admin_notice_missing_main_plugin() {
+
+ if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );
+
+ $message = sprintf(
+ /* translators: 1: Plugin name 2: Elementor */
+ esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'file-select-control-for-elementor' ),
+ '<strong>' . esc_html__( 'File Select Control for Elementor', 'file-select-control-for-elementor' ) . '</strong>',
+ '<strong>' . esc_html__( 'Elementor', 'file-select-control-for-elementor' ) . '</strong>'
+ );
+
+ printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
+
+ }
+
+ /**
+ * Admin notice
+ *
+ * Warning when the site doesn't have a minimum required Elementor version.
+ *
+ * @since 1.0.0
+ *
+ * @access public
+ */
+ public function admin_notice_minimum_elementor_version() {
+
+ if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );
+
+ $message = sprintf(
+ /* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */
+ esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'file-select-control-for-elementor' ),
+ '<strong>' . esc_html__( 'File Select Control for Elementor', 'file-select-control-for-elementor' ) . '</strong>',
+ '<strong>' . esc_html__( 'Elementor', 'file-select-control-for-elementor' ) . '</strong>',
+ self::MINIMUM_ELEMENTOR_VERSION
+ );
+
+ printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
+
+ }
+
+ /**
+ * Admin notice
+ *
+ * Warning when the site doesn't have a minimum required PHP version.
+ *
+ * @since 1.0.0
+ *
+ * @access public
+ */
+ public function admin_notice_minimum_php_version() {
+
+ if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );
+
+ $message = sprintf(
+ /* translators: 1: Plugin name 2: PHP 3: Required PHP version */
+ esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'file-select-control-for-elementor' ),
+ '<strong>' . esc_html__( 'File Select Control for Elementor', 'file-select-control-for-elementor' ) . '</strong>',
+ '<strong>' . esc_html__( 'PHP', 'file-select-control-for-elementor' ) . '</strong>',
+ self::MINIMUM_PHP_VERSION
+ );
+
+ printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );
+
+ }
+
+ /**
+ * Init Widgets
+ *
+ * Include widgets files and register them
+ *
+ * @since 1.0.0
+ *
+ * @access public
+ */
+ public function init_widgets() {
+
+ // Include Widget files
+ require_once( __DIR__ . '/widgets/file-link-widget.php' );
+
+ // Register widget
+ \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor_File_Link_Widget() );
+ }
+
+ /**
+ * Init Controls
+ *
+ * Include control files and register them
+ *
+ * @since 1.0.0
+ *
+ * @access public
+ */
+ public function init_controls() {
+
+ // Include Widget files
+ require_once( __DIR__ . '/controls/fileselect-control.php' );
+
+ // Register controls
+ \Elementor\Plugin::$instance->controls_manager->register_control( 'file-select', new \FileSelect_Control() );
+ }
+
+}
+
+Elementor_File_Select_Control_Addon::instance();
\ No newline at end of file
--- /dev/null
+# Copyright (C) 2020 ThemeNcode
+# This file is distributed under the same license as the File Select Control for Elementor plugin.
+msgid ""
+msgstr ""
+"Project-Id-Version: File Select Control for Elementor 1.0\n"
+"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/trunk\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"POT-Creation-Date: 2020-07-10T05:16:40+00:00\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"X-Generator: WP-CLI 2.4.0\n"
+"X-Domain: file-select-control-for-elementor\n"
+
+#. Plugin Name of the plugin
+#: file-select-control-for-elementor.php:171
+#: file-select-control-for-elementor.php:195
+#: file-select-control-for-elementor.php:220
+msgid "File Select Control for Elementor"
+msgstr ""
+
+#. Plugin URI of the plugin
+msgid "https://abdulawal.com/elementor-file-select-control/"
+msgstr ""
+
+#. Description of the plugin
+msgid "This addon adds a new control file-select to use in your widgets. Specially for developers."
+msgstr ""
+
+#. Author of the plugin
+msgid "ThemeNcode"
+msgstr ""
+
+#. Author URI of the plugin
+msgid "https://themencode.com/"
+msgstr ""
+
+#: controls/fileselect-control.php:70
+msgid "Choose / Upload File"
+msgstr ""
+
+#. translators: 1: Plugin name 2: Elementor
+#: file-select-control-for-elementor.php:170
+msgid "\"%1$s\" requires \"%2$s\" to be installed and activated."
+msgstr ""
+
+#: file-select-control-for-elementor.php:172
+#: file-select-control-for-elementor.php:196
+msgid "Elementor"
+msgstr ""
+
+#. translators: 1: Plugin name 2: Elementor 3: Required Elementor version
+#. translators: 1: Plugin name 2: PHP 3: Required PHP version
+#: file-select-control-for-elementor.php:194
+#: file-select-control-for-elementor.php:219
+msgid "\"%1$s\" requires \"%2$s\" version %3$s or greater."
+msgstr ""
+
+#: file-select-control-for-elementor.php:221
+msgid "PHP"
+msgstr ""
+
+#: widgets/file-link-widget.php:36
+msgid "File Link"
+msgstr ""
+
+#: widgets/file-link-widget.php:80
+msgid "Settings"
+msgstr ""
+
+#: widgets/file-link-widget.php:88
+msgid "Select File"
+msgstr ""
+
+#: widgets/file-link-widget.php:90
+msgid "URL to File"
+msgstr ""
+
+#: widgets/file-link-widget.php:91
+msgid "Select file from media library or upload"
+msgstr ""
+
+#: widgets/file-link-widget.php:98
+msgid "Link Text"
+msgstr ""
+
+#: widgets/file-link-widget.php:100
+msgid "Ex. Open File"
+msgstr ""
+
+#: widgets/file-link-widget.php:101
+msgid "Text that should be displayed as a link"
+msgstr ""
+
+#: widgets/file-link-widget.php:109
+msgid "Link Target"
+msgstr ""
+
+#: widgets/file-link-widget.php:112
+msgid "Same Tab"
+msgstr ""
+
+#: widgets/file-link-widget.php:113
+msgid "New Tab"
+msgstr ""
+
+#: widgets/file-link-widget.php:116
+#: widgets/file-link-widget.php:127
+msgid "CSS class to add to the link"
+msgstr ""
+
+#: widgets/file-link-widget.php:123
+msgid "Link CSS Class"
+msgstr ""
+
+#: widgets/file-link-widget.php:126
+msgid "Ex. file-link"
+msgstr ""
--- /dev/null
+=== File Select Control For Elementor ===
+Contributors: abdulawal39, ThemeNcode
+Donate link: http://go.abdulawal.com/donate
+Tags: elementor, media, file select, elementor control, elementor file link, elementor media extended
+Requires at least: 4.0
+Tested up to: 5.4.2
+Stable tag: 1.2
+Requires PHP: 7.0
+License: GPLv2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+
+A custom control to Allow choosing any type of files from WordPress Media Library. An extended version of MEDIA control.
+
+== Description ==
+
+This addon comes with a small widget that allows you to create a link to any media file of your media library as well as a new elementor control for to select any type of file from your media library.
+
+The main part of this plugin is the new file select control, you can use this in combination of this plugin for just integrate with your project by taking code from this plugin.
+
+This addon comes with a new elementor control called file-select which you can use in your widgets. Simply put file-select in the type parameter of add_control() while creating the widget.
+
+Please find more details on how to use and integrate this control here: <a href="https://abdulawal.com/elementor-file-select-control/">https://abdulawal.com/elementor-file-select-control/</a>
+
+<h3>Features :</h3>
+
+* Work with any type of file
+* Easy to use
+* Very Lightweight Plugin
+
+Please Don't Forget to leave a review if you find this plugin useful. <br />
+Thanks<br />
+
+== Installation ==
+
+Installing this plugin is pretty simple like all other wordpress plugins. Here are 2 ways to install :
+
+1. Manual Install
+
+* Download the zipped plugin from wordpress repository
+* Extract the zipped folder
+* Upload `file-select-control-for-elementor.zip` to the `/wp-content/plugins/` directory
+* Activate the plugin through the 'Plugins' menu in WordPress
+* Go to any page or post editor and you'll see the new widget called File Link or.
+
+2. Automatic Install
+
+* Go to Plugins-> Add New from your wordpress Dashboard
+* Search File Select Control for Elementor
+* From the results click on 'install now'
+* Activate the plugin through the 'Plugins' menu in WordPress
+* Go to any page or post editor and you'll see the new widget called File Link or.
+
+
+== Frequently Asked Questions ==
+
+** How Do I use the control ? **
+
+Please find more details of integration here: https://abdulawal.com/elementor-file-select-control/
+
+== Screenshots ==
+
+1. Editor View
+1. Adding control to widget
+
+== Changelog ==
+= 1.2 =
+* Updated Name of language pot file
+* Updated Text Domain
+
+= 1.1 =
+* Added Language file
+
+= 1.0 =
+* First Release.
+
+== Upgrade Notice ==
+
+none
\ No newline at end of file
--- /dev/null
+<?php
+/**
+ * Elementor Elementor_File_Link_Widget Widget.
+ *
+ * Elementor widget that inserts an embbedable content into the page, from any given URL.
+ *
+ * @since 1.0.0
+ */
+class Elementor_File_Link_Widget extends \Elementor\Widget_Base {
+
+ /**
+ * Get widget name.
+ *
+ * Retrieve Elementor_File_Link_Widget widget name.
+ *
+ * @since 1.0.0
+ * @access public
+ *
+ * @return string Widget name.
+ */
+ public function get_name() {
+ return 'file_link_shortcode';
+ }
+
+ /**
+ * Get widget title.
+ *
+ * Retrieve Elementor_File_Link_Widget widget title.
+ *
+ * @since 1.0.0
+ * @access public
+ *
+ * @return string Widget title.
+ */
+ public function get_title() {
+ return esc_html__( 'File Link', 'file-select-control-for-elementor' );
+ }
+
+ /**
+ * Get widget icon.
+ *
+ * Retrieve Elementor_File_Link_Widget widget icon.
+ *
+ * @since 1.0.0
+ * @access public
+ *
+ * @return string Widget icon.
+ */
+ public function get_icon() {
+ return 'fa fa-link';
+ }
+
+ /**
+ * Get widget categories.
+ *
+ * Retrieve the list of categories the Elementor_File_Link_Widget widget belongs to.
+ *
+ * @since 1.0.0
+ * @access public
+ *
+ * @return array Widget categories.
+ */
+ public function get_categories() {
+ return [ 'media' ];
+ }
+
+ /**
+ * Register Elementor_File_Link_Widget widget controls.
+ *
+ * Adds different input fields to allow the user to change and customize the widget settings.
+ *
+ * @since 1.0.0
+ * @access protected
+ */
+ protected function _register_controls() {
+
+ $this->start_controls_section(
+ 'settings_section',
+ [
+ 'label' => esc_html__( 'Settings', 'file-select-control-for-elementor' ),
+ 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
+ ]
+ );
+
+ $this->add_control(
+ 'file_link',
+ [
+ 'label' => esc_html__( 'Select File', 'file-select-control-for-elementor' ),
+ 'type' => 'file-select',
+ 'placeholder' => esc_html__( 'URL to File', 'file-select-control-for-elementor' ),
+ 'description' => esc_html__( 'Select file from media library or upload', 'file-select-control-for-elementor' ),
+ ]
+ );
+
+ $this->add_control(
+ 'link_text',
+ [
+ 'label' => esc_html__( 'Link Text', 'file-select-control-for-elementor' ),
+ 'type' => \Elementor\Controls_Manager::TEXT,
+ 'placeholder' => esc_html__( 'Ex. Open File', 'file-select-control-for-elementor' ),
+ 'description' => esc_html__( 'Text that should be displayed as a link', 'file-select-control-for-elementor' ),
+ 'default' => 'Open File',
+ ]
+ );
+
+ $this->add_control(
+ 'link_target',
+ [
+ 'label' => esc_html__( 'Link Target', 'file-select-control-for-elementor' ),
+ 'type' => \Elementor\Controls_Manager::SELECT,
+ 'options' => [
+ '_parent' => esc_html__( 'Same Tab', 'file-select-control-for-elementor' ),
+ '_blank' => esc_html__( 'New Tab', 'file-select-control-for-elementor' ),
+ ],
+ 'default' => '_parent',
+ 'description' => esc_html__( 'CSS class to add to the link', 'file-select-control-for-elementor' ),
+ ]
+ );
+
+ $this->add_control(
+ 'link_css_class',
+ [
+ 'label' => esc_html__( 'Link CSS Class', 'file-select-control-for-elementor' ),
+ 'type' => \Elementor\Controls_Manager::TEXT,
+ 'input_type' => 'text',
+ 'placeholder' => esc_html__( 'Ex. file-link', 'file-select-control-for-elementor' ),
+ 'description' => esc_html__( 'CSS class to add to the link', 'file-select-control-for-elementor' ),
+ ]
+ );
+
+ $this->end_controls_section();
+
+ }
+
+ /**
+ * Render Elementor_File_Link_Widget widget output on the frontend.
+ *
+ * Written in PHP and used to generate the final HTML.
+ *
+ * @since 1.0.0
+ * @access protected
+ */
+ protected function render() {
+
+ $settings = $this->get_settings_for_display();
+
+ echo '<a href="' . $settings['file_link'] . '" target="' . $settings['link_target'] . '" class="' . $settings['link_css_class'] . '" >' . $settings['link_text'] . '</a>';
+ }
+}
\ No newline at end of file
"rimraf": "~2.6",
"rupture": "^0.7.1",
"sass-loader": "~6.0",
+ "slick-carousel": "^1.8.1",
"style-loader": "^0.20.1",
"stylelint": "^8.4.0",
"stylelint-config-standard": "~18.0.0",
"lity": [
"./scripts/lity.js"
],
+ "slick": [
+ "./scripts/slick.js"
+ ],
"cookie-notice": [
"./scripts/cookie-notice.js"
],
--- /dev/null
+// Create a local copy of Slick Carousel. Maybe this could be copied directly to /dist/scripts on build instead?
+import slick from 'slick-carousel'; // eslint-disable-line
dependencies:
is-fullwidth-code-point "^2.0.0"
+slick-carousel@^1.8.1:
+ version "1.8.1"
+ resolved "https://registry.yarnpkg.com/slick-carousel/-/slick-carousel-1.8.1.tgz#a4bfb29014887bb66ce528b90bd0cda262cc8f8d"
+ integrity sha512-XB9Ftrf2EEKfzoQXt3Nitrt/IPbT+f1fgqBdoxO3W/+JYvtEOW6EgxnWfr9GH6nmULv7Y2tPmEX3koxThVmebA==
+
snapdragon-node@^2.0.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b"