Skip to content

Commit 3b5f2fc

Browse files
committed
v1.0.1
Added fields back for manual entry. Currently, all must be filled out (sanitization function to be added soon)
1 parent e1d2d73 commit 3b5f2fc

File tree

1 file changed

+31
-17
lines changed

1 file changed

+31
-17
lines changed

cmb2-mapbox.php

+31-17
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
Plugin Name: CMB2 Mapbox
44
Plugin URI:
55
Description: This plugin adds a new CMB2 fieldtype for adding a single point to a Mapbox map. This plugin requires CMB2 and a Mapbox access token.
6-
Version: 1.0.0
6+
Version: 1.0.1
77
Author: Rob Clark
88
Author URI: https://robclark.io
99
License: GPLv2 or later
1010
Text Domain: cmb2-mapbox
11+
GitHub Plugin URI: pixelwatt/cmb2-mapbox
1112
*/
1213

1314
add_action( 'cmb2_admin_init', 'cmb2_mapbox_options_metabox' );
@@ -160,41 +161,54 @@ function updateEditor(e) {
160161
draw.add({ type: 'Point', coordinates: [<?php echo $value['lnglat']; ?>] });
161162
});
162163
<?php } ?>
164+
163165
</script>
164-
<div style="display: none; visibility: hidden;">
165-
<p><label for="<?php echo $field_type->_id( '_lat' ); ?>">Marker Latitude (Manual Entry)</label></p>
166-
<?php
166+
<style>
167+
input.cmb2-mapbox-entry-field {
168+
width: 30%;
169+
margin-right: 3%;
170+
margin-left: 0 !important;
171+
margin-top: 16px;
172+
appearance: none;
173+
border-radius: 0;
174+
border: none;
175+
border-bottom: 2px solid #E3E3E3;
176+
}
177+
</style>
178+
<div class="entry-fields"><p style="display: none; visibility: hidden;"><label for="<?php echo $field_type->_id( '_lng' ); ?>">Marker Longitude</label></p><?php
167179
echo $field_type->input(
168180
array(
169-
'name' => $field_type->_name( '[lat]' ),
170-
'id' => $field_type->_id( '_lat' ),
171-
'value' => $value['lat'],
181+
'name' => $field_type->_name( '[lng]' ),
182+
'id' => $field_type->_id( '_lng' ),
183+
'class' => 'cmb2-mapbox-entry-field',
184+
'value' => $value['lng'],
172185
'desc' => '',
186+
'placeholder' => 'Longitude',
173187
)
174188
);
175-
?>
176-
<p><label for="<?php echo $field_type->_id( '_lng' ); ?>">Marker Longitude (Manual Entry)</label></p>
177-
<?php
189+
?><p style="display: none; visibility: hidden;"><label for="<?php echo $field_type->_id( '_lat' ); ?>">Marker Latitude</label></p><?php
178190
echo $field_type->input(
179191
array(
180-
'name' => $field_type->_name( '[lng]' ),
181-
'id' => $field_type->_id( '_lng' ),
182-
'value' => $value['lng'],
192+
'name' => $field_type->_name( '[lat]' ),
193+
'id' => $field_type->_id( '_lat' ),
194+
'class' => 'cmb2-mapbox-entry-field',
195+
'value' => $value['lat'],
183196
'desc' => '',
197+
'placeholder' => 'Latitude',
184198
)
185199
);
186-
?><br><br>
187-
<?php
200+
?><p style="display: none; visibility: hidden;"><label for="<?php echo $field_type->_id( '_lnglat' ); ?>">Longitude,Latitude</label></p><?php
188201
echo $field_type->input(
189202
array(
190203
'name' => $field_type->_name( '[lnglat]' ),
191204
'id' => $field_type->_id( '_lnglat' ),
205+
'class' => 'cmb2-mapbox-entry-field',
192206
'value' => $value['lnglat'],
193207
'desc' => '',
208+
'placeholder' => 'Longitude,Latitude',
194209
)
195210
);
196-
?>
197-
</div>
211+
?></div>
198212
<?php
199213
}
200214
}

0 commit comments

Comments
 (0)