Skip to content

Commit 677d95a

Browse files
committed
first commit
0 parents  commit 677d95a

15 files changed

+2433
-0
lines changed

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# OS generated files #
2+
######################
3+
.DS_Store
4+
.DS_Store?
5+
._*
6+
.Spotlight-V100
7+
.Trashes
8+
ehthumbs.db
9+
Thumbs.db

README.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# ACF MapMore Field
2+
3+
Map complex field for Advanced Custom Fields.
4+
5+
**Supports**
6+
7+
- Areas
8+
- Circles
9+
- Polygons
10+
- Routes
11+
- Custom POIs
12+
13+
-----------------------
14+
15+
### Description
16+
17+
EXTENDED_DESCRIPTION
18+
19+
### Compatibility
20+
21+
This ACF field type is compatible with:
22+
* ACF 5
23+
* ACF 4
24+
25+
### Installation
26+
27+
1. Copy the `acf-mapmore` folder into your `wp-content/plugins` folder
28+
2. Activate the MapMore plugin via the plugins admin page
29+
3. Create a new field via ACF and select the MapMore type
30+
4. Please refer to the description for more info regarding the field type settings
31+
32+
### Changelog
33+
Please see `readme.txt` for changelog

acf-mapmore.php

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
3+
/*
4+
Plugin Name: Advanced Custom Fields: MapMore
5+
Plugin URI: http://sanatorium.ninja
6+
Description: Map complex field for Advanced Custom Fields
7+
Version: 1.0.0
8+
Author: Sanatorium
9+
Author URI: http://sanatorium.ninja
10+
License: GPLv2 or later
11+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
12+
*/
13+
14+
// exit if accessed directly
15+
if( ! defined( 'ABSPATH' ) ) exit;
16+
17+
18+
// check if class already exists
19+
if( !class_exists('acf_plugin_mapmore') ) :
20+
21+
class acf_plugin_mapmore {
22+
23+
/*
24+
* __construct
25+
*
26+
* This function will setup the class functionality
27+
*
28+
* @type function
29+
* @date 17/02/2016
30+
* @since 1.0.0
31+
*
32+
* @param n/a
33+
* @return n/a
34+
*/
35+
36+
function __construct() {
37+
38+
// set text domain
39+
// https://codex.wordpress.org/Function_Reference/load_plugin_textdomain
40+
load_plugin_textdomain( 'acf-mapmore', false, plugin_basename( dirname( __FILE__ ) ) . '/lang' );
41+
42+
43+
// include field
44+
add_action('acf/include_field_types', array($this, 'include_field_types')); // v5
45+
add_action('acf/register_fields', array($this, 'include_field_types')); // v4
46+
47+
}
48+
49+
50+
/*
51+
* include_field_types
52+
*
53+
* This function will include the field type class
54+
*
55+
* @type function
56+
* @date 17/02/2016
57+
* @since 1.0.0
58+
*
59+
* @param $version (int) major ACF version. Defaults to 4
60+
* @return n/a
61+
*/
62+
63+
function include_field_types( $version = 4 ) {
64+
65+
// include
66+
include_once('fields/acf-mapmore-v' . $version . '.php');
67+
68+
}
69+
70+
}
71+
72+
73+
// initialize
74+
new acf_plugin_mapmore();
75+
76+
77+
// class_exists check
78+
endif;
79+
80+
?>

assets/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# assets directory
2+
3+
Use this directory to store asset files such as CSS, JS and images.
4+
5+
This directory can be removed if not used.

assets/css/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CSS directory
2+
3+
Use this directory to store CSS files.
4+
5+
This directory can be removed if not used.

assets/css/input.css

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.acf-field-mapmore-row {
2+
width: 100%;
3+
overflow: hidden;
4+
position: relative;
5+
clear: both;
6+
}
7+
.acf-field-mapmore-controls {
8+
width: 25%;
9+
float: left;
10+
}
11+
.acf-field-mapmore-content {
12+
width: 75%;
13+
float: left;
14+
}

assets/images/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Images directory
2+
3+
Use this directory to store images.
4+
5+
This directory can be removed if not used.

assets/js/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# JS directory
2+
3+
Use this directory to store JS files.
4+
5+
This directory can be removed if not used.

assets/js/input.js

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
(function($){
2+
3+
4+
function initialize_field( $el ) {
5+
6+
//$el.doStuff();
7+
8+
}
9+
10+
11+
if( typeof acf.add_action !== 'undefined' ) {
12+
13+
/*
14+
* ready append (ACF5)
15+
*
16+
* These are 2 events which are fired during the page load
17+
* ready = on page load similar to $(document).ready()
18+
* append = on new DOM elements appended via repeater field
19+
*
20+
* @type event
21+
* @date 20/07/13
22+
*
23+
* @param $el (jQuery selection) the jQuery element which contains the ACF fields
24+
* @return n/a
25+
*/
26+
27+
acf.add_action('ready append', function( $el ){
28+
29+
// search $el for fields of type 'mapmore'
30+
acf.get_fields({ type : 'mapmore'}, $el).each(function(){
31+
32+
initialize_field( $(this) );
33+
34+
});
35+
36+
});
37+
38+
39+
} else {
40+
41+
42+
/*
43+
* acf/setup_fields (ACF4)
44+
*
45+
* This event is triggered when ACF adds any new elements to the DOM.
46+
*
47+
* @type function
48+
* @since 1.0.0
49+
* @date 01/01/12
50+
*
51+
* @param event e: an event object. This can be ignored
52+
* @param Element postbox: An element which contains the new HTML
53+
*
54+
* @return n/a
55+
*/
56+
57+
$(document).on('acf/setup_fields', function(e, postbox){
58+
59+
$(postbox).find('.field[data-field_type="mapmore"]').each(function(){
60+
61+
initialize_field( $(this) );
62+
63+
});
64+
65+
});
66+
67+
68+
}
69+
70+
71+
})(jQuery);

0 commit comments

Comments
 (0)