balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

Welbim_NEWSLETTER.php (5000B)


      1 <?php
      2 
      3 namespace Welbim\Helper\Elementor\Widgets;
      4 
      5 use Elementor\Utils;
      6 use Elementor\Controls_Manager;
      7 use Elementor\Widget_Base;
      8 use Elementor\Plugin;
      9 use \Elementor\Repeater;
     10 use Elementor\Group_Control_Typography;
     11 
     12 class Welbim_NEWSLETTER extends Widget_Base
     13 {
     14   public function get_name()
     15   {
     16     return 'welbim_newsletter';
     17   }
     18 
     19   public function get_title()
     20   {
     21     return esc_html__('Welbim NEWSLETTER', 'welbim');
     22   }
     23 
     24   public function get_icon()
     25   {
     26     return 'sds-widget-ico';
     27   }
     28 
     29   public function get_categories()
     30   {
     31     return ['Welbim'];
     32   }
     33 
     34   protected function _register_controls()
     35   {
     36 
     37     $this->start_controls_section(
     38       'general',
     39       [
     40         'label' => esc_html__('General', 'welbim'),
     41       ]
     42     );
     43 
     44     $this->add_control(
     45       'title',
     46       [
     47         'label'   => esc_html__('Title', 'welbim'),
     48         'type'    => Controls_Manager::TEXT,
     49         'default' => __('Subscribe to newsletter', 'welbim'),
     50       ]
     51     );
     52 
     53     $this->add_control(
     54       'discription',
     55       [
     56         'label'       => esc_html__('Discription', 'welbim'),
     57         'type'        => Controls_Manager::TEXTAREA,
     58         'default'     => __('Aliq is notm hendr erit a lorem ipsum insum simply free text image pellen tesion available.', 'welbim'),
     59         'placeholder' => esc_html__('Type your description here', 'welbim'),
     60       ]
     61     );
     62     $this->add_control(
     63       'subscribeform',
     64       [
     65         'label'       => esc_html__('Subscribe Shortcode', 'welbim'),
     66         'type'        => Controls_Manager::TEXTAREA,
     67 
     68       ]
     69     );
     70 
     71     $this->add_control(
     72       'icon',
     73       [
     74         'label' => esc_html__('Icon', 'welbim'),
     75         'type'  => Controls_Manager::ICONS,
     76       ]
     77     );
     78 
     79     $this->end_controls_section();
     80 
     81     //Typography section
     82     $this->start_controls_section(
     83       'typography_section',
     84       array(
     85         'label' => __('Typography Section', 'welbim'),
     86         'tab'   => Controls_Manager::TAB_STYLE,
     87       )
     88     );
     89 
     90     $this->add_group_control(
     91       Group_Control_Typography::get_type(),
     92       array(
     93         'name'     => 'title_typography',
     94         'label'    => __('Title', 'welbim'),
     95         'selector' => '{{WRAPPER}} .newsletter-section h3',
     96 
     97       )
     98     );
     99 
    100     $this->add_group_control(
    101       Group_Control_Typography::get_type(),
    102       array(
    103         'name'     => 'description_typography',
    104         'label'    => __('Description', 'welbim'),
    105         'selector' => '{{WRAPPER}} .newsletter-section .text',
    106 
    107       )
    108     );
    109 
    110     $this->add_group_control(
    111       Group_Control_Typography::get_type(),
    112       array(
    113         'name'     => 'button_text_typography',
    114         'label'    => __('Button Text', 'welbim'),
    115         'selector' => '{{WRAPPER}} .btn-style-one span',
    116 
    117       )
    118     );
    119 
    120     $this->end_controls_section();
    121 
    122     $this->start_controls_section(
    123       'color_section',
    124       array(
    125         'label' => __('Color Section', 'welbim'),
    126         'tab'   => \Elementor\Controls_Manager::TAB_STYLE,
    127       )
    128     );
    129 
    130     $this->add_control(
    131       'title_color',
    132       array(
    133         'label'     => __('Title Color', 'welbim'),
    134         'separator' => 'before',
    135         'type'      => \Elementor\Controls_Manager::COLOR,
    136         'selectors' => array(
    137           '{{WRAPPER}} .newsletter-section h3' => 'color: {{VALUE}}',
    138         ),
    139       )
    140     );
    141 
    142     $this->add_control(
    143       'description_color',
    144       array(
    145         'label'     => __('Description Color', 'welbim'),
    146         'separator' => 'before',
    147         'type'      => \Elementor\Controls_Manager::COLOR,
    148         'selectors' => array(
    149           '{{WRAPPER}} .newsletter-section .text' => 'color: {{VALUE}}',
    150         ),
    151       )
    152     );
    153 
    154     $this->add_control(
    155       'button_bg_color',
    156       array(
    157         'label'     => __('Button BG Color', 'welbim'),
    158         'separator' => 'before',
    159         'type'      => \Elementor\Controls_Manager::COLOR,
    160         'selectors' => array(
    161           '{{WRAPPER}} .btn-style-one' => 'background-color: {{VALUE}}',
    162         ),
    163       )
    164     );
    165 
    166 
    167     $this->end_controls_section();
    168   }
    169   protected function render()
    170   {
    171     $settings      = $this->get_settings_for_display();
    172     $title         = $settings["title"];
    173     $discription   = $settings["discription"];
    174     $subscribeform = $settings["subscribeform"];
    175 ?>
    176     <section class="newsletter-section">
    177       <div class="auto-container">
    178         <div class="wrapper-box">
    179           <div class="row">
    180             <div class="col-lg-6">
    181               <h3><?php echo $title; ?></h3>
    182               <div class="icon-box ">
    183                 <div class="icon"><?php \Elementor\Icons_Manager::render_icon($settings['icon'], ['aria-hidden' => 'true']); ?></div>
    184                 <div class="text"><?php echo $discription; ?></div>
    185               </div>
    186             </div>
    187             <div class="col-lg-6">
    188               <div class="newsletter-form">
    189                 <?php echo do_shortcode($subscribeform); ?>
    190               </div>
    191             </div>
    192           </div>
    193         </div>
    194       </div>
    195     </section>
    196 <?php
    197   }
    198 }