PluginProbe
WP Directory Kit / 1.4.8
WP Directory Kit v1.4.8
1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 1.4.0 1.4.1 All 35 releases
wpdirectorykit / elementor-elements / classes / wdk-button-share.php

wdk-button-share.php in WP Directory Kit 1.4.8, at elementor-elements/classes/wdk-button-share.php

277 lines 7.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Wdk\Elementor\Widgets;
4
5 use Wdk\Elementor\Widgets\WdkElementorBase;
6 use Elementor\Widget_Base;
7 use Elementor\Controls_Manager;
8 use Elementor\Utils;
9 use Elementor\Typography;
10 use Elementor\Editor;
11 use Elementor\Plugin;
12 use Elementor\Repeater;
13 use Elementor\Core\Schemes;
14 use Elementor\Icons_Manager;
15 use Elementor\Group_Control_Typography;
16 use Elementor\Group_Control_Border;
17 use Elementor\Group_Control_Box_Shadow;
18
19 if (!defined('ABSPATH'))
20 exit; // Exit if accessed directly
21
22 /**
23 * @since 1.1.0
24 */
25 class WdkButtonShare extends WdkElementorBase {
26
27 public $field_id = NULL;
28 public $fields_list = array();
29
30 public function __construct($data = array(), $args = null) {
31
32 \Elementor\Controls_Manager::add_tab(
33 'tab_conf',
34 esc_html__('Settings', 'wpdirectorykit')
35 );
36
37 \Elementor\Controls_Manager::add_tab(
38 'tab_layout',
39 esc_html__('Layout', 'wpdirectorykit')
40 );
41
42 \Elementor\Controls_Manager::add_tab(
43 'tab_content',
44 esc_html__('Main', 'wpdirectorykit')
45 );
46
47
48 if ($this->is_edit_mode_load()) {
49 $this->enqueue_styles_scripts();
50 }
51
52 parent::__construct($data, $args);
53
54 }
55
56
57 /**
58 * Retrieve the widget name.
59 *
60 * @since 1.1.0
61 *
62 * @access public
63 *
64 * @return string Widget name.
65 */
66 public function get_name() {
67 return 'wdk-button-share';
68 }
69
70 /**
71 * Retrieve the widget title.
72 *
73 * @since 1.1.0
74 *
75 * @access public
76 *
77 * @return string Widget title.
78 */
79 public function get_title() {
80 return esc_html__('Wdk Button Share', 'wpdirectorykit');
81 }
82
83 /**
84 * Retrieve the widget icon.
85 *
86 * @since 1.1.0
87 *
88 * @access public
89 *
90 * @return string Widget icon.
91 */
92 public function get_icon() {
93 return 'eicon-share';
94 }
95
96 /**
97 * Register the widget controls.
98 *
99 * Adds different input fields to allow the user to change and customize the widget settings.
100 *
101 * @since 1.1.0
102 *
103 * @access protected
104 */
105 protected function register_controls() {
106 $this->generate_controls_conf();
107 $this->generate_controls_layout();
108 $this->generate_controls_styles();
109 $this->generate_controls_content();
110
111 $this->insert_pro_message('1');
112 parent::register_controls();
113 }
114
115 /**
116 * Render the widget output on the frontend.
117 *
118 * Written in PHP and used to generate the final HTML.
119 *
120 * @since 1.1.0
121 *
122 * @access protected
123 */
124 protected function render() {
125 parent::render();
126
127 $this->data['id_element'] = $this->get_id();
128 $this->data['settings'] = $this->get_settings();
129 $this->data['link_url'] = wdk_current_url();
130
131 if(!empty($this->data['settings']['link_url']))
132 $this->data['link_url'] = $this->data['settings']['link_url'];
133
134 $this->data['is_edit_mode']= false;
135 if(Plugin::$instance->editor->is_edit_mode()){
136 $this->data['is_edit_mode']= true;
137 }
138
139 echo $this->view('wdk-button-share', $this->data);
140 }
141
142
143 private function generate_controls_conf() {
144 $this->start_controls_section(
145 'tab_conf_main_section',
146 [
147 'label' => esc_html__('Main', 'wpdirectorykit'),
148 'tab' => '1',
149 ]
150 );
151
152 $this->add_control(
153 'link_text',
154 [
155 'label' => __('Text Link', 'wpdirectorykit'),
156 'type' => \Elementor\Controls_Manager::TEXT,
157 'default' => __('Share', 'wpdirectorykit'),
158 'separator' => 'before',
159 ]
160 );
161
162 $this->add_control(
163 'link_url',
164 [
165 'label' => __('Link Url', 'wpdirectorykit'),
166 'type' => \Elementor\Controls_Manager::TEXT,
167 'default' => '#',
168 ]
169 );
170
171 $this->add_control(
172 'link_id',
173 [
174 'label' => __('Special attr id for link', 'wpdirectorykit'),
175 'type' => \Elementor\Controls_Manager::TEXT,
176 'default' => '',
177 ]
178 );
179
180 $this->add_control(
181 'link_icon',
182 [
183 'label' => esc_html__('Icon', 'wpdirectorykit'),
184 'type' => Controls_Manager::ICONS,
185 'label_block' => true,
186 'default' => [
187 'value' => 'fa fa-home',
188 'library' => 'solid',
189 ],
190 ]
191 );
192
193 $this->add_control(
194 'link_icon_position',
195 [
196 'label' => esc_html__('icon Position', 'wpdirectorykit'),
197 'type' => Controls_Manager::SELECT,
198 'options' => [
199 'left' => esc_html__('Left', 'wpdirectorykit'),
200 'right' => esc_html__('Right', 'wpdirectorykit'),
201 ],
202 'default' => 'left',
203 ]
204 );
205 $this->end_controls_section();
206 }
207
208 private function generate_controls_layout() {
209
210 }
211
212 private function generate_controls_styles() {
213 $items = [
214 [
215 'key'=>'btn',
216 'label'=> esc_html__('Button', 'wpdirectorykit'),
217 'options'=>'full',
218 ]
219 ];
220
221 foreach ($items as $item) {
222 $this->start_controls_section(
223 $item['key'].'_section',
224 [
225 'label' => $item['label'],
226 'tab' => 'tab_layout'
227 ]
228 );
229
230 $selectors = array(
231 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button',
232 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button%1$s'
233 );
234 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
235
236 $this->end_controls_section();
237 /* END special for some elements */
238 }
239
240 $items = [
241 [
242 'key'=>'icon',
243 'label'=> esc_html__('Icon', 'wpdirectorykit'),
244 'options'=>'full',
245 ]
246 ];
247
248 foreach ($items as $item) {
249 $this->start_controls_section(
250 $item['key'].'_section',
251 [
252 'label' => $item['label'],
253 'tab' => 'tab_layout'
254 ]
255 );
256
257 $selectors = array(
258 'normal' => '{{WRAPPER}} .wdk-element .wdk-element-button i,{{WRAPPER}} .wdk-element .wdk-element-button svg',
259 'hover'=>'{{WRAPPER}} .wdk-element .wdk-element-button%1$s i,{{WRAPPER}} .wdk-element .wdk-element-button%1$s svg'
260 );
261 $this->generate_renders_tabs($selectors, $item['key'].'_dynamic', $item['options']);
262
263 $this->end_controls_section();
264 /* END special for some elements */
265 }
266 }
267
268
269 private function generate_controls_content() {
270
271 }
272
273 public function enqueue_styles_scripts() {
274 wp_enqueue_style('wdk-element-button');
275 }
276 }
277