This repository has been archived by the owner on Oct 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathawesome-cluster-map.pages.php
60 lines (58 loc) · 1.88 KB
/
awesome-cluster-map.pages.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* Admin menu hook: Add pages to menu.
*/
function acm_admin_menu() {
add_options_page('Cluster map', 'Cluster map', 'manage_options', 'acm-options', 'acm_page_options');
}
add_action('admin_menu', 'acm_admin_menu');
/**
* Page options
*/
function acm_page_options() {
if ( isset ( $_GET['tab'] ) ) {
$tab = $_GET['tab'];
} else {
$tab = 'map';
}
$tabs = array(
'map' => __('Map', ACM_NAME),
'clustering' => __('Clustering', ACM_NAME)
);
?>
<div class="wrap">
<h2>Awesome Cluster Map <?php _e('Settings'); ?></h2>
<?php echo acm_helper_admin_tabs($_GET['page'], $tabs, $tab); ?>
<form method="post" action="options.php">
<?php settings_fields(ACM_NAME); ?>
<?php do_settings_sections(ACM_NAME); ?>
<table class="form-table">
<?php switch ($tab) {
case 'map':
?>
<tr>
<th><?php _e('Tile layer URL'); ?></th>
<td><input type="text" name="map_tileLayerURL" class="regular-text" value="<?php echo esc_attr( get_option('map_tileLayerURL') ); ?>" /></td>
</tr>
<tr>
<th><?php _e('Tile layer options'); ?> <?php acm_helper_help_link('http://leafletjs.com/reference.html#tilelayer-options'); ?></th>
<td><textarea name="map_tileLayerOptions" class="large-text" rows="10" cols="50"><?php echo esc_attr( get_option('map_tileLayerOptions') ); ?></textarea></td>
</tr>
<?php
break;
case 'clustering':
?>
<tr>
<th><?php _e('Max cluster radius'); ?> <?php acm_helper_help_link('https://github.com/Leaflet/Leaflet.markercluster#all-options'); ?></th>
<td><input type="number" name="clustering_maxClusterRadius" class="small-text" value="<?php echo esc_attr( get_option('clustering_maxClusterRadius') ); ?>" /> pixel</td>
</tr>
<?php
break;
}
?>
</table>
<?php submit_button(); ?>
</form>
</div>
<?php
}