name = esc_html__( 'Property Map Link', 'propertyhive' ); $this->icon = 'Y'; } public function get_fields() { $fields = array( 'map_link_type' => array( 'label' => esc_html__( 'Link Type', 'propertyhive' ), 'type' => 'select', 'options' => [ '_blank' => 'Open map in new window', 'embedded' => 'Open embedded map in lightbox', 'iframe' => 'Open iframe map in lightbox', ], 'toggle_slug' => 'main_content', ), ); return $fields; } public function render( $attrs, $content, $render_slug ) { $post_id = get_the_ID(); $property = new PH_Property($post_id); if ( !isset($property->id) ) { return; } if ( $property->latitude == '' || $property->longitude == '' || $property->latitude == '0' || $property->longitude == '0' ) { return; } ob_start(); $link_type = ( isset($this->props['map_link_type']) && !empty($this->props['map_link_type']) ) ? $this->props['map_link_type'] : '_blank'; switch ($link_type) { case "_blank": { echo '' . esc_html(__( 'View Map', 'propertyhive' )) . ''; break; } case "embedded": { echo '' . esc_html(__( 'View Map', 'propertyhive' )) . ''; echo '
'; break; } case "iframe": { echo '' . esc_html(__( 'View Map', 'propertyhive' )) . ''; break; } } return $this->_render_module_wrapper( ob_get_clean(), $render_slug ); } }