start_controls_section( 'style_section', [ 'label' => __( 'EPCs', 'propertyhive' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'show_title', [ 'label' => __( 'Show Title', 'propertyhive' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => __( 'Show', 'propertyhive' ), 'label_off' => __( 'Hide', 'propertyhive' ), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'label' => __( 'Title Typography', 'propertyhive' ), 'global' => [ 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Typography::TYPOGRAPHY_PRIMARY, ], 'selector' => '{{WRAPPER}} .epcs h4', 'condition' => [ 'show_title' => 'yes' ], ] ); $this->add_control( 'title_color', [ 'label' => __( 'Title Colour', 'propertyhive' ), 'type' => \Elementor\Controls_Manager::COLOR, 'global' => [ 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Colors::COLOR_PRIMARY, ], 'selectors' => [ '{{WRAPPER}} .epcs h4' => 'color: {{VALUE}}', ], 'condition' => [ 'show_title' => 'yes' ], ] ); $this->end_controls_section(); } protected function render() { global $property; $settings = $this->get_settings_for_display(); if ( !isset($property->id) ) { return; } if ( isset($settings['show_title']) && $settings['show_title'] != 'yes' ) { ?> _epc_urls; if ( is_array($epc_urls) && !empty( $epc_urls ) ) { foreach ($epc_urls as $epc) { echo ''; } } } else { $epc_attachment_ids = $property->get_epc_attachment_ids(); if ( !empty($epc_attachment_ids) ) { echo '
'; echo '

' . esc_html(__( 'EPCs', 'propertyhive' )) . '

'; foreach ( $epc_attachment_ids as $attachment_id ) { if ( wp_attachment_is_image($attachment_id) ) { echo ''; } else { echo '' . esc_html(__( 'View EPC', 'propertyhive' )) . ''; } } echo '
'; } } } }