1: <?php
2: /**
3: * Elementor EPL Listing Card document.
4: *
5: * @package EPL
6: * @subpackage PageBuilders/Elementor
7: * @since 3.6.0
8: */
9:
10: // Exit if accessed directly.
11: if ( ! defined( 'ABSPATH' ) ) {
12: exit;
13: }
14:
15: /**
16: * Dedicated saved-template document for a single listing "card".
17: *
18: * The free-Elementor equivalent of an Elementor Pro Loop Grid item. Not
19: * applied automatically anywhere — a card only renders where a widget's own
20: * "Listing Card" control explicitly picks it (EPL Archive Results, EPL
21: * Listing Advanced, EPL Listings), via EPL_Elementor_Template_Router. There
22: * is deliberately no site-wide "default card" — a card is designed to sit in
23: * a grid column, and forcing it onto ungridded contexts (e.g. the [listing]
24: * shortcode's plain loop) breaks its layout.
25: */
26: class EPL_Elementor_Loop_Card_Document extends EPL_Elementor_Listing_Document {
27:
28: /** Document type slug. */
29: const TYPE = 'epl-loop-card';
30:
31: /**
32: * Get document name.
33: *
34: * @return string
35: * @since 3.6.0 New: Elementor templates for free Elementor (beta).
36: */
37: public function get_name() {
38: return self::TYPE;
39: }
40:
41: /**
42: * Get document type.
43: *
44: * @return string
45: * @since 3.6.0 New: Elementor templates for free Elementor (beta).
46: */
47: public static function get_type() {
48: return self::TYPE;
49: }
50:
51: /**
52: * Get singular title.
53: *
54: * @return string
55: * @since 3.6.0 New: Elementor templates for free Elementor (beta).
56: */
57: public static function get_title() {
58: return esc_html__( 'EPL Listing Card', 'easy-property-listings' );
59: }
60:
61: /**
62: * Get plural title.
63: *
64: * @return string
65: * @since 3.6.0 New: Elementor templates for free Elementor (beta).
66: */
67: public static function get_plural_title() {
68: return esc_html__( 'EPL Listing Cards', 'easy-property-listings' );
69: }
70:
71: /**
72: * Register document controls.
73: * @since 3.6.0 New: Elementor templates for free Elementor (beta).
74: */
75: protected function register_controls() {
76: parent::register_controls();
77:
78: $this->start_controls_section(
79: 'epl_card_settings',
80: array(
81: 'label' => esc_html__( 'EPL Card Settings', 'easy-property-listings' ),
82: 'tab' => \Elementor\Controls_Manager::TAB_SETTINGS,
83: )
84: );
85:
86: $this->add_control(
87: 'epl_card_preview_width',
88: array(
89: 'label' => esc_html__( 'Editing Preview Width (px)', 'easy-property-listings' ),
90: 'type' => \Elementor\Controls_Manager::NUMBER,
91: 'min' => 150,
92: 'max' => 800,
93: 'step' => 10,
94: 'default' => 320,
95: 'description' => esc_html__( 'Narrows the editor to card width. No effect on the front end.', 'easy-property-listings' ),
96: )
97: );
98:
99: $this->end_controls_section();
100: }
101: }
102: