bainternet
12/7/2017 - 12:29 PM

elementor-element-widget-starter-code.php

<?php

use Elementor\Plugin;
use Elementor\Widget_Base;

class Shapla_Hero_Slider extends Widget_Base {

	/**
	 * Retrieve the name.
	 *
	 * @return string The name.
	 */
	public function get_name() {
		return 'hero-slider';
	}

	/**
	 * Retrieve element title.
	 *
	 * @return string Element title.
	 */
	public function get_title() {
		return __( 'Hero Slider', 'text_domain' );
	}

	/**
	 * Retrieve element icon.
	 *
	 * @return string Element icon.
	 */
	public function get_icon() {
		return 'eicon-slideshow';
	}

	/**
	 * Retrieve widget categories.
	 *
	 * @return array Widget categories.
	 */
	public function get_categories() {
		return [ 'shapla-elements' ];
	}

	/**
	 * Retrieve script dependencies.
	 * Get the list of script dependencies the element requires.
	 *
	 * @return array Widget scripts dependencies.
	 */
	public function get_script_depends() {
		return [ 'shapla-elementor' ];
	}

	/**
	 * Register controls.
	 *
	 * Used to add new controls to any element type. For example, external
	 * developers use this method to register controls in a widget.
	 *
	 * Should be inherited and register new controls using `add_control()`,
	 * `add_responsive_control()` and `add_group_control()`, inside control
	 * wrappers like `start_controls_section()`, `start_controls_tabs()` and
	 * `start_controls_tab()`.
	 */
	protected function _register_controls() {

	}

	/**
	 * Render element.
	 * Generates the final HTML on the frontend.
	 */
	protected function render() {

	}

	/**
	 * Render element output in the editor.
	 * Used to generate the live preview, using a Backbone JavaScript template.
	 */
	protected function _content_template() {

	}
}

Plugin::instance()->widgets_manager->register_widget_type( new Shapla_Hero_Slider() );