Advertisement
salmancreation

my capabilites widgets

Apr 25th, 2019
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.75 KB | None | 0 0
  1. <?php
  2. namespace FilixCore\Widgets;
  3.  
  4. use Elementor\Widget_Base;
  5. use Elementor\Controls_Manager;
  6. use Elementor\Scheme_Color;
  7. use Elementor\Scheme_Typography;
  8. use Elementor\Group_Control_Typography;
  9.  
  10.  
  11.  
  12. // Exit if accessed directly
  13. if ( ! defined( 'ABSPATH' ) ) {
  14. exit;
  15. }
  16.  
  17.  
  18. /**
  19. * Text Typing Effect
  20. *
  21. * Elementor widget for text typing effect.
  22. *
  23. * @since 1.7.0
  24. */
  25. class Filix_capabilities extends Widget_Base {
  26.  
  27. public function get_name() {
  28. return 'Filix_capabilities_sec';
  29. }
  30.  
  31. public function get_title() {
  32. return esc_html__( 'Capabilites', 'filix-core' );
  33. }
  34.  
  35. public function get_icon() {
  36. return 'eicon-post-content';
  37. }
  38.  
  39. public function get_keywords() {
  40. return [ 'capabilities', 'my', 'filix' ];
  41. }
  42.  
  43. public function get_categories() {
  44. return [ 'filix-elements' ];
  45. }
  46.  
  47. public function get_style_depends() {
  48. return ['animated-headline'];
  49. }
  50.  
  51. public function get_script_depends() {
  52. return ['animated-headline'];
  53. }
  54.  
  55. protected function _register_controls() {
  56.  
  57. // ---------------------------------------- Title Section ------------------------------------//
  58. $this->start_controls_section(
  59. 'capa_section',
  60. [
  61. 'label' => esc_html__( 'Capabilities Section', 'filix-core' ),
  62. ]
  63. );
  64.  
  65. $this->add_control(
  66. 'capa_section_title',
  67. [
  68. 'label' => esc_html__( 'Title Text', 'filix-core' ),
  69. 'type' => Controls_Manager::TEXT,
  70. 'label_block' => true,
  71. 'default' => 'My Capabilities',
  72. ]
  73. );
  74.  
  75. $this->add_control(
  76. 'capa_animate_title',
  77. [
  78. 'label' => esc_html__( 'Section Animate Ttitle', 'filix-core' ),
  79. 'type' => Controls_Manager::TEXT,
  80. 'label_block' => true,
  81. 'default' => 'Capabilities',
  82. ]
  83. );
  84.  
  85. $this->end_controls_section();
  86.  
  87. /**
  88. * Capabilities Tab
  89. * ------------------------------ Capabilities Tab List Item ------------------------------
  90. */
  91. $this->start_controls_section(
  92. 'capa_tab_section',
  93. [
  94. 'label' => esc_html__( 'Capabilities Tab List', 'filix-core' ),
  95. ]
  96. );
  97.  
  98. $repeater = new \Elementor\Repeater();
  99.  
  100. $repeater->add_control(
  101. 'tab_li_title', [
  102. 'label' => esc_html__( 'Tab Item Title', 'filix-core' ),
  103. 'type' =>Controls_Manager::TEXT,
  104. 'label_block' => true,
  105. 'default' => 'UI/UX Design',
  106. ]
  107. );
  108.  
  109. $repeater->add_control(
  110. 'nab_tab_li_id',
  111. [
  112. 'label' => esc_html__('Tab ID Link', 'filix-core'),
  113. 'type' => Controls_Manager::TEXT,
  114. 'label_block' => true,
  115. 'default' => 'Enter Tab Content ID',
  116. ]
  117. );
  118.  
  119. $this->add_control(
  120. 'capabiliti_tab',
  121. [
  122. 'label' => esc_html__( 'Capabiliti Tab', 'filix-core' ),
  123. 'type' =>Controls_Manager::REPEATER,
  124. 'fields' => $repeater->get_controls(),
  125. 'title_field' => '{{{ tab_li_title }}}',
  126. ]
  127. );
  128.  
  129. $repeater->end_controls_tab();
  130.  
  131. $this->end_controls_section();
  132.  
  133. /**
  134. * Capabilities Tab Content
  135. * ------------------------------ Capabilities Tab content ------------------------------
  136. */
  137. $this->start_controls_section(
  138. 'capa_tab_content',
  139. [
  140. 'label' => esc_html__( 'Tab Item Content', 'filix-core' ),
  141. ]
  142. );
  143.  
  144. $repeater = new \Elementor\Repeater();
  145.  
  146. $repeater->add_control(
  147. 'tab_item_id',
  148. [
  149. 'label' => esc_html__('Tab Item ID', 'filix-core'),
  150. 'type' => Controls_Manager::TEXT,
  151. 'label_block' => true,
  152. 'default' => 'Write the tab item ID here',
  153. ]
  154. );
  155.  
  156. $repeater->add_control(
  157. 'tab_item_top_text', [
  158. 'label' => esc_html__( 'Description', 'filix-core' ),
  159. 'type' =>Controls_Manager::WYSIWYG,
  160. 'label_block' => true,
  161. 'default' => 'Tab Content Here',
  162. ]
  163. );
  164.  
  165. $service = new \Elementor\Repeater();
  166.  
  167. $service->add_control(
  168. 'service_icon',
  169. [
  170. 'label' => esc_html__('Tab Item ID', 'filix-core'),
  171. 'type' => Controls_Manager::ICON,
  172. 'label_block' => true,
  173. 'default' => 'fa fa-star',
  174. ]
  175. );
  176.  
  177. $service->add_control(
  178. 'service_title', [
  179. 'label' => esc_html__( 'Service Title', 'filix-core' ),
  180. 'type' =>Controls_Manager::TEXTAREA,
  181. 'label_block' => true,
  182. 'default' => 'Tab Content Here',
  183. ]
  184. );
  185.  
  186. $service->add_control(
  187. 'service_text', [
  188. 'label' => esc_html__( 'Description', 'filix-core' ),
  189. 'type' =>Controls_Manager::TEXTAREA,
  190. 'label_block' => true,
  191. 'default' => 'Tab Content Here',
  192. ]
  193. );
  194.  
  195. $this->add_control(
  196. 'service_list',
  197. [
  198. 'label' => esc_html__( 'Service Item', 'filix-core' ),
  199. 'type' =>Controls_Manager::REPEATER,
  200. 'fields' => $service->get_controls(),
  201. 'title_field' => '{{{ service_title }}}',
  202. ]
  203. );
  204.  
  205.  
  206. $this->add_control(
  207. 'capabiliti_content_tab',
  208. [
  209. 'label' => esc_html__( 'Capabiliti Tab', 'filix-core' ),
  210. 'type' =>Controls_Manager::REPEATER,
  211. 'fields' => $repeater->get_controls(),
  212. 'title_field' => '{{{ tab_item_top_text }}}',
  213. ]
  214. );
  215.  
  216. $this->add_responsive_control(
  217. 'align',
  218. [
  219. 'label' => __( 'Alignment', 'filix-core' ),
  220. 'type' => Controls_Manager::CHOOSE,
  221. 'options' => [
  222. 'left' => [
  223. 'title' => __( 'Left', 'filix-core' ),
  224. 'icon' => 'fa fa-align-left',
  225. ],
  226. 'center' => [
  227. 'title' => __( 'Center', 'filix-core' ),
  228. 'icon' => 'fa fa-align-center',
  229. ],
  230. 'right' => [
  231. 'title' => __( 'Right', 'filix-core' ),
  232. 'icon' => 'fa fa-align-right',
  233. ],
  234. ],
  235. 'default' => 'left',
  236. 'selectors' => [
  237. '{{WRAPPER}} .service_item' => 'text-align: {{VALUE}};',
  238. ],
  239. ]
  240. );
  241.  
  242. $repeater->end_controls_tab();
  243.  
  244. $this->end_controls_section();
  245.  
  246.  
  247. /**
  248. * Style Tab
  249. * ------------------------------ Style Title ------------------------------
  250. */
  251. $this->start_controls_section(
  252. 'capa_style_title', [
  253. 'label' => esc_html__( 'Style Title', 'filix-core' ),
  254. 'tab' => Controls_Manager::TAB_STYLE,
  255. ]
  256. );
  257.  
  258. $this->add_control(
  259. 'capa_color_title', [
  260. 'label' => esc_html__( 'Title Color', 'filix-core' ),
  261. 'type' => Controls_Manager::COLOR,
  262. 'selectors' => [
  263. '{{WRAPPER}} .capabiliti_wrap .capabiliti_title' => 'color: {{VALUE}};',
  264. ],
  265. 'defualt' => '#999',
  266. ]
  267. );
  268.  
  269. $this->add_group_control(
  270. Group_Control_Typography::get_type(), [
  271. 'name' => 'capa_contnet_title',
  272. 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
  273. 'selector' => '{{WRAPPER}} .capabiliti_title',
  274. ]
  275. );
  276.  
  277. $this->end_controls_section();
  278.  
  279. //------------------------------ Gradient Color ------------------------------
  280. $this->start_controls_section(
  281. 'about_style_background',
  282. [
  283. 'label' => esc_html__( 'Background', 'filix-core' ),
  284. 'tab' => Controls_Manager::TAB_STYLE
  285. ]
  286. );
  287.  
  288. // Gradient Color
  289. $this->add_control(
  290. 'capa_bg_color', [
  291. 'label' => esc_html__( 'Background Color', 'filix-core' ),
  292. 'type' => Controls_Manager::COLOR,
  293. 'scheme' => [
  294. 'type' => Scheme_Color::get_type(),
  295. 'value' => Scheme_Color::COLOR_1,
  296. ],
  297. 'defualt' => '#000',
  298. 'selectors' => [
  299. '{{WRAPPER}} .capabiliti_wrap' => 'background: {{VALUE}};',
  300. ],
  301. ]
  302. );
  303.  
  304. $this->end_controls_section();
  305. }
  306.  
  307. protected function render() {
  308. $settings = $this->get_settings();
  309. $capabiliti_tab = $settings['capabiliti_tab'];
  310. $capabiliti_content_tab = $settings['capabiliti_content_tab'];
  311. $service_list = $settings['service_list'];
  312. $counter = 0;
  313. ?>
  314.  
  315. <section class="capabiliti_wrap">
  316. <div class="bg_text" >
  317. <?php if (!empty($settings['capa_animate_title'])) : ?>
  318. <h1 class="bg_strock_text" data-parallax='{"x": 200}'><?php echo wp_kses_post($settings['capa_animate_title']); ?></h1>
  319. <?php endif; ?>
  320. </div>
  321. <div class="container">
  322. <div class="row">
  323. <div class="col-lg-12 col-12">
  324. <?php if (!empty($settings['capa_section_title'])) : ?>
  325. <h2 class="capabiliti_title wow fadeInUp"><?php echo wp_kses_post($settings['capa_section_title']); ?></h2>
  326. <?php endif; ?>
  327. </div>
  328. </div>
  329. <div class="row">
  330. <div class="col-lg-5 col-md-4 col-sm-12 col-12">
  331. <ul class="nav nav-tabs capabiliti_tab">
  332. <?php
  333. if (!empty($capabiliti_tab)) {
  334. foreach ($capabiliti_tab as $single_tab) {
  335. $counter++; ?>
  336. <li class="nav-item wow fadeInUp item-<?php echo $single_tab['_id'] ?>">
  337. <a class="nav-link <?=($counter == 1) ? 'active' : ''?>" data-toggle="tab" href="#<?php echo esc_html($single_tab['nab_tab_li_id']); ?>">
  338. <?php echo wp_kses_post($single_tab['tab_li_title']); ?></a>
  339. </li>
  340. <?php
  341. }}
  342. ?>
  343. </ul>
  344. </div>
  345. <div class="col-lg-7 col-md-8 col-sm-12 col-12">
  346. <div class="tab-content capabiliti_tab_content">
  347. <?php
  348. if (!empty($capabiliti_content_tab)) {
  349. foreach ($capabiliti_content_tab as $service_content) {
  350. $counter++; ?>
  351. <div class="tab-pane fade show <?=($counter == 1) ? 'active' : ''?>" id="<?php echo esc_html($service_content['tab_item_id']); ?>">
  352. <?php if (!empty($service_content['tab_item_top_text'])) : ?>
  353. <p class="tabPara wow fadeInUp"><?php echo wp_kses_post($service_content['tab_item_top_text']); ?></p>
  354. <?php endif; ?>
  355.  
  356. <div class="row">
  357. <?php
  358. if (!empty($service_list)) {
  359. foreach ($service_list as $single_service) {
  360. ?>
  361. <div class="col-md-6 col-sm-6 col-12 wow fadeInUp">
  362. <div class="service_item">
  363. <div class="icon">
  364. <?php if (!empty($single_service['service_icon'])) : ?>
  365. <i class="<?php echo esc_html($single_service['service_icon']); ?>"></i>
  366. <?php endif; ?>
  367. </div>
  368. <div class="content">
  369. <?php if (!empty($single_service['service_title'])) : ?>
  370. <a href="#"><h4><?php echo esc_html($single_service['service_title']); ?></h4></a>
  371. <?php endif; ?>
  372. <?php if (!empty($single_service['service_text'])) : ?>
  373. <p><?php echo esc_html($single_service['service_text']); ?></p>
  374. <?php endif; ?>
  375. </div>
  376. </div>
  377. </div>
  378. <?php
  379. }}
  380. ?>
  381. </div>
  382. </div>
  383.  
  384. <?php
  385. }}
  386. ?>
  387. </div>
  388. </div>
  389. </div>
  390. </div>
  391. </section>
  392. <?php
  393. }
  394. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement