esc_html__('Current product (product pages)', 'printloom')); foreach (aiph_designer_products() as $p) $options[(string) $p['id']] = $p['name']; $this->start_controls_section('content', array('label'=>esc_html__('Designer', 'printloom'))); $this->add_control('product_id', array('label'=>esc_html__('Product', 'printloom'), 'type'=>Controls_Manager::SELECT, 'options'=>$options, 'default'=>'0', 'description'=>esc_html__('Only products with the designer turned on are listed.', 'printloom'))); $this->add_control('label', array('label'=>esc_html__('Button text', 'printloom'), 'type'=>Controls_Manager::TEXT, 'default'=>'', 'placeholder'=>aiph_opt('button_label'), 'dynamic'=>array('active'=>true))); $this->add_responsive_control('align', array('label'=>esc_html__('Alignment', 'printloom'), 'type'=>Controls_Manager::CHOOSE, 'options'=>array( 'left' => array('title'=>esc_html__('Left', 'printloom'), 'icon'=>'eicon-text-align-left'), 'center' => array('title'=>esc_html__('Center', 'printloom'), 'icon'=>'eicon-text-align-center'), 'right' => array('title'=>esc_html__('Right', 'printloom'), 'icon'=>'eicon-text-align-right'), ), 'selectors'=>array('{{WRAPPER}} .aiph-designer-button-wrap'=>'text-align: {{VALUE}};'))); $this->add_control('full_width', array('label'=>esc_html__('Full width', 'printloom'), 'type'=>Controls_Manager::SWITCHER, 'default'=>'', 'selectors'=>array('{{WRAPPER}} .aiph-designer-button'=>'display: block; width: 100%; text-align: center;'))); $this->end_controls_section(); $this->start_controls_section('style', array('label'=>esc_html__('Button', 'printloom'), 'tab'=>Controls_Manager::TAB_STYLE)); $this->add_group_control(Group_Control_Typography::get_type(), array('name'=>'typography', 'selector'=>'{{WRAPPER}} .aiph-designer-button')); $this->start_controls_tabs('colors'); foreach (array('normal'=>array(esc_html__('Normal', 'printloom'), ''), 'hover'=>array(esc_html__('Hover', 'printloom'), ':hover, {{WRAPPER}} .aiph-designer-button:focus')) as $state=>$def) { $sel = '{{WRAPPER}} .aiph-designer-button'.$def[1]; $this->start_controls_tab('colors_'.$state, array('label'=>$def[0])); $this->add_control('text_color_'.$state, array('label'=>esc_html__('Text color', 'printloom'), 'type'=>Controls_Manager::COLOR, 'selectors'=>array($sel=>'color: {{VALUE}};'))); $this->add_control('bg_color_'.$state, array('label'=>esc_html__('Background', 'printloom'), 'type'=>Controls_Manager::COLOR, 'selectors'=>array($sel=>'background-color: {{VALUE}};'))); $this->end_controls_tab(); } $this->end_controls_tabs(); $this->add_group_control(Group_Control_Border::get_type(), array('name'=>'border', 'selector'=>'{{WRAPPER}} .aiph-designer-button', 'separator'=>'before')); $this->add_responsive_control('radius', array('label'=>esc_html__('Border radius', 'printloom'), 'type'=>Controls_Manager::DIMENSIONS, 'size_units'=>array('px','%','em'), 'selectors'=>array('{{WRAPPER}} .aiph-designer-button'=>'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'))); $this->add_responsive_control('padding', array('label'=>esc_html__('Padding', 'printloom'), 'type'=>Controls_Manager::DIMENSIONS, 'size_units'=>array('px','em','%'), 'selectors'=>array('{{WRAPPER}} .aiph-designer-button'=>'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'))); $this->add_group_control(Group_Control_Box_Shadow::get_type(), array('name'=>'shadow', 'selector'=>'{{WRAPPER}} .aiph-designer-button')); $this->end_controls_section(); } protected function render() { $s = $this->get_settings_for_display(); $editing = class_exists('\Elementor\Plugin') && (\Elementor\Plugin::$instance->editor->is_edit_mode() || \Elementor\Plugin::$instance->preview->is_preview_mode()); echo aiph_button_html(array('product_id'=>$s['product_id'] ?? 0, 'label'=>$s['label'] ?? '', 'preview'=>$editing)); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped in aiph_button_html() } }