| 1 |
<?php |
| 2 |
/** |
| 3 |
* Provide a admin widget view for the plugin |
| 4 |
* |
| 5 |
* This file is used to markup the admin facing widget form |
| 6 |
* |
| 7 |
* @link https://codeboxr.com |
| 8 |
* @since 1.1.7 |
| 9 |
* |
| 10 |
* @package cbxgooglemap |
| 11 |
* @subpackage cbxgooglemap/Widgets/Classic/views |
| 12 |
*/ |
| 13 |
|
| 14 |
use Cbx\Googlemap\Helpers\CBXGooglemapHelper; |
| 15 |
|
| 16 |
// If this file is called directly, abort. |
| 17 |
if ( ! defined( 'WPINC' ) ) { |
| 18 |
die; |
| 19 |
} |
| 20 |
?> |
| 21 |
<?php |
| 22 |
do_action( 'cbxgooglemap_form_before_admin', $instance, $this ); |
| 23 |
?> |
| 24 |
<p> |
| 25 |
<label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"> |
| 26 |
<?php esc_html_e( 'Title', 'cbxgooglemap' ); ?> |
| 27 |
<input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" |
| 28 |
name="<?php echo esc_attr($this->get_field_name( 'title' )); ?>" type="text" |
| 29 |
value="<?php echo esc_attr( $title ); ?>"/> </label> |
| 30 |
</p> |
| 31 |
|
| 32 |
<p> |
| 33 |
<label for="<?php echo esc_attr($this->get_field_id( 'map_id' )); ?>"> |
| 34 |
<?php esc_html_e( 'Predefined Map', 'cbxgooglemap' ); ?> |
| 35 |
</label> |
| 36 |
<?php |
| 37 |
$query = get_posts( [ |
| 38 |
'post_type' => 'cbxgooglemap', |
| 39 |
'orderby' => 'date', |
| 40 |
'posts_per_page' => - 1, |
| 41 |
'post_status' => 'publish', |
| 42 |
] ); |
| 43 |
|
| 44 |
?> |
| 45 |
<select class="widefat" name="<?php echo esc_attr($this->get_field_name( 'map_id' )); ?>" |
| 46 |
id="<?php echo esc_attr($this->get_field_id( 'map_id' )); ?>"> |
| 47 |
<option value="0"><?php esc_html_e( 'Choose Ready Map or Use custom params', 'cbxgooglemap' ); ?></option> |
| 48 |
<?php |
| 49 |
foreach ( $query as $post ) : |
| 50 |
CBXGooglemapHelper::setup_admin_postdata( $post ); |
| 51 |
$post_id = intval( get_the_ID() ); |
| 52 |
$post_title = get_the_title(); |
| 53 |
|
| 54 |
echo '<option ' . selected( $post_id, $map_id, false ) . ' value="' . intval( $post_id ) . '">' . esc_attr( $post_title ) . '</option>'; |
| 55 |
|
| 56 |
endforeach; |
| 57 |
CBXGooglemapHelper::wp_reset_admin_postdata(); |
| 58 |
?> |
| 59 |
</select> |
| 60 |
</p> |
| 61 |
|
| 62 |
<p><h3><?php esc_html_e( 'Custom Map Attributes', 'cbxgooglemap' ) ?></h3></p> |
| 63 |
<p> |
| 64 |
<label for="<?php echo esc_attr($this->get_field_id( 'maptype' )); ?>"><?php esc_html_e( 'Map Type:', 'cbxgooglemap' ); ?> |
| 65 |
<select name="<?php echo esc_attr($this->get_field_name( 'maptype' )); ?>" |
| 66 |
id="<?php echo esc_attr($this->get_field_id( 'maptype' )); ?>" class="widefat"> |
| 67 |
<option value="roadmap" <?php selected( $maptype, 'roadmap' ); ?>><?php esc_html_e( 'Road Map', 'cbxgooglemap' ); ?></option> |
| 68 |
<option value="satellite" <?php selected( $maptype, 'satellite' ); ?>><?php esc_html_e( 'Satellite Map', 'cbxgooglemap' ); ?></option> |
| 69 |
<option value="hybrid" <?php selected( $maptype, 'hybrid' ); ?>><?php esc_html_e( 'Hybrid Map', 'cbxgooglemap' ); ?></option> |
| 70 |
<option value="terrain" <?php selected( $maptype, 'terrain' ); ?>><?php esc_html_e( 'Terrain Map', 'cbxgooglemap' ); ?></option> |
| 71 |
</select> </label> |
| 72 |
</p> |
| 73 |
<p> |
| 74 |
<label for="<?php echo esc_attr($this->get_field_id( 'lat' )); ?>"> |
| 75 |
<?php esc_html_e( 'Latitude', 'cbxgooglemap' ); ?> |
| 76 |
<input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'lat' )); ?>" |
| 77 |
name="<?php echo esc_attr($this->get_field_name( 'lat' )); ?>" type="text" |
| 78 |
value="<?php echo esc_attr( $lat ); ?>"/> </label> |
| 79 |
</p> |
| 80 |
<p> |
| 81 |
<label for="<?php echo esc_attr($this->get_field_id( 'lng' )); ?>"> |
| 82 |
<?php esc_html_e( 'Longitude', 'cbxgooglemap' ); ?> |
| 83 |
<input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'lng' )); ?>" |
| 84 |
name="<?php echo esc_attr($this->get_field_name( 'lng' )); ?>" type="text" |
| 85 |
value="<?php echo esc_attr( $lng ); ?>"/> </label> |
| 86 |
</p> |
| 87 |
<p> |
| 88 |
<label for="<?php echo esc_attr($this->get_field_id( 'width' )); ?>"> |
| 89 |
<?php esc_html_e( 'Width(Numeric or with %)', 'cbxgooglemap' ); ?> |
| 90 |
<input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'width' )); ?>" |
| 91 |
name="<?php echo esc_attr($this->get_field_name( 'width' )); ?>" type="text" |
| 92 |
value="<?php echo esc_attr( $width ); ?>"/> </label> |
| 93 |
</p> |
| 94 |
<p> |
| 95 |
<label for="<?php echo esc_attr($this->get_field_id( 'height' )); ?>"> |
| 96 |
<?php esc_html_e( 'Height', 'cbxgooglemap' ); ?> |
| 97 |
<input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'height' )); ?>" |
| 98 |
name="<?php echo esc_attr($this->get_field_name( 'height' )); ?>" type="text" |
| 99 |
value="<?php echo esc_attr( $height ); ?>"/> </label> |
| 100 |
</p> |
| 101 |
<p> |
| 102 |
<label for="<?php echo esc_attr($this->get_field_id( 'zoom' )); ?>"> |
| 103 |
<?php esc_html_e( 'Zoom(Numeric Value)', 'cbxgooglemap' ); ?> |
| 104 |
<input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'zoom' )); ?>" |
| 105 |
name="<?php echo esc_attr($this->get_field_name( 'zoom' )); ?>" type="text" |
| 106 |
value="<?php echo esc_attr( $zoom ); ?>"/> </label> |
| 107 |
</p> |
| 108 |
<p> |
| 109 |
<label for="<?php echo esc_attr($this->get_field_id( 'scrollwheel' )); ?>"><?php esc_html_e( 'Mouse Scroll Wheel', 'cbxgooglemap' ); ?> |
| 110 |
<select name="<?php echo esc_attr($this->get_field_name( 'scrollwheel' )); ?>" |
| 111 |
id="<?php echo esc_attr($this->get_field_id( 'scrollwheel' )); ?>" class="widefat"> |
| 112 |
<option value="1" <?php selected( $scrollwheel, '1' ); ?>><?php esc_html_e( 'Enable', 'cbxgooglemap' ); ?></option> |
| 113 |
<option value="0" <?php selected( $scrollwheel, '0' ); ?>><?php esc_html_e( 'Disable', 'cbxgooglemap' ); ?></option> |
| 114 |
</select> </label> |
| 115 |
</p> |
| 116 |
<p> |
| 117 |
<label for="<?php echo esc_attr($this->get_field_id( 'showinfo' )); ?>"><?php esc_html_e( 'Show Popup', 'cbxgooglemap' ); ?> |
| 118 |
<select name="<?php echo esc_attr($this->get_field_name( 'showinfo' )); ?>" |
| 119 |
id="<?php echo esc_attr($this->get_field_id( 'showinfo' )); ?>" class="widefat"> |
| 120 |
<option value="1" <?php selected( $showinfo, '1' ); ?>><?php esc_html_e( 'Enable', 'cbxgooglemap' ); ?></option> |
| 121 |
<option value="0" <?php selected( $showinfo, '0' ); ?>><?php esc_html_e( 'Disable', 'cbxgooglemap' ); ?></option> |
| 122 |
</select> </label> |
| 123 |
</p> |
| 124 |
<p> |
| 125 |
<label for="<?php echo esc_attr($this->get_field_id( 'infow_open' )); ?>"><?php esc_html_e( 'Show Popup', 'cbxgooglemap' ); ?> |
| 126 |
<select name="<?php echo esc_attr($this->get_field_name( 'infow_open' )); ?>" |
| 127 |
id="<?php echo esc_attr($this->get_field_id( 'infow_open' )); ?>" class="widefat"> |
| 128 |
<option value="1" <?php selected( $infow_open, '1' ); ?>><?php esc_html_e( 'Open(Default)', 'cbxgooglemap' ); ?></option> |
| 129 |
<option value="0" <?php selected( $infow_open, '0' ); ?>><?php esc_html_e( 'On Click', 'cbxgooglemap' ); ?></option> |
| 130 |
</select> </label> |
| 131 |
</p> |
| 132 |
<p> |
| 133 |
<label for="<?php echo esc_attr($this->get_field_id( 'heading' )); ?>"> |
| 134 |
<?php esc_html_e( 'Popup Heading', 'cbxgooglemap' ); ?> |
| 135 |
<input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'heading' )); ?>" |
| 136 |
name="<?php echo esc_attr($this->get_field_name( 'heading' )); ?>" type="text" |
| 137 |
value="<?php echo esc_attr( $heading ); ?>"/> </label> |
| 138 |
</p> |
| 139 |
|
| 140 |
<p> |
| 141 |
<label for="<?php echo esc_attr($this->get_field_id( 'address' )); ?>"> |
| 142 |
<?php esc_html_e( 'Address', 'cbxgooglemap' ); ?> |
| 143 |
<input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'address' )); ?>" |
| 144 |
name="<?php echo esc_attr($this->get_field_name( 'address' )); ?>" type="text" |
| 145 |
value="<?php echo esc_attr( $address ); ?>"/> </label> |
| 146 |
</p> |
| 147 |
|
| 148 |
<p> |
| 149 |
<label for="<?php echo esc_attr($this->get_field_id( 'website' )); ?>"> |
| 150 |
<?php esc_html_e( 'Website url', 'cbxgooglemap' ); ?> |
| 151 |
<input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'website' )); ?>" |
| 152 |
name="<?php echo esc_attr($this->get_field_name( 'website' )); ?>" type="url" |
| 153 |
value="<?php echo esc_attr( $website ); ?>"/> </label> |
| 154 |
</p> |
| 155 |
|
| 156 |
<?php |
| 157 |
do_action( 'cbxgooglemap_form_after_admin', $instance, $this ); |