| 1 |
<?php |
| 2 |
|
| 3 |
namespace Wdk\Elementor\Extensions; |
| 4 |
|
| 5 |
|
| 6 |
use Wdk\Elementor\Widgets\WdkElementorBase; |
| 7 |
use Elementor\Widget_Base; |
| 8 |
use Elementor\Controls_Manager; |
| 9 |
use Elementor\Utils; |
| 10 |
use Elementor\Typography; |
| 11 |
use Elementor\Editor; |
| 12 |
use Elementor\Plugin; |
| 13 |
use Elementor\Repeater; |
| 14 |
use Elementor\Core\Schemes; |
| 15 |
use Elementor\Icons_Manager; |
| 16 |
use Elementor\Group_Control_Typography; |
| 17 |
use Elementor\Group_Control_Border; |
| 18 |
use Elementor\Group_Control_Box_Shadow; |
| 19 |
|
| 20 |
if (!defined('ABSPATH')) |
| 21 |
exit; // Exit if accessed directly |
| 22 |
|
| 23 |
/** |
| 24 |
* @since 1.1.0 |
| 25 |
*/ |
| 26 |
class WdkListingCardThumbnail extends \Wdk\Elementor\Widgets\WdkFieldImages { |
| 27 |
public $field_types = array(); |
| 28 |
|
| 29 |
public function __construct($data = array(), $args = null) { |
| 30 |
parent::__construct($data, $args); |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Retrieve the widget name. |
| 35 |
* |
| 36 |
* @since 1.1.0 |
| 37 |
* |
| 38 |
* @access public |
| 39 |
* |
| 40 |
* @return string Widget name. |
| 41 |
*/ |
| 42 |
public function get_name() { |
| 43 |
return 'wdk-listing-card-thumbnail'; |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Retrieve the widget title. |
| 48 |
* |
| 49 |
* @since 1.1.0 |
| 50 |
* |
| 51 |
* @access public |
| 52 |
* |
| 53 |
* @return string Widget title. |
| 54 |
*/ |
| 55 |
public function get_title() { |
| 56 |
return esc_html__('Wdk Listing Card Thumbnail', 'wpdirectorykit'); |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Register the widget controls. |
| 61 |
* |
| 62 |
* Adds different input fields to allow the user to change and customize the widget settings. |
| 63 |
* |
| 64 |
* @since 1.1.0 |
| 65 |
* |
| 66 |
* @access protected |
| 67 |
*/ |
| 68 |
protected function register_controls() { |
| 69 |
parent::register_controls(); |
| 70 |
} |
| 71 |
|
| 72 |
} |
| 73 |
|
| 74 |
|
| 75 |
add_action('elementor/element/wdk-listing-card-thumbnail/tab_conf_main_section/before_section_end', function($element, $args) { |
| 76 |
$element->add_control( |
| 77 |
'cover_in_listing_link', |
| 78 |
[ |
| 79 |
'label' => __( 'Cover in listing link', 'wpdirectorykit' ), |
| 80 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 81 |
'label_on' => __( 'True', 'wpdirectorykit' ), |
| 82 |
'label_off' => __( 'False', 'wpdirectorykit' ), |
| 83 |
'return_value' => 'yes', |
| 84 |
'default' => '', |
| 85 |
] |
| 86 |
); |
| 87 |
}, 10, 2); |
| 88 |
|
| 89 |
/* remove */ |
| 90 |
add_action( |
| 91 |
'elementor/element/before_section_end', |
| 92 |
function($section, $section_id, $args) { |
| 93 |
if( $section->get_name() == 'wdk-listing-card-thumbnail'/* && $section_id == 'section_style'*/ ) |
| 94 |
{ |
| 95 |
$section->remove_control('enable_js_gallery'); |
| 96 |
} |
| 97 |
}, 10, 3 |
| 98 |
); |
| 99 |
|