Version Description
- Removed support for Gravity Forms v1.4.5. Now supports v1.5 and up (including 1.6)
- Added support for single line text fields
- Added ability to populate a dropdown with posts
- Added ability to set a parent post when saving a post form
- Multiselect control now supports "populate with taxonomy" too
- "first value" default overriden when populating with a taxonomy
- Shows taxonomy selections when designing the form
- Fixed support for conditional logic
- Previews now load taxonomy terms
- Previews can show enhanced UI (only in V1.6 and above)
Download this release
Release Info
Developer | bradvin |
Plugin | Gravity Forms + Custom Post Types |
Version | 3.0 |
Comparing to | |
See all releases |
Code changes from version 2.1 to 3.0
- css/custom/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- css/custom/images/ui-bg_flat_55_e0e0e0_40x100.png +0 -0
- css/custom/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- css/custom/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- css/custom/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- css/custom/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- css/custom/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- css/custom/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- css/custom/images/ui-icons_222222_256x240.png +0 -0
- css/custom/images/ui-icons_444444_256x240.png +0 -0
- css/custom/images/ui-icons_454545_256x240.png +0 -0
- css/custom/images/ui-icons_888888_256x240.png +0 -0
- css/custom/images/ui-icons_cd0a0a_256x240.png +0 -0
- css/custom/jquery-ui-1.8.16.custom.css +342 -0
- css/jquery.tagit.css +59 -0
- gfcptaddon.php +14 -19
- gfcptaddon_1-4.php +0 -48
- gfcptaddon_1-5.php +194 -7
- gfcptaddonbase.php +230 -11
- js/gfcpt.js +3 -0
- js/jquery-ui-1.8.16.custom.min.js +99 -0
- js/tag-it.init.js +16 -0
- js/tag-it.js +393 -0
- readme.txt +34 -20
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- screenshot-5.png +0 -0
- screenshot-6.png +0 -0
- screenshot-7.png +0 -0
css/custom/images/ui-bg_flat_0_aaaaaa_40x100.png
ADDED
Binary file
|
css/custom/images/ui-bg_flat_55_e0e0e0_40x100.png
ADDED
Binary file
|
css/custom/images/ui-bg_flat_75_ffffff_40x100.png
ADDED
Binary file
|
css/custom/images/ui-bg_glass_65_ffffff_1x400.png
ADDED
Binary file
|
css/custom/images/ui-bg_glass_75_dadada_1x400.png
ADDED
Binary file
|
css/custom/images/ui-bg_glass_75_e6e6e6_1x400.png
ADDED
Binary file
|
css/custom/images/ui-bg_glass_95_fef1ec_1x400.png
ADDED
Binary file
|
css/custom/images/ui-bg_highlight-soft_75_cccccc_1x100.png
ADDED
Binary file
|
css/custom/images/ui-icons_222222_256x240.png
ADDED
Binary file
|
css/custom/images/ui-icons_444444_256x240.png
ADDED
Binary file
|
css/custom/images/ui-icons_454545_256x240.png
ADDED
Binary file
|
css/custom/images/ui-icons_888888_256x240.png
ADDED
Binary file
|
css/custom/images/ui-icons_cd0a0a_256x240.png
ADDED
Binary file
|
css/custom/jquery-ui-1.8.16.custom.css
ADDED
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* jQuery UI CSS Framework 1.8.16
|
3 |
+
*
|
4 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
* http://jquery.org/license
|
7 |
+
*
|
8 |
+
* http://docs.jquery.com/UI/Theming/API
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* Layout helpers
|
12 |
+
----------------------------------*/
|
13 |
+
.ui-helper-hidden { display: none; }
|
14 |
+
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
|
15 |
+
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
16 |
+
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
17 |
+
.ui-helper-clearfix { display: inline-block; }
|
18 |
+
/* required comment for clearfix to work in Opera \*/
|
19 |
+
* html .ui-helper-clearfix { height:1%; }
|
20 |
+
.ui-helper-clearfix { display:block; }
|
21 |
+
/* end clearfix */
|
22 |
+
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
23 |
+
|
24 |
+
|
25 |
+
/* Interaction Cues
|
26 |
+
----------------------------------*/
|
27 |
+
.ui-state-disabled { cursor: default !important; }
|
28 |
+
|
29 |
+
|
30 |
+
/* Icons
|
31 |
+
----------------------------------*/
|
32 |
+
|
33 |
+
/* states and images */
|
34 |
+
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
35 |
+
|
36 |
+
|
37 |
+
/* Misc visuals
|
38 |
+
----------------------------------*/
|
39 |
+
|
40 |
+
/* Overlays */
|
41 |
+
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
42 |
+
|
43 |
+
|
44 |
+
/*
|
45 |
+
* jQuery UI CSS Framework 1.8.16
|
46 |
+
*
|
47 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
48 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
49 |
+
* http://jquery.org/license
|
50 |
+
*
|
51 |
+
* http://docs.jquery.com/UI/Theming/API
|
52 |
+
*
|
53 |
+
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=e0e0e0&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=888888&fcHighlight=333333&iconColorHighlight=444444&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
|
54 |
+
*/
|
55 |
+
|
56 |
+
|
57 |
+
/* Component containers
|
58 |
+
----------------------------------*/
|
59 |
+
.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
|
60 |
+
.ui-widget .ui-widget { font-size: 1em; }
|
61 |
+
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
|
62 |
+
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
|
63 |
+
.ui-widget-content a { color: #222222; }
|
64 |
+
.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
|
65 |
+
.ui-widget-header a { color: #222222; }
|
66 |
+
|
67 |
+
/* Interaction states
|
68 |
+
----------------------------------*/
|
69 |
+
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
|
70 |
+
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
|
71 |
+
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
|
72 |
+
.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
|
73 |
+
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
|
74 |
+
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
|
75 |
+
.ui-widget :active { outline: none; }
|
76 |
+
|
77 |
+
/* Interaction Cues
|
78 |
+
----------------------------------*/
|
79 |
+
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #888888; background: #e0e0e0 url(images/ui-bg_flat_55_e0e0e0_40x100.png) 50% 50% repeat-x; color: #333333; }
|
80 |
+
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #333333; }
|
81 |
+
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
|
82 |
+
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
|
83 |
+
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
|
84 |
+
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
|
85 |
+
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
86 |
+
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
87 |
+
|
88 |
+
/* Icons
|
89 |
+
----------------------------------*/
|
90 |
+
|
91 |
+
/* states and images */
|
92 |
+
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
|
93 |
+
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
|
94 |
+
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
|
95 |
+
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
|
96 |
+
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
|
97 |
+
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
|
98 |
+
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_444444_256x240.png); }
|
99 |
+
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
|
100 |
+
|
101 |
+
/* positioning */
|
102 |
+
.ui-icon-carat-1-n { background-position: 0 0; }
|
103 |
+
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
104 |
+
.ui-icon-carat-1-e { background-position: -32px 0; }
|
105 |
+
.ui-icon-carat-1-se { background-position: -48px 0; }
|
106 |
+
.ui-icon-carat-1-s { background-position: -64px 0; }
|
107 |
+
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
108 |
+
.ui-icon-carat-1-w { background-position: -96px 0; }
|
109 |
+
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
110 |
+
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
111 |
+
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
112 |
+
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
113 |
+
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
114 |
+
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
115 |
+
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
116 |
+
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
117 |
+
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
118 |
+
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
119 |
+
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
120 |
+
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
121 |
+
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
122 |
+
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
123 |
+
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
124 |
+
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
125 |
+
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
126 |
+
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
127 |
+
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
128 |
+
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
129 |
+
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
130 |
+
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
131 |
+
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
132 |
+
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
133 |
+
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
134 |
+
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
135 |
+
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
136 |
+
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
137 |
+
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
138 |
+
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
139 |
+
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
140 |
+
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
141 |
+
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
142 |
+
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
143 |
+
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
144 |
+
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
145 |
+
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
146 |
+
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
147 |
+
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
148 |
+
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
149 |
+
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
150 |
+
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
151 |
+
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
152 |
+
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
153 |
+
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
154 |
+
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
155 |
+
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
156 |
+
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
157 |
+
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
158 |
+
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
159 |
+
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
160 |
+
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
161 |
+
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
162 |
+
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
163 |
+
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
164 |
+
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
165 |
+
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
166 |
+
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
167 |
+
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
168 |
+
.ui-icon-extlink { background-position: -32px -80px; }
|
169 |
+
.ui-icon-newwin { background-position: -48px -80px; }
|
170 |
+
.ui-icon-refresh { background-position: -64px -80px; }
|
171 |
+
.ui-icon-shuffle { background-position: -80px -80px; }
|
172 |
+
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
173 |
+
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
174 |
+
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
175 |
+
.ui-icon-folder-open { background-position: -16px -96px; }
|
176 |
+
.ui-icon-document { background-position: -32px -96px; }
|
177 |
+
.ui-icon-document-b { background-position: -48px -96px; }
|
178 |
+
.ui-icon-note { background-position: -64px -96px; }
|
179 |
+
.ui-icon-mail-closed { background-position: -80px -96px; }
|
180 |
+
.ui-icon-mail-open { background-position: -96px -96px; }
|
181 |
+
.ui-icon-suitcase { background-position: -112px -96px; }
|
182 |
+
.ui-icon-comment { background-position: -128px -96px; }
|
183 |
+
.ui-icon-person { background-position: -144px -96px; }
|
184 |
+
.ui-icon-print { background-position: -160px -96px; }
|
185 |
+
.ui-icon-trash { background-position: -176px -96px; }
|
186 |
+
.ui-icon-locked { background-position: -192px -96px; }
|
187 |
+
.ui-icon-unlocked { background-position: -208px -96px; }
|
188 |
+
.ui-icon-bookmark { background-position: -224px -96px; }
|
189 |
+
.ui-icon-tag { background-position: -240px -96px; }
|
190 |
+
.ui-icon-home { background-position: 0 -112px; }
|
191 |
+
.ui-icon-flag { background-position: -16px -112px; }
|
192 |
+
.ui-icon-calendar { background-position: -32px -112px; }
|
193 |
+
.ui-icon-cart { background-position: -48px -112px; }
|
194 |
+
.ui-icon-pencil { background-position: -64px -112px; }
|
195 |
+
.ui-icon-clock { background-position: -80px -112px; }
|
196 |
+
.ui-icon-disk { background-position: -96px -112px; }
|
197 |
+
.ui-icon-calculator { background-position: -112px -112px; }
|
198 |
+
.ui-icon-zoomin { background-position: -128px -112px; }
|
199 |
+
.ui-icon-zoomout { background-position: -144px -112px; }
|
200 |
+
.ui-icon-search { background-position: -160px -112px; }
|
201 |
+
.ui-icon-wrench { background-position: -176px -112px; }
|
202 |
+
.ui-icon-gear { background-position: -192px -112px; }
|
203 |
+
.ui-icon-heart { background-position: -208px -112px; }
|
204 |
+
.ui-icon-star { background-position: -224px -112px; }
|
205 |
+
.ui-icon-link { background-position: -240px -112px; }
|
206 |
+
.ui-icon-cancel { background-position: 0 -128px; }
|
207 |
+
.ui-icon-plus { background-position: -16px -128px; }
|
208 |
+
.ui-icon-plusthick { background-position: -32px -128px; }
|
209 |
+
.ui-icon-minus { background-position: -48px -128px; }
|
210 |
+
.ui-icon-minusthick { background-position: -64px -128px; }
|
211 |
+
.ui-icon-close { background-position: -80px -128px; }
|
212 |
+
.ui-icon-closethick { background-position: -96px -128px; }
|
213 |
+
.ui-icon-key { background-position: -112px -128px; }
|
214 |
+
.ui-icon-lightbulb { background-position: -128px -128px; }
|
215 |
+
.ui-icon-scissors { background-position: -144px -128px; }
|
216 |
+
.ui-icon-clipboard { background-position: -160px -128px; }
|
217 |
+
.ui-icon-copy { background-position: -176px -128px; }
|
218 |
+
.ui-icon-contact { background-position: -192px -128px; }
|
219 |
+
.ui-icon-image { background-position: -208px -128px; }
|
220 |
+
.ui-icon-video { background-position: -224px -128px; }
|
221 |
+
.ui-icon-script { background-position: -240px -128px; }
|
222 |
+
.ui-icon-alert { background-position: 0 -144px; }
|
223 |
+
.ui-icon-info { background-position: -16px -144px; }
|
224 |
+
.ui-icon-notice { background-position: -32px -144px; }
|
225 |
+
.ui-icon-help { background-position: -48px -144px; }
|
226 |
+
.ui-icon-check { background-position: -64px -144px; }
|
227 |
+
.ui-icon-bullet { background-position: -80px -144px; }
|
228 |
+
.ui-icon-radio-off { background-position: -96px -144px; }
|
229 |
+
.ui-icon-radio-on { background-position: -112px -144px; }
|
230 |
+
.ui-icon-pin-w { background-position: -128px -144px; }
|
231 |
+
.ui-icon-pin-s { background-position: -144px -144px; }
|
232 |
+
.ui-icon-play { background-position: 0 -160px; }
|
233 |
+
.ui-icon-pause { background-position: -16px -160px; }
|
234 |
+
.ui-icon-seek-next { background-position: -32px -160px; }
|
235 |
+
.ui-icon-seek-prev { background-position: -48px -160px; }
|
236 |
+
.ui-icon-seek-end { background-position: -64px -160px; }
|
237 |
+
.ui-icon-seek-start { background-position: -80px -160px; }
|
238 |
+
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
|
239 |
+
.ui-icon-seek-first { background-position: -80px -160px; }
|
240 |
+
.ui-icon-stop { background-position: -96px -160px; }
|
241 |
+
.ui-icon-eject { background-position: -112px -160px; }
|
242 |
+
.ui-icon-volume-off { background-position: -128px -160px; }
|
243 |
+
.ui-icon-volume-on { background-position: -144px -160px; }
|
244 |
+
.ui-icon-power { background-position: 0 -176px; }
|
245 |
+
.ui-icon-signal-diag { background-position: -16px -176px; }
|
246 |
+
.ui-icon-signal { background-position: -32px -176px; }
|
247 |
+
.ui-icon-battery-0 { background-position: -48px -176px; }
|
248 |
+
.ui-icon-battery-1 { background-position: -64px -176px; }
|
249 |
+
.ui-icon-battery-2 { background-position: -80px -176px; }
|
250 |
+
.ui-icon-battery-3 { background-position: -96px -176px; }
|
251 |
+
.ui-icon-circle-plus { background-position: 0 -192px; }
|
252 |
+
.ui-icon-circle-minus { background-position: -16px -192px; }
|
253 |
+
.ui-icon-circle-close { background-position: -32px -192px; }
|
254 |
+
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
255 |
+
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
256 |
+
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
257 |
+
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
258 |
+
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
259 |
+
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
260 |
+
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
261 |
+
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
262 |
+
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
263 |
+
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
264 |
+
.ui-icon-circle-check { background-position: -208px -192px; }
|
265 |
+
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
266 |
+
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
267 |
+
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
268 |
+
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
269 |
+
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
270 |
+
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
271 |
+
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
272 |
+
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
273 |
+
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
274 |
+
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
275 |
+
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
276 |
+
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
277 |
+
|
278 |
+
|
279 |
+
/* Misc visuals
|
280 |
+
----------------------------------*/
|
281 |
+
|
282 |
+
/* Corner radius */
|
283 |
+
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
|
284 |
+
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
|
285 |
+
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
|
286 |
+
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
|
287 |
+
|
288 |
+
/* Overlays */
|
289 |
+
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
|
290 |
+
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
|
291 |
+
* jQuery UI Autocomplete 1.8.16
|
292 |
+
*
|
293 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
294 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
295 |
+
* http://jquery.org/license
|
296 |
+
*
|
297 |
+
* http://docs.jquery.com/UI/Autocomplete#theming
|
298 |
+
*/
|
299 |
+
.ui-autocomplete { position: absolute; cursor: default; }
|
300 |
+
|
301 |
+
/* workarounds */
|
302 |
+
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
|
303 |
+
|
304 |
+
/*
|
305 |
+
* jQuery UI Menu 1.8.16
|
306 |
+
*
|
307 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
308 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
309 |
+
* http://jquery.org/license
|
310 |
+
*
|
311 |
+
* http://docs.jquery.com/UI/Menu#theming
|
312 |
+
*/
|
313 |
+
.ui-menu {
|
314 |
+
list-style:none;
|
315 |
+
padding: 2px;
|
316 |
+
margin: 0;
|
317 |
+
display:block;
|
318 |
+
float: left;
|
319 |
+
}
|
320 |
+
.ui-menu .ui-menu {
|
321 |
+
margin-top: -3px;
|
322 |
+
}
|
323 |
+
.ui-menu .ui-menu-item {
|
324 |
+
margin:0;
|
325 |
+
padding: 0;
|
326 |
+
zoom: 1;
|
327 |
+
float: left;
|
328 |
+
clear: left;
|
329 |
+
width: 100%;
|
330 |
+
}
|
331 |
+
.ui-menu .ui-menu-item a {
|
332 |
+
text-decoration:none;
|
333 |
+
display:block;
|
334 |
+
padding:.2em .4em;
|
335 |
+
line-height:1.5;
|
336 |
+
zoom:1;
|
337 |
+
}
|
338 |
+
.ui-menu .ui-menu-item a.ui-state-hover,
|
339 |
+
.ui-menu .ui-menu-item a.ui-state-active {
|
340 |
+
font-weight: normal;
|
341 |
+
margin: -1px;
|
342 |
+
}
|
css/jquery.tagit.css
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ul.tagit {
|
2 |
+
padding: 1px 5px;
|
3 |
+
overflow: auto;
|
4 |
+
margin-left: inherit; /* usually we don't want the regular ul margins. */
|
5 |
+
margin-right: inherit;
|
6 |
+
width: 47%;
|
7 |
+
border: 1px solid #AAA;
|
8 |
+
}
|
9 |
+
|
10 |
+
ul.tagit li {
|
11 |
+
display: block;
|
12 |
+
float: left;
|
13 |
+
margin: 2px 5px 2px 0;
|
14 |
+
}
|
15 |
+
ul.tagit li.tagit-choice {
|
16 |
+
padding: .2em 18px .2em .5em;
|
17 |
+
position: relative;
|
18 |
+
line-height: inherit;
|
19 |
+
font-size:11px;
|
20 |
+
}
|
21 |
+
ul.tagit li.tagit-new {
|
22 |
+
padding: .25em 4px .25em 0;
|
23 |
+
}
|
24 |
+
|
25 |
+
ul.tagit li.tagit-choice a.tagit-label {
|
26 |
+
cursor: pointer;
|
27 |
+
text-decoration: none;
|
28 |
+
}
|
29 |
+
ul.tagit li.tagit-choice .tagit-close {
|
30 |
+
cursor: pointer;
|
31 |
+
position: absolute;
|
32 |
+
right: .1em;
|
33 |
+
top: 50%;
|
34 |
+
margin-top: -8px;
|
35 |
+
}
|
36 |
+
|
37 |
+
/* used for some custom themes that don't need image icons */
|
38 |
+
ul.tagit li.tagit-choice .tagit-close .text-icon {
|
39 |
+
display: none;
|
40 |
+
}
|
41 |
+
|
42 |
+
ul.tagit li.tagit-choice input {
|
43 |
+
display: block;
|
44 |
+
float: left;
|
45 |
+
margin: 2px 5px 2px 0;
|
46 |
+
}
|
47 |
+
ul.tagit input[type="text"] {
|
48 |
+
-moz-box-sizing: border-box;
|
49 |
+
-webkit-box-sizing: border-box;
|
50 |
+
box-sizing: border-box;
|
51 |
+
|
52 |
+
border: none;
|
53 |
+
margin: 0;
|
54 |
+
padding: 0;
|
55 |
+
width: inherit;
|
56 |
+
background-color: inherit;
|
57 |
+
outline: none;
|
58 |
+
font-size:11px;
|
59 |
+
}
|
gfcptaddon.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Gravity Forms + Custom Post Types
|
4 |
Plugin URI: http://themergency.com/plugins/gravity-forms-custom-post-types/
|
5 |
Description: Allows a simple way to map a Gravity Form post entry to a custom post type. Also include custom taxonomies.
|
6 |
-
Version:
|
7 |
Author: Brad Vincent
|
8 |
Author URI: http://themergency.com/
|
9 |
License: GPL2
|
@@ -27,22 +27,22 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
27 |
*/
|
28 |
|
29 |
// Include Gravity Forms
|
30 |
-
if (!class_exists('RGForms'))
|
31 |
-
@include_once(WP_PLUGIN_DIR . '/gravityforms/gravityforms.php');
|
32 |
-
if (!class_exists('RGFormsModel'))
|
33 |
-
@include_once(WP_PLUGIN_DIR . '/gravityforms/forms_model.php');
|
34 |
-
if (!class_exists('GFCommon'))
|
35 |
-
@include_once(WP_PLUGIN_DIR . '/gravityforms/common.php');
|
36 |
|
37 |
-
add_action('init', array('GFCPTAddon', 'init'));
|
38 |
-
add_action('admin_notices', array('GFCPTAddon', 'admin_warnings'));
|
39 |
|
40 |
class GFCPTAddon {
|
41 |
|
42 |
private static $name = 'Gravity Forms + Custom Post Types';
|
43 |
private static $slug = 'GFCPTAddon';
|
44 |
private static $version = '2.0';
|
45 |
-
private static $min_gravityforms_version = '1.
|
46 |
|
47 |
//Plugin starting point. Will load appropriate files
|
48 |
public static function init(){
|
@@ -54,17 +54,12 @@ class GFCPTAddon {
|
|
54 |
//include the base class
|
55 |
require_once(self::get_base_path() . '/gfcptaddonbase.php');
|
56 |
|
57 |
-
//
|
58 |
-
|
59 |
-
|
60 |
-
$gf_cpt_addon = new GFCPTAddon1_5();
|
61 |
-
} else {
|
62 |
-
require_once(self::get_base_path() . '/gfcptaddon_1-4.php');
|
63 |
-
$gf_cpt_addon = new GFCPTAddon1_4();
|
64 |
-
}
|
65 |
|
66 |
//start me up!
|
67 |
-
$gf_cpt_addon->init();
|
68 |
}
|
69 |
}
|
70 |
|
3 |
Plugin Name: Gravity Forms + Custom Post Types
|
4 |
Plugin URI: http://themergency.com/plugins/gravity-forms-custom-post-types/
|
5 |
Description: Allows a simple way to map a Gravity Form post entry to a custom post type. Also include custom taxonomies.
|
6 |
+
Version: 3
|
7 |
Author: Brad Vincent
|
8 |
Author URI: http://themergency.com/
|
9 |
License: GPL2
|
27 |
*/
|
28 |
|
29 |
// Include Gravity Forms
|
30 |
+
//if (!class_exists('RGForms'))
|
31 |
+
// @include_once(WP_PLUGIN_DIR . '/gravityforms/gravityforms.php');
|
32 |
+
//if (!class_exists('RGFormsModel'))
|
33 |
+
// @include_once(WP_PLUGIN_DIR . '/gravityforms/forms_model.php');
|
34 |
+
//if (!class_exists('GFCommon'))
|
35 |
+
// @include_once(WP_PLUGIN_DIR . '/gravityforms/common.php');
|
36 |
|
37 |
+
add_action('init', array('GFCPTAddon', 'init'), 20);
|
38 |
+
add_action('admin_notices', array('GFCPTAddon', 'admin_warnings'), 20);
|
39 |
|
40 |
class GFCPTAddon {
|
41 |
|
42 |
private static $name = 'Gravity Forms + Custom Post Types';
|
43 |
private static $slug = 'GFCPTAddon';
|
44 |
private static $version = '2.0';
|
45 |
+
private static $min_gravityforms_version = '1.5';
|
46 |
|
47 |
//Plugin starting point. Will load appropriate files
|
48 |
public static function init(){
|
54 |
//include the base class
|
55 |
require_once(self::get_base_path() . '/gfcptaddonbase.php');
|
56 |
|
57 |
+
//only supports 1.5 and over
|
58 |
+
require_once(self::get_base_path() . '/gfcptaddon_1-5.php');
|
59 |
+
$gf_cpt_addon = new GFCPTAddon1_5();
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
//start me up!
|
62 |
+
$gf_cpt_addon->init(_FILE_);
|
63 |
}
|
64 |
}
|
65 |
|
gfcptaddon_1-4.php
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (!class_exists('GFCPTAddon1_4')) {
|
4 |
-
|
5 |
-
class GFCPTAddon1_4 extends GFCPTAddonBase {
|
6 |
-
|
7 |
-
/*
|
8 |
-
* Override. Extract taxonomy from CSS class name
|
9 |
-
*/
|
10 |
-
function get_field_taxonomy( $field ) {
|
11 |
-
return self::extract_value( $field['cssClass'], 'taxonomy-' );
|
12 |
-
}
|
13 |
-
|
14 |
-
/*
|
15 |
-
* Override. Extract post type from CSS class name
|
16 |
-
*/
|
17 |
-
function get_form_post_type( $form ) {
|
18 |
-
$cpt = self::extract_value( $form['cssClass'], 'posttype-' );
|
19 |
-
if ( !$cpt ) {
|
20 |
-
//try to extract it from the post title field
|
21 |
-
foreach ( $form['fields'] as $field ) {
|
22 |
-
if ( $field['type'] == 'post_title' )
|
23 |
-
return self::extract_value( $field['cssClass'], 'posttype-' );
|
24 |
-
|
25 |
-
}
|
26 |
-
}
|
27 |
-
return $cpt;
|
28 |
-
}
|
29 |
-
|
30 |
-
/*
|
31 |
-
* extract the css class name by prefix
|
32 |
-
*/
|
33 |
-
private static function extract_value( $class_names, $prefix ) {
|
34 |
-
$classes = explode(' ', $class_names);
|
35 |
-
|
36 |
-
foreach($classes as $class) {
|
37 |
-
//check if the class starts with $prefix
|
38 |
-
if(GFCPTAddon::starts_with($class, $prefix)) {
|
39 |
-
return str_replace($prefix, '', $class);
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
return false;
|
44 |
-
}
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gfcptaddon_1-5.php
CHANGED
@@ -25,12 +25,25 @@ if (!class_exists('GFCPTAddon1_5')) {
|
|
25 |
add_filter('gform_tooltips', array(&$this, 'add_gf_tooltips'));
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
/*
|
29 |
* Override. Gets the taxonomy from our new field value
|
30 |
*/
|
31 |
function get_field_taxonomy( $field ) {
|
32 |
if (array_key_exists('populateTaxonomy', $field)) {
|
33 |
return $field['populateTaxonomy'];
|
|
|
|
|
34 |
} else {
|
35 |
return false;
|
36 |
}
|
@@ -47,12 +60,26 @@ if (!class_exists('GFCPTAddon1_5')) {
|
|
47 |
return false;
|
48 |
}
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
/*
|
51 |
* Add tooltips for the new field values
|
52 |
*/
|
53 |
function add_gf_tooltips($tooltips){
|
|
|
|
|
54 |
$tooltips["form_field_custom_taxonomy"] = "<h6>Populate with a Taxonomy</h6>Check this box to populate this field from a custom taxonomy.";
|
55 |
-
$tooltips["form_field_custom_post_type"] = "<h6>Save As
|
|
|
|
|
56 |
return $tooltips;
|
57 |
}
|
58 |
|
@@ -60,7 +87,6 @@ if (!class_exists('GFCPTAddon1_5')) {
|
|
60 |
* Add some advanced settings to the fields
|
61 |
*/
|
62 |
function render_field_advanced_settings($position, $form_id){
|
63 |
-
|
64 |
if($position == 50){
|
65 |
?>
|
66 |
<li class="populate_with_taxonomy_field_setting field_setting" style="display:list-item;">
|
@@ -81,16 +107,40 @@ if (!class_exists('GFCPTAddon1_5')) {
|
|
81 |
<option value="<?php echo $taxonomy->name; ?>"><?php echo $taxonomy->label; ?></option>
|
82 |
<?php endforeach; ?>
|
83 |
</select>
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
</li>
|
86 |
<li class="custom_post_type_field_setting field_setting" style="display:list-item;">
|
87 |
<input type="checkbox" id="field_enable_custom_post_type" />
|
88 |
<label for="field_enable_custom_post_type" class="inline">
|
89 |
-
<?php _e("Save As
|
90 |
</label>
|
91 |
<?php gform_tooltip("form_field_custom_post_type") ?><br />
|
92 |
<select id="field_populate_custom_post_type" onchange="SetFieldProperty('saveAsCPT', jQuery(this).val());" style="margin-top:10px; display:none;">
|
93 |
-
<option value="" style="color:#999;">Select a
|
94 |
<?php
|
95 |
$args=array(
|
96 |
'public' => true
|
@@ -100,7 +150,34 @@ if (!class_exists('GFCPTAddon1_5')) {
|
|
100 |
<option value="<?php echo $post_type->name; ?>"><?php echo $post_type->label; ?></option>
|
101 |
<?php endforeach; ?>
|
102 |
</select>
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
</li>
|
105 |
<?php
|
106 |
}
|
@@ -116,8 +193,12 @@ if (!class_exists('GFCPTAddon1_5')) {
|
|
116 |
|
117 |
jQuery(document).bind("gform_load_field_settings", function(event, field, form){
|
118 |
//only show taxonomy for selects and radios
|
119 |
-
var valid_types = new Array('select', 'radio', 'checkbox');
|
|
|
|
|
|
|
120 |
if(jQuery.inArray(field['type'], valid_types) != -1) {
|
|
|
121 |
var $taxonomy_setting_container = jQuery(".populate_with_taxonomy_field_setting");
|
122 |
//show the setting container!
|
123 |
$taxonomy_setting_container.show();
|
@@ -134,6 +215,36 @@ if (!class_exists('GFCPTAddon1_5')) {
|
|
134 |
$taxonomy_setting_container.find("input:checkbox").removeAttr("checked");
|
135 |
$taxonomy_setting_container.find("select").val('').hide();
|
136 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
} else if (field['type'] == 'post_title') {
|
138 |
var $cpt_setting_container = jQuery(".custom_post_type_field_setting");
|
139 |
|
@@ -150,6 +261,35 @@ if (!class_exists('GFCPTAddon1_5')) {
|
|
150 |
$cpt_setting_container.find("input:checkbox").removeAttr("checked");
|
151 |
$cpt_setting_container.find("select").val('').hide();
|
152 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
}
|
154 |
});
|
155 |
|
@@ -158,6 +298,19 @@ if (!class_exists('GFCPTAddon1_5')) {
|
|
158 |
var $select = jQuery(this).parent(".populate_with_taxonomy_field_setting:first").find("select");
|
159 |
if(checked){
|
160 |
$select.slideDown();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
} else {
|
162 |
SetFieldProperty('populateTaxonomy','');
|
163 |
$select.slideUp();
|
@@ -175,6 +328,40 @@ if (!class_exists('GFCPTAddon1_5')) {
|
|
175 |
}
|
176 |
});
|
177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
</script>
|
179 |
<?php
|
180 |
}
|
25 |
add_filter('gform_tooltips', array(&$this, 'add_gf_tooltips'));
|
26 |
}
|
27 |
|
28 |
+
/*
|
29 |
+
* Override. Gets the post type from our new field value
|
30 |
+
*/
|
31 |
+
function get_field_post_type( $field ) {
|
32 |
+
if (array_key_exists('populatePostType', $field)) {
|
33 |
+
return $field['populatePostType'];
|
34 |
+
} else {
|
35 |
+
return false;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
/*
|
40 |
* Override. Gets the taxonomy from our new field value
|
41 |
*/
|
42 |
function get_field_taxonomy( $field ) {
|
43 |
if (array_key_exists('populateTaxonomy', $field)) {
|
44 |
return $field['populateTaxonomy'];
|
45 |
+
} else if (array_key_exists('saveToTaxonomy', $field)) {
|
46 |
+
return $field['saveToTaxonomy'];
|
47 |
} else {
|
48 |
return false;
|
49 |
}
|
60 |
return false;
|
61 |
}
|
62 |
|
63 |
+
function get_form_parent_post_id( $form ) {
|
64 |
+
foreach ( $form['fields'] as $field ) {
|
65 |
+
if ( $field['type'] == 'select' && $field['setParentPost'] ) {
|
66 |
+
$parent_id = RGForms::post('input_'.$field['id']);
|
67 |
+
return $parent_id;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
return 0;
|
71 |
+
}
|
72 |
+
|
73 |
/*
|
74 |
* Add tooltips for the new field values
|
75 |
*/
|
76 |
function add_gf_tooltips($tooltips){
|
77 |
+
$tooltips["form_field_populate_post_type"] = "<h6>Populate with a Post Type</h6>Check this box to populate this field from a specific post type.";
|
78 |
+
$tooltips["form_field_set_parent_post"] = "<h6>Try to set parent</h6>If this is checked, and the form creates a post type, then the parent for the newly created post type will be set from the value of this field. Please note that this only works for heirarcical post typs e.g. pages";
|
79 |
$tooltips["form_field_custom_taxonomy"] = "<h6>Populate with a Taxonomy</h6>Check this box to populate this field from a custom taxonomy.";
|
80 |
+
$tooltips["form_field_custom_post_type"] = "<h6>Save As Post Type</h6>Check this box to save this form to a specific post type.";
|
81 |
+
$tooltips["form_field_save_to_taxonomy"] = "<h6>Save To Taxonomy</h6>Check this box to save this field to a specific custom taxonomy. Please note that the taxonomy must NOT be hierarchical.";
|
82 |
+
$tooltips["form_field_tax_enhanced"] = "<h6>Enable Enhanced UI</h6>By selecting this option, this field will be tranformed into a 'tag input' control which makes it more user-friendly for selecting existing and capturing new taxonomies.";
|
83 |
return $tooltips;
|
84 |
}
|
85 |
|
87 |
* Add some advanced settings to the fields
|
88 |
*/
|
89 |
function render_field_advanced_settings($position, $form_id){
|
|
|
90 |
if($position == 50){
|
91 |
?>
|
92 |
<li class="populate_with_taxonomy_field_setting field_setting" style="display:list-item;">
|
107 |
<option value="<?php echo $taxonomy->name; ?>"><?php echo $taxonomy->label; ?></option>
|
108 |
<?php endforeach; ?>
|
109 |
</select>
|
110 |
+
</li>
|
111 |
+
<li class="populate_with_post_type_field_setting field_setting" style="display:list-item;">
|
112 |
+
<input type="checkbox" class="toggle_setting" id="field_enable_populate_with_post_type" />
|
113 |
+
<label for="field_enable_populate_with_post_type" class="inline">
|
114 |
+
<?php _e("Populate with a Post Type", "gravityforms"); ?>
|
115 |
+
</label>
|
116 |
+
<?php gform_tooltip("form_field_populate_post_type") ?><br />
|
117 |
+
<div style="margin-top:10px; display:none;">
|
118 |
+
<select id="field_populate_post_type" onchange="SetFieldProperty('populatePostType', jQuery(this).val());">
|
119 |
+
<option value="" style="color:#999;">Select a Post Type</option>
|
120 |
+
<?php
|
121 |
+
$args=array(
|
122 |
+
'public' => true
|
123 |
+
);
|
124 |
+
$post_types = get_post_types($args, 'objects');
|
125 |
+
foreach($post_types as $post_type): ?>
|
126 |
+
<option value="<?php echo $post_type->name; ?>"><?php echo $post_type->label; ?></option>
|
127 |
+
<?php endforeach; ?>
|
128 |
+
</select>
|
129 |
+
<input type="checkbox" class="check_parent" onclick="SetFieldProperty('setParentPost', this.checked);" id="field_set_parent_post" />
|
130 |
+
<label for="field_set_parent_post" class="inline">
|
131 |
+
<?php _e("Try to set parent", "gravityforms"); ?>
|
132 |
+
</label>
|
133 |
+
<?php gform_tooltip("form_field_set_parent_post") ?>
|
134 |
+
</div>
|
135 |
</li>
|
136 |
<li class="custom_post_type_field_setting field_setting" style="display:list-item;">
|
137 |
<input type="checkbox" id="field_enable_custom_post_type" />
|
138 |
<label for="field_enable_custom_post_type" class="inline">
|
139 |
+
<?php _e("Save As Post Type", "gravityforms"); ?>
|
140 |
</label>
|
141 |
<?php gform_tooltip("form_field_custom_post_type") ?><br />
|
142 |
<select id="field_populate_custom_post_type" onchange="SetFieldProperty('saveAsCPT', jQuery(this).val());" style="margin-top:10px; display:none;">
|
143 |
+
<option value="" style="color:#999;">Select a Post Type</option>
|
144 |
<?php
|
145 |
$args=array(
|
146 |
'public' => true
|
150 |
<option value="<?php echo $post_type->name; ?>"><?php echo $post_type->label; ?></option>
|
151 |
<?php endforeach; ?>
|
152 |
</select>
|
153 |
+
</li>
|
154 |
+
<li class="save_to_taxonomy_field_setting field_setting" style="display:list-item;">
|
155 |
+
<input type="checkbox" class="toggle_setting" id="field_enable_save_to_taxonomy" />
|
156 |
+
<label for="field_enable_save_to_taxonomy" class="inline">
|
157 |
+
<?php _e("Save To Taxonomy", "gravityforms"); ?>
|
158 |
+
</label>
|
159 |
+
<?php gform_tooltip("form_field_save_to_taxonomy") ?>
|
160 |
+
<div style="margin-top:10px; display:none;">
|
161 |
+
<select id="field_save_to_taxonomy" onchange="SetFieldProperty('saveToTaxonomy', jQuery(this).val());">
|
162 |
+
<option value="" style="color:#999;">Select a Taxonomy</option>
|
163 |
+
<?php
|
164 |
+
$args=array(
|
165 |
+
'public' => true,
|
166 |
+
'_builtin' => false
|
167 |
+
);
|
168 |
+
$taxonomies = get_taxonomies($args, 'objects');
|
169 |
+
foreach($taxonomies as $taxonomy):
|
170 |
+
if ($taxonomy->hierarchical === false) {?>
|
171 |
+
<option value="<?php echo $taxonomy->name; ?>"><?php echo $taxonomy->label; ?></option>
|
172 |
+
<?php } ?>
|
173 |
+
<?php endforeach; ?>
|
174 |
+
</select>
|
175 |
+
<input type="checkbox" class="check_tax_enhanced" onclick="SetFieldProperty('taxonomyEnhanced', this.checked);" id="field_tax_enhanced" />
|
176 |
+
<label for="field_tax_enhanced" class="inline">
|
177 |
+
<?php _e("Enable enhanced UI", "gravityforms"); ?>
|
178 |
+
</label>
|
179 |
+
<?php gform_tooltip("form_field_tax_enhanced") ?>
|
180 |
+
</div>
|
181 |
</li>
|
182 |
<?php
|
183 |
}
|
193 |
|
194 |
jQuery(document).bind("gform_load_field_settings", function(event, field, form){
|
195 |
//only show taxonomy for selects and radios
|
196 |
+
var valid_types = new Array('select', 'radio', 'checkbox', 'multiselect');
|
197 |
+
|
198 |
+
//alert(field['type']);
|
199 |
+
|
200 |
if(jQuery.inArray(field['type'], valid_types) != -1) {
|
201 |
+
|
202 |
var $taxonomy_setting_container = jQuery(".populate_with_taxonomy_field_setting");
|
203 |
//show the setting container!
|
204 |
$taxonomy_setting_container.show();
|
215 |
$taxonomy_setting_container.find("input:checkbox").removeAttr("checked");
|
216 |
$taxonomy_setting_container.find("select").val('').hide();
|
217 |
}
|
218 |
+
|
219 |
+
if (field['type'] == 'select') {
|
220 |
+
var $populate_post_type_container = jQuery(".populate_with_post_type_field_setting");
|
221 |
+
$populate_post_type_container.show();
|
222 |
+
|
223 |
+
//get the saved post type
|
224 |
+
var populatePostType = (typeof field['populatePostType'] != 'undefined' && field['populatePostType'] != '') ? field['populatePostType'] : false;
|
225 |
+
|
226 |
+
if (populatePostType != false) {
|
227 |
+
//check the checkbox if previously checked
|
228 |
+
$populate_post_type_container.find("input.toggle_setting").attr("checked", "checked");
|
229 |
+
//set the select
|
230 |
+
$populate_post_type_container.find("select").val(populatePostType);
|
231 |
+
//show the div
|
232 |
+
$populate_post_type_container.find("div").show();
|
233 |
+
|
234 |
+
//get the saved check for setting the parent post
|
235 |
+
var setParent = (typeof field['setParentPost'] != 'undefined' && field['setParentPost'] != '') ? field['setParentPost'] : false;
|
236 |
+
if (setParent != false) {
|
237 |
+
$populate_post_type_container.find(".check_parent").attr("checked", "checked");
|
238 |
+
} else {
|
239 |
+
$populate_post_type_container.find(".check_parent").removeAttr("checked");
|
240 |
+
}
|
241 |
+
} else {
|
242 |
+
$taxonomy_setting_container.find("input.toggle_setting").removeAttr("checked");
|
243 |
+
$taxonomy_setting_container.find("select").val('');
|
244 |
+
}
|
245 |
+
|
246 |
+
}
|
247 |
+
|
248 |
} else if (field['type'] == 'post_title') {
|
249 |
var $cpt_setting_container = jQuery(".custom_post_type_field_setting");
|
250 |
|
261 |
$cpt_setting_container.find("input:checkbox").removeAttr("checked");
|
262 |
$cpt_setting_container.find("select").val('').hide();
|
263 |
}
|
264 |
+
} else if (field['type'] == 'text') {
|
265 |
+
var $tax_setting_container = jQuery('.save_to_taxonomy_field_setting');
|
266 |
+
|
267 |
+
$tax_setting_container.show();
|
268 |
+
|
269 |
+
var saveToTax = (typeof field['saveToTaxonomy'] != 'undefined' && field['saveToTaxonomy'] != '') ? field['saveToTaxonomy'] : false;
|
270 |
+
|
271 |
+
if (saveToTax != false) {
|
272 |
+
//check the checkbox if previously checked
|
273 |
+
$tax_setting_container.find("input.toggle_setting").attr("checked", "checked");
|
274 |
+
//set the select
|
275 |
+
$tax_setting_container.find("select").val(saveToTax);
|
276 |
+
//show the div
|
277 |
+
$tax_setting_container.find("div").show();
|
278 |
+
|
279 |
+
//get the saved check for using enhanced UI
|
280 |
+
var useEnhancedUI = (typeof field['taxonomyEnhanced'] != 'undefined' && field['taxonomyEnhanced'] != '') ? field['taxonomyEnhanced'] : false;
|
281 |
+
if (useEnhancedUI != false) {
|
282 |
+
$tax_setting_container.find(".check_tax_enhanced").attr("checked", "checked");
|
283 |
+
} else {
|
284 |
+
$tax_setting_container.find(".check_tax_enhanced").removeAttr("checked");
|
285 |
+
}
|
286 |
+
|
287 |
+
} else {
|
288 |
+
$tax_setting_container.find("input.toggle_setting").removeAttr("checked");
|
289 |
+
$tax_setting_container.find("div").hide();
|
290 |
+
$tax_setting_container.find(".check_tax_enhanced").removeAttr("checked");
|
291 |
+
$tax_setting_container.find("select").val('');
|
292 |
+
}
|
293 |
}
|
294 |
});
|
295 |
|
298 |
var $select = jQuery(this).parent(".populate_with_taxonomy_field_setting:first").find("select");
|
299 |
if(checked){
|
300 |
$select.slideDown();
|
301 |
+
|
302 |
+
//uncheck post type
|
303 |
+
var $pt_container = jQuery(this).parents("ul:first").find(".populate_with_post_type_field_setting:first");
|
304 |
+
var $pt_check = $pt_container.find("input.toggle_setting");
|
305 |
+
var $pt_div = $pt_container.find("div");
|
306 |
+
if ($pt_check.is(":checked")) {
|
307 |
+
|
308 |
+
SetFieldProperty('populatePostType','');
|
309 |
+
$pt_div.slideUp();
|
310 |
+
$pt_check.removeAttr('checked');
|
311 |
+
|
312 |
+
}
|
313 |
+
|
314 |
} else {
|
315 |
SetFieldProperty('populateTaxonomy','');
|
316 |
$select.slideUp();
|
328 |
}
|
329 |
});
|
330 |
|
331 |
+
jQuery(".populate_with_post_type_field_setting .toggle_setting").click(function() {
|
332 |
+
var checked = jQuery(this).is(":checked");
|
333 |
+
var $div = jQuery(this).parent(".populate_with_post_type_field_setting:first").find("div");
|
334 |
+
if(checked){
|
335 |
+
$div.slideDown();
|
336 |
+
//uncheck taxonomy
|
337 |
+
var $tax_container = jQuery(this).parents("ul:first").find(".populate_with_taxonomy_field_setting:first");
|
338 |
+
var $tax_check = $tax_container.find("input:checkbox");
|
339 |
+
var $tax_select = $tax_container.find("select");
|
340 |
+
if ($tax_check.is(":checked")) {
|
341 |
+
|
342 |
+
SetFieldProperty('populateTaxonomy','');
|
343 |
+
$tax_select.slideUp();
|
344 |
+
$tax_check.removeAttr('checked');
|
345 |
+
|
346 |
+
}
|
347 |
+
|
348 |
+
} else {
|
349 |
+
SetFieldProperty('populatePostType','');
|
350 |
+
$div.slideUp();
|
351 |
+
}
|
352 |
+
});
|
353 |
+
|
354 |
+
jQuery(".save_to_taxonomy_field_setting .toggle_setting").click(function() {
|
355 |
+
var checked = jQuery(this).is(":checked");
|
356 |
+
var $div = jQuery(this).parent(".save_to_taxonomy_field_setting:first").find("div");
|
357 |
+
if(checked){
|
358 |
+
$div.slideDown();
|
359 |
+
} else {
|
360 |
+
SetFieldProperty('saveToTaxonomy','');
|
361 |
+
$div.slideUp();
|
362 |
+
}
|
363 |
+
});
|
364 |
+
|
365 |
</script>
|
366 |
<?php
|
367 |
}
|
gfcptaddonbase.php
CHANGED
@@ -7,46 +7,182 @@ if (!class_exists('GFCPTAddonBase')) {
|
|
7 |
*/
|
8 |
class GFCPTAddonBase {
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
/*
|
11 |
* Main initilize method for wiring up all the hooks
|
12 |
*/
|
13 |
public function init() {
|
14 |
//alter the way forms are rendered by inserting taxomony dropdowns,radios and checkboxes
|
15 |
add_filter('gform_pre_render' , array(&$this, 'setup_form') );
|
|
|
|
|
|
|
16 |
|
17 |
//alter the form for submission - this is mainly for checkboxes
|
18 |
add_filter('gform_pre_submission_filter', array(&$this, 'setup_form') );
|
19 |
|
20 |
//set the post type when saving a post
|
21 |
-
add_filter("gform_post_data", array(&$this, '
|
22 |
|
23 |
//intercept the form save and save any taxonomy links if needed
|
24 |
add_action('gform_post_submission', array(&$this, 'save_taxonomies'), 10, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
|
27 |
/*
|
28 |
-
* Setup the form with any taxonomies
|
29 |
*/
|
30 |
function setup_form( $form ) {
|
31 |
|
32 |
//loop thru all fields
|
33 |
foreach($form['fields'] as &$field) {
|
|
|
34 |
//see if the field is using a taxonomy
|
35 |
$taxonomy = $this->get_field_taxonomy( $field );
|
36 |
|
37 |
-
if(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
continue;
|
|
|
39 |
|
40 |
-
|
41 |
}
|
42 |
|
43 |
return $form;
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
/*
|
47 |
-
* Set the post
|
48 |
*/
|
49 |
-
function
|
50 |
|
51 |
//check if the form saves a post
|
52 |
if ( $this->is_form_a_post_form($form) ) {
|
@@ -54,6 +190,13 @@ if (!class_exists('GFCPTAddonBase')) {
|
|
54 |
|
55 |
if ($target_post_type)
|
56 |
$post_data["post_type"] = $target_post_type;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
return $post_data;
|
59 |
|
@@ -86,6 +229,72 @@ if (!class_exists('GFCPTAddonBase')) {
|
|
86 |
return null;
|
87 |
}
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
/*
|
91 |
* setup a field if it is linked to a taxonomy
|
@@ -118,7 +327,7 @@ if (!class_exists('GFCPTAddonBase')) {
|
|
118 |
|
119 |
if ($type === 'select') {
|
120 |
$terms = $this->load_taxonomy_hierarchical( $taxonomy );
|
121 |
-
if ($first_choice === ''){
|
122 |
// if no default option is specified, dynamically create based on taxonomy name
|
123 |
$taxonomy = get_taxonomy($taxonomy);
|
124 |
$choices[] = array('text' => "-- select a {$taxonomy->labels->singular_name} --", 'value' => '');
|
@@ -129,8 +338,10 @@ if (!class_exists('GFCPTAddonBase')) {
|
|
129 |
$terms = get_terms($taxonomy, 'orderby=name&hide_empty=0');
|
130 |
}
|
131 |
|
132 |
-
|
133 |
-
|
|
|
|
|
134 |
}
|
135 |
|
136 |
return $choices;
|
@@ -147,7 +358,12 @@ if (!class_exists('GFCPTAddonBase')) {
|
|
147 |
'hide_empty' => 0
|
148 |
);
|
149 |
$terms = get_categories( $args );
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
151 |
}
|
152 |
|
153 |
/*
|
@@ -195,7 +411,10 @@ if (!class_exists('GFCPTAddonBase')) {
|
|
195 |
}
|
196 |
if ( !empty ( $term_ids ))
|
197 |
wp_set_object_terms( $entry['post_id'], $term_ids, $taxonomy, true );
|
198 |
-
|
|
|
|
|
|
|
199 |
} else {
|
200 |
$term_id = (int) $entry[$field['id']];
|
201 |
if ( $term_id > 0 )
|
7 |
*/
|
8 |
class GFCPTAddonBase {
|
9 |
|
10 |
+
protected $_has_tag_inputs = false;
|
11 |
+
protected $_included_js;
|
12 |
+
protected $_tag_inputs = array();
|
13 |
+
protected $_tag_map = array();
|
14 |
+
protected $_tag_terms = array();
|
15 |
+
|
16 |
+
|
17 |
/*
|
18 |
* Main initilize method for wiring up all the hooks
|
19 |
*/
|
20 |
public function init() {
|
21 |
//alter the way forms are rendered by inserting taxomony dropdowns,radios and checkboxes
|
22 |
add_filter('gform_pre_render' , array(&$this, 'setup_form') );
|
23 |
+
|
24 |
+
//alter the way forms are rendered by the admin too!
|
25 |
+
add_filter('gform_admin_pre_render' , array(&$this, 'setup_form') );
|
26 |
|
27 |
//alter the form for submission - this is mainly for checkboxes
|
28 |
add_filter('gform_pre_submission_filter', array(&$this, 'setup_form') );
|
29 |
|
30 |
//set the post type when saving a post
|
31 |
+
add_filter("gform_post_data", array(&$this, 'set_post_values'), 10, 2);
|
32 |
|
33 |
//intercept the form save and save any taxonomy links if needed
|
34 |
add_action('gform_post_submission', array(&$this, 'save_taxonomies'), 10, 2);
|
35 |
+
|
36 |
+
//enqueue scripts to the page
|
37 |
+
add_action('gform_enqueue_scripts', array(&$this, 'enqueue_custom_scripts'), 10, 2);
|
38 |
+
|
39 |
+
add_action('wp_print_scripts', array(&$this, 'enqueue_scripts'), 10, 2);
|
40 |
+
|
41 |
+
add_filter("gform_preview_styles", array(&$this, 'preview_print_styles'), 10, 2);
|
42 |
}
|
43 |
|
44 |
/*
|
45 |
+
* Setup the form with any taxonomies etc
|
46 |
*/
|
47 |
function setup_form( $form ) {
|
48 |
|
49 |
//loop thru all fields
|
50 |
foreach($form['fields'] as &$field) {
|
51 |
+
|
52 |
//see if the field is using a taxonomy
|
53 |
$taxonomy = $this->get_field_taxonomy( $field );
|
54 |
|
55 |
+
if($taxonomy) {
|
56 |
+
$this->setup_taxonomy_field( $field, $taxonomy );
|
57 |
+
continue;
|
58 |
+
}
|
59 |
+
|
60 |
+
//if its a select then check if we have set a post type
|
61 |
+
if ($field['type'] == 'select') {
|
62 |
+
|
63 |
+
$post_type = $this->get_field_post_type( $field );
|
64 |
+
|
65 |
+
if ($post_type) {
|
66 |
+
$this->setup_post_type_field( $field, $post_type );
|
67 |
continue;
|
68 |
+
}
|
69 |
|
70 |
+
}
|
71 |
}
|
72 |
|
73 |
return $form;
|
74 |
}
|
75 |
|
76 |
+
function enqueue_scripts() {
|
77 |
+
if ($this->_has_tag_inputs) {
|
78 |
+
$script_block = '';
|
79 |
+
if (sizeof($this->_tag_inputs)>0) {
|
80 |
+
$script_block = 'var gfcpt_tag_inputs = {"tag_inputs": [';
|
81 |
+
$input_ids = array();
|
82 |
+
foreach($this->_tag_inputs as $input_id => $taxonomy) {
|
83 |
+
$input_ids[] = '{input: "'.$input_id.'", taxonomy: "'.$taxonomy.'"}';
|
84 |
+
}
|
85 |
+
$script_block .= implode(', ', $input_ids);
|
86 |
+
$script_block .= ']};
|
87 |
+
';
|
88 |
+
}
|
89 |
+
|
90 |
+
if (sizeof($this->_tag_terms)>0) {
|
91 |
+
$script_block .= 'var gfcpt_tag_taxonomies = [];
|
92 |
+
';
|
93 |
+
foreach($this->_tag_terms as $taxonomy => $terms) {
|
94 |
+
$script_block .= 'gfcpt_tag_taxonomies["'.$taxonomy.'"] = ["'.implode('", "', $terms).'"];
|
95 |
+
';
|
96 |
+
}
|
97 |
+
}
|
98 |
+
if (strlen($script_block) > 0) {
|
99 |
+
?>
|
100 |
+
<script type='text/javascript'>
|
101 |
+
<?php
|
102 |
+
echo $script_block;
|
103 |
+
?>
|
104 |
+
</script>
|
105 |
+
<?php
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
function preview_print_styles($styles, $form){
|
111 |
+
return array('gfcpt_jquery_ui_theme', 'gfcpt_tagit_css');
|
112 |
+
}
|
113 |
+
|
114 |
+
function enqueue_custom_scripts($form, $is_ajax) {
|
115 |
+
if (!$is_ajax) {
|
116 |
+
//loop thru all fields
|
117 |
+
foreach($form['fields'] as &$field) {
|
118 |
+
//if its a text field, see if we have set it to save to a taxonomy
|
119 |
+
if ($field['type'] == 'text' && array_key_exists('saveToTaxonomy', $field)) {
|
120 |
+
$saveToTaxonomy = $field['saveToTaxonomy'];
|
121 |
+
|
122 |
+
if (taxonomy_exists($saveToTaxonomy) && array_key_exists('taxonomyEnhanced', $field)) {
|
123 |
+
if ($field['taxonomyEnhanced']) {
|
124 |
+
|
125 |
+
$this->_has_tag_inputs = true;
|
126 |
+
|
127 |
+
$tag_input_id = '#input_'.$form['id'].'_'.$field['id'];
|
128 |
+
|
129 |
+
$this->_tag_inputs[$tag_input_id] = $saveToTaxonomy;
|
130 |
+
|
131 |
+
if ( !array_key_exists($saveToTaxonomy, $this->_tag_terms) ) {
|
132 |
+
//get the existing taxonomies and add them to an array to render later
|
133 |
+
$terms = get_terms($saveToTaxonomy, 'orderby=name&hide_empty=0&fields=names');
|
134 |
+
$this->_tag_terms[$saveToTaxonomy] = $terms;
|
135 |
+
}
|
136 |
+
|
137 |
+
if (!$this->_included_js) {
|
138 |
+
|
139 |
+
//enqueue some scripts for the enhaced UI
|
140 |
+
$this->_included_js = true;
|
141 |
+
|
142 |
+
wp_register_style(
|
143 |
+
$handle = 'gfcpt_jquery_ui_theme',
|
144 |
+
$src = plugins_url( 'css/custom/jquery-ui-1.8.16.custom.css' , __FILE__ ) );
|
145 |
+
wp_enqueue_style('gfcpt_jquery_ui_theme');
|
146 |
+
|
147 |
+
wp_register_style(
|
148 |
+
$handle = 'gfcpt_tagit_css',
|
149 |
+
$src = plugins_url( 'css/jquery.tagit.css' , __FILE__ ) );
|
150 |
+
wp_enqueue_style('gfcpt_tagit_css');
|
151 |
+
|
152 |
+
|
153 |
+
wp_register_script(
|
154 |
+
$handle = 'gfcpt_jquery_ui',
|
155 |
+
$src = plugins_url( 'js/jquery-ui-1.8.16.custom.min.js' , __FILE__ ),
|
156 |
+
$deps = array('jquery') );
|
157 |
+
|
158 |
+
wp_enqueue_script('gfcpt_jquery_ui');
|
159 |
+
|
160 |
+
wp_register_script(
|
161 |
+
$handle = 'gfcpt_tagit_js',
|
162 |
+
$src = plugins_url( 'js/tag-it.js' , __FILE__ ),
|
163 |
+
$deps = array('gfcpt_jquery_ui') );
|
164 |
+
|
165 |
+
wp_enqueue_script('gfcpt_tagit_js');
|
166 |
+
|
167 |
+
wp_register_script(
|
168 |
+
$handle = 'gfcpt_tagit_init_js',
|
169 |
+
$src = plugins_url( 'js/tag-it.init.js' , __FILE__ ),
|
170 |
+
$deps = array('gfcpt_tagit_js') );
|
171 |
+
|
172 |
+
wp_enqueue_script('gfcpt_tagit_init_js');
|
173 |
+
}
|
174 |
+
|
175 |
+
}
|
176 |
+
}
|
177 |
+
}
|
178 |
+
}
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
/*
|
183 |
+
* Set the post values (if neccessary)
|
184 |
*/
|
185 |
+
function set_post_values( $post_data, $form ) {
|
186 |
|
187 |
//check if the form saves a post
|
188 |
if ( $this->is_form_a_post_form($form) ) {
|
190 |
|
191 |
if ($target_post_type)
|
192 |
$post_data["post_type"] = $target_post_type;
|
193 |
+
|
194 |
+
//then check if we have set a parent
|
195 |
+
$parent_post_id = $this->get_form_parent_post_id( $form );
|
196 |
+
|
197 |
+
if ($parent_post_id > 0) {
|
198 |
+
$post_data["post_parent"] = $parent_post_id;
|
199 |
+
}
|
200 |
}
|
201 |
return $post_data;
|
202 |
|
229 |
return null;
|
230 |
}
|
231 |
|
232 |
+
/*
|
233 |
+
* override this to get the post type for a field
|
234 |
+
*/
|
235 |
+
function get_field_post_type( $field ) {
|
236 |
+
return null;
|
237 |
+
}
|
238 |
+
|
239 |
+
/*
|
240 |
+
* override this to get the parent Id for a form
|
241 |
+
*/
|
242 |
+
function get_form_parent_post_id( $form ) {
|
243 |
+
return 0;
|
244 |
+
}
|
245 |
+
|
246 |
+
/*
|
247 |
+
* setup a field if it is linked to a post type
|
248 |
+
*/
|
249 |
+
function setup_post_type_field( &$field, $post_type ) {
|
250 |
+
$first_choice = $field['choices'][0]['text'];
|
251 |
+
$field['choices'] = $this->load_post_type_choices( $post_type, $first_choice );
|
252 |
+
}
|
253 |
+
|
254 |
+
function load_post_type_choices($post_type, $first_choice = '') {
|
255 |
+
$posts = $this->load_posts_hierarchical( $post_type );
|
256 |
+
if ($first_choice === '' || $first_choice === 'First Choice'){
|
257 |
+
// if no default option is specified, dynamically create based on post type name
|
258 |
+
$post_type_obj = get_post_type_object($post_type);
|
259 |
+
$choices[] = array('text' => "-- select a {$post_type_obj->labels->singular_name} --", 'value' => '');
|
260 |
+
} else {
|
261 |
+
$choices[] = array('text' => $first_choice, 'value' => '');
|
262 |
+
}
|
263 |
+
|
264 |
+
foreach($posts as $post) {
|
265 |
+
$choices[] = array('value' => $post->ID, 'text' => $post->post_title);
|
266 |
+
}
|
267 |
+
|
268 |
+
return $choices;
|
269 |
+
}
|
270 |
+
|
271 |
+
/*
|
272 |
+
* Get a hierarchical list of posts
|
273 |
+
*/
|
274 |
+
function load_posts_hierarchical( $post_type ) {
|
275 |
+
$args = array(
|
276 |
+
'post_type' => $post_type,
|
277 |
+
'numberposts' => -1,
|
278 |
+
'orderby' => 'title',
|
279 |
+
'post_status' => 'publish'
|
280 |
+
);
|
281 |
+
$posts = get_posts( $args );
|
282 |
+
return $this->walk_posts( $posts );
|
283 |
+
}
|
284 |
+
|
285 |
+
/*
|
286 |
+
* Helper function to recursively 'walk' the posts
|
287 |
+
*/
|
288 |
+
function walk_posts( $input_array, $parent_id=0, &$out_array=array(), $level=0 ){
|
289 |
+
foreach ( $input_array as $item ) {
|
290 |
+
if ( $item->post_parent == $parent_id ) {
|
291 |
+
$item->post_title = str_repeat('--', $level) . $item->post_title;
|
292 |
+
$out_array[] = $item;
|
293 |
+
$this->walk_posts( $input_array, $item->ID, $out_array, $level+1 );
|
294 |
+
}
|
295 |
+
}
|
296 |
+
return $out_array;
|
297 |
+
}
|
298 |
|
299 |
/*
|
300 |
* setup a field if it is linked to a taxonomy
|
327 |
|
328 |
if ($type === 'select') {
|
329 |
$terms = $this->load_taxonomy_hierarchical( $taxonomy );
|
330 |
+
if ($first_choice === '' || $first_choice === 'First Choice'){
|
331 |
// if no default option is specified, dynamically create based on taxonomy name
|
332 |
$taxonomy = get_taxonomy($taxonomy);
|
333 |
$choices[] = array('text' => "-- select a {$taxonomy->labels->singular_name} --", 'value' => '');
|
338 |
$terms = get_terms($taxonomy, 'orderby=name&hide_empty=0');
|
339 |
}
|
340 |
|
341 |
+
if ( !array_key_exists("errors",$terms) ) {
|
342 |
+
foreach($terms as $term) {
|
343 |
+
$choices[] = array('value' => $term->term_id, 'text' => $term->name);
|
344 |
+
}
|
345 |
}
|
346 |
|
347 |
return $choices;
|
358 |
'hide_empty' => 0
|
359 |
);
|
360 |
$terms = get_categories( $args );
|
361 |
+
|
362 |
+
if ( array_key_exists("errors",$terms) ) {
|
363 |
+
return $terms;
|
364 |
+
}
|
365 |
+
else
|
366 |
+
return $this->walk_terms( $terms );
|
367 |
}
|
368 |
|
369 |
/*
|
411 |
}
|
412 |
if ( !empty ( $term_ids ))
|
413 |
wp_set_object_terms( $entry['post_id'], $term_ids, $taxonomy, true );
|
414 |
+
} else if ( array_key_exists( 'type', $field ) && $field['type'] == 'text' ) {
|
415 |
+
$terms = $entry[$field['id']];
|
416 |
+
if ( !empty($terms) )
|
417 |
+
wp_set_post_terms( $entry['post_id'], $terms, $taxonomy );
|
418 |
} else {
|
419 |
$term_id = (int) $entry[$field['id']];
|
420 |
if ( $term_id > 0 )
|
js/gfcpt.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
jQuery(function(){
|
2 |
+
alert('!!!!!!');
|
3 |
+
});
|
js/jquery-ui-1.8.16.custom.min.js
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* jQuery UI 1.8.16
|
3 |
+
*
|
4 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
* http://jquery.org/license
|
7 |
+
*
|
8 |
+
* http://docs.jquery.com/UI
|
9 |
+
*/
|
10 |
+
(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16",
|
11 |
+
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=
|
12 |
+
this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
|
13 |
+
"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
|
14 |
+
"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,
|
15 |
+
outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,
|
16 |
+
"tabindex"),d=isNaN(b);return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&
|
17 |
+
a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&
|
18 |
+
c.ui.isOverAxis(b,e,i)}})}})(jQuery);
|
19 |
+
;/*!
|
20 |
+
* jQuery UI Widget 1.8.16
|
21 |
+
*
|
22 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
23 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
24 |
+
* http://jquery.org/license
|
25 |
+
*
|
26 |
+
* http://docs.jquery.com/UI/Widget
|
27 |
+
*/
|
28 |
+
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)try{b(d).triggerHandler("remove")}catch(e){}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(d){}});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=
|
29 |
+
function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):
|
30 |
+
d;if(e&&d.charAt(0)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=
|
31 |
+
b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
|
32 |
+
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
|
33 |
+
c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
|
34 |
+
;/*!
|
35 |
+
* jQuery UI Mouse 1.8.16
|
36 |
+
*
|
37 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
38 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
39 |
+
* http://jquery.org/license
|
40 |
+
*
|
41 |
+
* http://docs.jquery.com/UI/Mouse
|
42 |
+
*
|
43 |
+
* Depends:
|
44 |
+
* jquery.ui.widget.js
|
45 |
+
*/
|
46 |
+
(function(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
|
47 |
+
this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
|
48 |
+
this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(e){return c._mouseMove(e)};this._mouseUpDelegate=function(e){return c._mouseUp(e)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return d=true}},_mouseMove:function(a){if(b.browser.msie&&
|
49 |
+
!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
|
50 |
+
false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
|
51 |
+
;/*
|
52 |
+
* jQuery UI Position 1.8.16
|
53 |
+
*
|
54 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
55 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
56 |
+
* http://jquery.org/license
|
57 |
+
*
|
58 |
+
* http://docs.jquery.com/UI/Position
|
59 |
+
*/
|
60 |
+
(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
|
61 |
+
left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
|
62 |
+
k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
|
63 |
+
m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
|
64 |
+
d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
|
65 |
+
a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
|
66 |
+
g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
|
67 |
+
;/*
|
68 |
+
* jQuery UI Autocomplete 1.8.16
|
69 |
+
*
|
70 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
71 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
72 |
+
* http://jquery.org/license
|
73 |
+
*
|
74 |
+
* http://docs.jquery.com/UI/Autocomplete
|
75 |
+
*
|
76 |
+
* Depends:
|
77 |
+
* jquery.ui.core.js
|
78 |
+
* jquery.ui.widget.js
|
79 |
+
* jquery.ui.position.js
|
80 |
+
*/
|
81 |
+
(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.propAttr("readOnly"))){g=
|
82 |
+
false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=
|
83 |
+
a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};
|
84 |
+
this.menu=d("<ul></ul>").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&&
|
85 |
+
a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");
|
86 |
+
d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&
|
87 |
+
b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source=
|
88 |
+
this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==false)return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(!this.options.disabled&&a&&a.length){a=this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();
|
89 |
+
this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",a)}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return d.map(a,function(b){if(typeof b==="string")return{label:b,value:b};return d.extend({label:b.label||
|
90 |
+
b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();b.show();this._resizeMenu();b.position(d.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new d.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,b){var g=this;
|
91 |
+
d.each(b,function(c,f){g._renderItem(a,f)})},_renderItem:function(a,b){return d("<li></li>").data("item.autocomplete",b).append(d("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
|
92 |
+
"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery);
|
93 |
+
(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
|
94 |
+
-1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.scrollTop(),c=this.element.height();if(b<0)this.element.scrollTop(g+b);else b>=c&&this.element.scrollTop(g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");
|
95 |
+
this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,
|
96 |
+
this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||
|
97 |
+
this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||
|
98 |
+
this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[d.fn.prop?"prop":"attr"]("scrollHeight")},select:function(e){this._trigger("selected",e,{item:this.active})}})})(jQuery);
|
99 |
+
;
|
js/tag-it.init.js
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var sampleTags = ['c++', 'java', 'php', 'coldfusion', 'javascript', 'asp', 'ruby', 'python', 'c', 'scala', 'groovy', 'haskell', 'perl', 'erlang', 'apl', 'cobol', 'go', 'lua'];
|
2 |
+
|
3 |
+
jQuery(function($) {
|
4 |
+
|
5 |
+
|
6 |
+
$.each(gfcpt_tag_inputs.tag_inputs, function() {
|
7 |
+
$(this.input).tagit({
|
8 |
+
availableTags: gfcpt_tag_taxonomies[this.taxonomy],
|
9 |
+
removeConfirmation: true,
|
10 |
+
allowSpaces: true,
|
11 |
+
animate:false
|
12 |
+
});
|
13 |
+
});
|
14 |
+
|
15 |
+
});
|
16 |
+
|
js/tag-it.js
ADDED
@@ -0,0 +1,393 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* jQuery UI Tag-it!
|
3 |
+
*
|
4 |
+
* @version v2.0 (06/2011)
|
5 |
+
*
|
6 |
+
* Copyright 2011, Levy Carneiro Jr.
|
7 |
+
* Released under the MIT license.
|
8 |
+
* http://aehlke.github.com/tag-it/LICENSE
|
9 |
+
*
|
10 |
+
* Homepage:
|
11 |
+
* http://aehlke.github.com/tag-it/
|
12 |
+
*
|
13 |
+
* Authors:
|
14 |
+
* Levy Carneiro Jr.
|
15 |
+
* Martin Rehfeld
|
16 |
+
* Tobias Schmidt
|
17 |
+
* Skylar Challand
|
18 |
+
* Alex Ehlke
|
19 |
+
*
|
20 |
+
* Maintainer:
|
21 |
+
* Alex Ehlke - Twitter: @aehlke
|
22 |
+
*
|
23 |
+
* Dependencies:
|
24 |
+
* jQuery v1.4+
|
25 |
+
* jQuery UI v1.8+
|
26 |
+
*/
|
27 |
+
(function($) {
|
28 |
+
|
29 |
+
$.widget('ui.tagit', {
|
30 |
+
options: {
|
31 |
+
itemName : 'item',
|
32 |
+
fieldName : 'tags',
|
33 |
+
availableTags : [],
|
34 |
+
tagSource : null,
|
35 |
+
removeConfirmation: false,
|
36 |
+
caseSensitive : true,
|
37 |
+
|
38 |
+
// When enabled, quotes are not neccesary
|
39 |
+
// for inputting multi-word tags.
|
40 |
+
allowSpaces: false,
|
41 |
+
|
42 |
+
// Whether to animate tag removals or not.
|
43 |
+
animate: true,
|
44 |
+
|
45 |
+
// The below options are for using a single field instead of several
|
46 |
+
// for our form values.
|
47 |
+
//
|
48 |
+
// When enabled, will use a single hidden field for the form,
|
49 |
+
// rather than one per tag. It will delimit tags in the field
|
50 |
+
// with singleFieldDelimiter.
|
51 |
+
//
|
52 |
+
// The easiest way to use singleField is to just instantiate tag-it
|
53 |
+
// on an INPUT element, in which case singleField is automatically
|
54 |
+
// set to true, and singleFieldNode is set to that element. This
|
55 |
+
// way, you don't need to fiddle with these options.
|
56 |
+
singleField: false,
|
57 |
+
|
58 |
+
singleFieldDelimiter: ',',
|
59 |
+
|
60 |
+
// Set this to an input DOM node to use an existing form field.
|
61 |
+
// Any text in it will be erased on init. But it will be
|
62 |
+
// populated with the text of tags as they are created,
|
63 |
+
// delimited by singleFieldDelimiter.
|
64 |
+
//
|
65 |
+
// If this is not set, we create an input node for it,
|
66 |
+
// with the name given in settings.fieldName,
|
67 |
+
// ignoring settings.itemName.
|
68 |
+
singleFieldNode: null,
|
69 |
+
|
70 |
+
// Optionally set a tabindex attribute on the input that gets
|
71 |
+
// created for tag-it.
|
72 |
+
tabIndex: null,
|
73 |
+
|
74 |
+
|
75 |
+
// Event callbacks.
|
76 |
+
onTagAdded : null,
|
77 |
+
onTagRemoved: null,
|
78 |
+
onTagClicked: null
|
79 |
+
},
|
80 |
+
|
81 |
+
|
82 |
+
_create: function() {
|
83 |
+
// for handling static scoping inside callbacks
|
84 |
+
var that = this;
|
85 |
+
|
86 |
+
// There are 2 kinds of DOM nodes this widget can be instantiated on:
|
87 |
+
// 1. UL, OL, or some element containing either of these.
|
88 |
+
// 2. INPUT, in which case 'singleField' is overridden to true,
|
89 |
+
// a UL is created and the INPUT is hidden.
|
90 |
+
if (this.element.is('input')) {
|
91 |
+
this.tagList = $('<ul></ul>').insertAfter(this.element);
|
92 |
+
this.options.singleField = true;
|
93 |
+
this.options.singleFieldNode = this.element;
|
94 |
+
this.element.css('display', 'none');
|
95 |
+
|
96 |
+
if (!this.options.tabIndex) {
|
97 |
+
this.options.tabIndex = this.element.attr('tabindex');
|
98 |
+
}
|
99 |
+
|
100 |
+
} else {
|
101 |
+
this.tagList = this.element.find('ul, ol').andSelf().last();
|
102 |
+
}
|
103 |
+
|
104 |
+
this._tagInput = $('<input type="text" />').addClass('ui-widget-content');
|
105 |
+
if (this.options.tabIndex) {
|
106 |
+
this._tagInput.attr('tabindex', this.options.tabIndex);
|
107 |
+
}
|
108 |
+
|
109 |
+
this.options.tagSource = this.options.tagSource || function(search, showChoices) {
|
110 |
+
var filter = search.term.toLowerCase();
|
111 |
+
var choices = $.grep(this.options.availableTags, function(element) {
|
112 |
+
// Only match autocomplete options that begin with the search term.
|
113 |
+
// (Case insensitive.)
|
114 |
+
return (element.toLowerCase().indexOf(filter) === 0);
|
115 |
+
});
|
116 |
+
showChoices(this._subtractArray(choices, this.assignedTags()));
|
117 |
+
};
|
118 |
+
|
119 |
+
// Bind tagSource callback functions to this context.
|
120 |
+
if ($.isFunction(this.options.tagSource)) {
|
121 |
+
this.options.tagSource = $.proxy(this.options.tagSource, this);
|
122 |
+
}
|
123 |
+
|
124 |
+
this.tagList
|
125 |
+
.addClass('tagit')
|
126 |
+
//.addClass('ui-widget ui-widget-content ui-corner-all')
|
127 |
+
// Create the input field.
|
128 |
+
.append($('<li class="tagit-new"></li>').append(this._tagInput))
|
129 |
+
.click(function(e) {
|
130 |
+
var target = $(e.target);
|
131 |
+
if (target.hasClass('tagit-label')) {
|
132 |
+
that._trigger('onTagClicked', e, target.closest('.tagit-choice'));
|
133 |
+
} else {
|
134 |
+
// Sets the focus() to the input field, if the user
|
135 |
+
// clicks anywhere inside the UL. This is needed
|
136 |
+
// because the input field needs to be of a small size.
|
137 |
+
that._tagInput.focus();
|
138 |
+
}
|
139 |
+
});
|
140 |
+
|
141 |
+
// Add existing tags from the list, if any.
|
142 |
+
this.tagList.children('li').each(function() {
|
143 |
+
if (!$(this).hasClass('tagit-new')) {
|
144 |
+
that.createTag($(this).html(), $(this).attr('class'));
|
145 |
+
$(this).remove();
|
146 |
+
}
|
147 |
+
});
|
148 |
+
|
149 |
+
// Single field support.
|
150 |
+
if (this.options.singleField) {
|
151 |
+
if (this.options.singleFieldNode) {
|
152 |
+
// Add existing tags from the input field.
|
153 |
+
var node = $(this.options.singleFieldNode);
|
154 |
+
var tags = node.val().split(this.options.singleFieldDelimiter);
|
155 |
+
node.val('');
|
156 |
+
$.each(tags, function(index, tag) {
|
157 |
+
that.createTag(tag);
|
158 |
+
});
|
159 |
+
} else {
|
160 |
+
// Create our single field input after our list.
|
161 |
+
this.options.singleFieldNode = this.tagList.after('<input type="hidden" style="display:none;" value="" name="' + this.options.fieldName + '" />');
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
// Events.
|
166 |
+
this._tagInput
|
167 |
+
.keydown(function(event) {
|
168 |
+
// Backspace is not detected within a keypress, so it must use keydown.
|
169 |
+
if (event.which == $.ui.keyCode.BACKSPACE && that._tagInput.val() === '') {
|
170 |
+
var tag = that._lastTag();
|
171 |
+
if (!that.options.removeConfirmation || tag.hasClass('remove')) {
|
172 |
+
// When backspace is pressed, the last tag is deleted.
|
173 |
+
that.removeTag(tag);
|
174 |
+
} else if (that.options.removeConfirmation) {
|
175 |
+
tag.addClass('remove ui-state-highlight');
|
176 |
+
}
|
177 |
+
} else if (that.options.removeConfirmation) {
|
178 |
+
that._lastTag().removeClass('remove ui-state-highlight');
|
179 |
+
}
|
180 |
+
|
181 |
+
// Comma/Space/Enter are all valid delimiters for new tags,
|
182 |
+
// except when there is an open quote or if setting allowSpaces = true.
|
183 |
+
// Tab will also create a tag, unless the tag input is empty, in which case it isn't caught.
|
184 |
+
if (
|
185 |
+
event.which == $.ui.keyCode.COMMA ||
|
186 |
+
event.which == $.ui.keyCode.ENTER ||
|
187 |
+
(
|
188 |
+
event.which == $.ui.keyCode.TAB &&
|
189 |
+
that._tagInput.val() !== ''
|
190 |
+
) ||
|
191 |
+
(
|
192 |
+
event.which == $.ui.keyCode.SPACE &&
|
193 |
+
that.options.allowSpaces !== true &&
|
194 |
+
(
|
195 |
+
$.trim(that._tagInput.val()).replace( /^s*/, '' ).charAt(0) != '"' ||
|
196 |
+
(
|
197 |
+
$.trim(that._tagInput.val()).charAt(0) == '"' &&
|
198 |
+
$.trim(that._tagInput.val()).charAt($.trim(that._tagInput.val()).length - 1) == '"' &&
|
199 |
+
$.trim(that._tagInput.val()).length - 1 !== 0
|
200 |
+
)
|
201 |
+
)
|
202 |
+
)
|
203 |
+
) {
|
204 |
+
event.preventDefault();
|
205 |
+
that.createTag(that._cleanedInput());
|
206 |
+
|
207 |
+
// The autocomplete doesn't close automatically when TAB is pressed.
|
208 |
+
// So let's ensure that it closes.
|
209 |
+
that._tagInput.autocomplete('close');
|
210 |
+
}
|
211 |
+
}).blur(function(e){
|
212 |
+
// Create a tag when the element loses focus (unless it's empty).
|
213 |
+
that.createTag(that._cleanedInput());
|
214 |
+
});
|
215 |
+
|
216 |
+
|
217 |
+
// Autocomplete.
|
218 |
+
if (this.options.availableTags || this.options.tagSource) {
|
219 |
+
this._tagInput.autocomplete({
|
220 |
+
source: this.options.tagSource,
|
221 |
+
select: function(event, ui) {
|
222 |
+
// Delete the last tag if we autocomplete something despite the input being empty
|
223 |
+
// This happens because the input's blur event causes the tag to be created when
|
224 |
+
// the user clicks an autocomplete item.
|
225 |
+
// The only artifact of this is that while the user holds down the mouse button
|
226 |
+
// on the selected autocomplete item, a tag is shown with the pre-autocompleted text,
|
227 |
+
// and is changed to the autocompleted text upon mouseup.
|
228 |
+
if (that._tagInput.val() === '') {
|
229 |
+
that.removeTag(that._lastTag(), false);
|
230 |
+
}
|
231 |
+
that.createTag(ui.item.value);
|
232 |
+
// Preventing the tag input to be updated with the chosen value.
|
233 |
+
return false;
|
234 |
+
}
|
235 |
+
});
|
236 |
+
}
|
237 |
+
},
|
238 |
+
|
239 |
+
_cleanedInput: function() {
|
240 |
+
// Returns the contents of the tag input, cleaned and ready to be passed to createTag
|
241 |
+
return $.trim(this._tagInput.val().replace(/^"(.*)"$/, '$1'));
|
242 |
+
},
|
243 |
+
|
244 |
+
_lastTag: function() {
|
245 |
+
return this.tagList.children('.tagit-choice:last');
|
246 |
+
},
|
247 |
+
|
248 |
+
assignedTags: function() {
|
249 |
+
// Returns an array of tag string values
|
250 |
+
var that = this;
|
251 |
+
var tags = [];
|
252 |
+
if (this.options.singleField) {
|
253 |
+
tags = $(this.options.singleFieldNode).val().split(this.options.singleFieldDelimiter);
|
254 |
+
if (tags[0] === '') {
|
255 |
+
tags = [];
|
256 |
+
}
|
257 |
+
} else {
|
258 |
+
this.tagList.children('.tagit-choice').each(function() {
|
259 |
+
tags.push(that.tagLabel(this));
|
260 |
+
});
|
261 |
+
}
|
262 |
+
return tags;
|
263 |
+
},
|
264 |
+
|
265 |
+
_updateSingleTagsField: function(tags) {
|
266 |
+
// Takes a list of tag string values, updates this.options.singleFieldNode.val to the tags delimited by this.options.singleFieldDelimiter
|
267 |
+
$(this.options.singleFieldNode).val(tags.join(this.options.singleFieldDelimiter));
|
268 |
+
},
|
269 |
+
|
270 |
+
_subtractArray: function(a1, a2) {
|
271 |
+
var result = [];
|
272 |
+
for (var i = 0; i < a1.length; i++) {
|
273 |
+
if ($.inArray(a1[i], a2) == -1) {
|
274 |
+
result.push(a1[i]);
|
275 |
+
}
|
276 |
+
}
|
277 |
+
return result;
|
278 |
+
},
|
279 |
+
|
280 |
+
tagLabel: function(tag) {
|
281 |
+
// Returns the tag's string label.
|
282 |
+
if (this.options.singleField) {
|
283 |
+
return $(tag).children('.tagit-label').text();
|
284 |
+
} else {
|
285 |
+
return $(tag).children('input').val();
|
286 |
+
}
|
287 |
+
},
|
288 |
+
|
289 |
+
_isNew: function(value) {
|
290 |
+
var that = this;
|
291 |
+
var isNew = true;
|
292 |
+
this.tagList.children('.tagit-choice').each(function(i) {
|
293 |
+
if (that._formatStr(value) == that._formatStr(that.tagLabel(this))) {
|
294 |
+
isNew = false;
|
295 |
+
return false;
|
296 |
+
}
|
297 |
+
});
|
298 |
+
return isNew;
|
299 |
+
},
|
300 |
+
|
301 |
+
_formatStr: function(str) {
|
302 |
+
if (this.options.caseSensitive) {
|
303 |
+
return str;
|
304 |
+
}
|
305 |
+
return $.trim(str.toLowerCase());
|
306 |
+
},
|
307 |
+
|
308 |
+
createTag: function(value, additionalClass) {
|
309 |
+
var that = this;
|
310 |
+
// Automatically trims the value of leading and trailing whitespace.
|
311 |
+
value = $.trim(value);
|
312 |
+
|
313 |
+
if (!this._isNew(value) || value === '') {
|
314 |
+
return false;
|
315 |
+
}
|
316 |
+
|
317 |
+
var label = $(this.options.onTagClicked ? '<a class="tagit-label"></a>' : '<span class="tagit-label"></span>').text(value);
|
318 |
+
|
319 |
+
// Create tag.
|
320 |
+
var tag = $('<li></li>')
|
321 |
+
.addClass('tagit-choice ui-widget-content ui-state-default ui-corner-all')
|
322 |
+
.addClass(additionalClass)
|
323 |
+
.append(label);
|
324 |
+
|
325 |
+
// Button for removing the tag.
|
326 |
+
var removeTagIcon = $('<span></span>')
|
327 |
+
.addClass('ui-icon ui-icon-close');
|
328 |
+
var removeTag = $('<a><span class="text-icon">\xd7</span></a>') // \xd7 is an X
|
329 |
+
.addClass('tagit-close')
|
330 |
+
.append(removeTagIcon)
|
331 |
+
.click(function(e) {
|
332 |
+
// Removes a tag when the little 'x' is clicked.
|
333 |
+
that.removeTag(tag);
|
334 |
+
});
|
335 |
+
tag.append(removeTag);
|
336 |
+
|
337 |
+
// Unless options.singleField is set, each tag has a hidden input field inline.
|
338 |
+
if (this.options.singleField) {
|
339 |
+
var tags = this.assignedTags();
|
340 |
+
tags.push(value);
|
341 |
+
this._updateSingleTagsField(tags);
|
342 |
+
} else {
|
343 |
+
var escapedValue = label.html();
|
344 |
+
tag.append('<input type="hidden" style="display:none;" value="' + escapedValue + '" name="' + this.options.itemName + '[' + this.options.fieldName + '][]" />');
|
345 |
+
}
|
346 |
+
|
347 |
+
this._trigger('onTagAdded', null, tag);
|
348 |
+
|
349 |
+
// Cleaning the input.
|
350 |
+
this._tagInput.val('');
|
351 |
+
|
352 |
+
// insert tag
|
353 |
+
this._tagInput.parent().before(tag);
|
354 |
+
},
|
355 |
+
|
356 |
+
removeTag: function(tag, animate) {
|
357 |
+
animate = animate || this.options.animate;
|
358 |
+
|
359 |
+
tag = $(tag);
|
360 |
+
|
361 |
+
this._trigger('onTagRemoved', null, tag);
|
362 |
+
|
363 |
+
if (this.options.singleField) {
|
364 |
+
var tags = this.assignedTags();
|
365 |
+
var removedTagLabel = this.tagLabel(tag);
|
366 |
+
tags = $.grep(tags, function(el){
|
367 |
+
return el != removedTagLabel;
|
368 |
+
});
|
369 |
+
this._updateSingleTagsField(tags);
|
370 |
+
}
|
371 |
+
// Animate the removal.
|
372 |
+
if (animate) {
|
373 |
+
tag.fadeOut('fast').hide('blind', {direction: 'horizontal'}, 'fast', function(){
|
374 |
+
tag.remove();
|
375 |
+
}).dequeue();
|
376 |
+
} else {
|
377 |
+
tag.remove();
|
378 |
+
}
|
379 |
+
},
|
380 |
+
|
381 |
+
removeAll: function() {
|
382 |
+
// Removes all tags.
|
383 |
+
var that = this;
|
384 |
+
this.tagList.children('.tagit-choice').each(function(index, tag) {
|
385 |
+
that.removeTag(tag, false);
|
386 |
+
});
|
387 |
+
}
|
388 |
+
|
389 |
+
});
|
390 |
+
|
391 |
+
})(jQuery);
|
392 |
+
|
393 |
+
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://themergency.com/donate/
|
|
4 |
Tags: form,forms,gravity,gravity form,gravity forms,CPT,custom post types,custom post type,taxonomy,taxonomies
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.2
|
7 |
-
Stable tag:
|
8 |
|
9 |
Easily map your forms that create posts to a custom post type. Also map dropdown select, radio buttons list and checkboxes lists to a custom taxonomy.
|
10 |
|
@@ -13,32 +13,37 @@ Easily map your forms that create posts to a custom post type. Also map dropdown
|
|
13 |
> This plugin is an add-on for the [Gravity Forms Plugin](http://bit.ly/getgravityforms "visit the Gravity Forms website").
|
14 |
> If you don't yet own a license of the best forms plugin for WordPress, go and [buy one now!](http://bit.ly/getgravityforms "purchase Gravity Forms!")
|
15 |
|
16 |
-
Gravity forms allows you to create posts from a form using 'post fields'. By default the submitted form will create a
|
17 |
|
18 |
-
You can also link a custom taxomony to the field types : Drop Downs,
|
19 |
|
20 |
**features**
|
21 |
|
22 |
-
* Map a form to a custom post type
|
23 |
* Map fields (Drop Downs, Multiple Choice or Checkboxes) to a custom taxonomy
|
24 |
-
* Supports
|
25 |
-
* Much easier to map in Gravity Forms v1.5 - just select from a dropdown list
|
26 |
* Ability to have more than 1 taxonomy linked in a form (see screenshots)
|
27 |
* Hierarchical dropdowns for hierarchical taxonomies (see screenshots)
|
|
|
|
|
|
|
|
|
28 |
|
29 |
**How to map a form to a custom post type**
|
30 |
|
31 |
-
|
32 |
-
Eg. adding a CSS class name of "posttype-movies" will save the post to the custom post type of "movies".
|
33 |
-
|
34 |
-
With **v1.5** of Gravity Forms, things get ALOT easier. You no longer need to set values for CSS class names. Rather just select the custom post types and taxonomies from a dropdown. Add a post title field to your form and under the advanced tab, tick the "Save As Custom Post Type" checkbox. A dropdown will appear with the available custom post types. Select the one you want.
|
35 |
|
36 |
**How to link a field to a custom taxonomy**
|
37 |
|
38 |
-
Custom taxonomies can be linked to Drop Downs,
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
|
42 |
|
43 |
== Installation ==
|
44 |
|
@@ -50,16 +55,25 @@ With **v1.5** of Gravity Forms, again things are alot easier. Under the advanced
|
|
50 |
|
51 |
1. An example of what the end result can look like
|
52 |
2. Support for hierarchical taxonomies
|
53 |
-
3. How to map a form to a
|
54 |
-
4. How to map a field to a custom taxonomy
|
55 |
-
5. How to map a
|
56 |
-
6.
|
|
|
57 |
|
58 |
== Changelog ==
|
59 |
|
60 |
-
=
|
61 |
-
*
|
62 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
= 2.0 =
|
65 |
* Added support for both Gravity Forms v1.5 beta and v.1.4.5
|
4 |
Tags: form,forms,gravity,gravity form,gravity forms,CPT,custom post types,custom post type,taxonomy,taxonomies
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.2
|
7 |
+
Stable tag: trunk
|
8 |
|
9 |
Easily map your forms that create posts to a custom post type. Also map dropdown select, radio buttons list and checkboxes lists to a custom taxonomy.
|
10 |
|
13 |
> This plugin is an add-on for the [Gravity Forms Plugin](http://bit.ly/getgravityforms "visit the Gravity Forms website").
|
14 |
> If you don't yet own a license of the best forms plugin for WordPress, go and [buy one now!](http://bit.ly/getgravityforms "purchase Gravity Forms!")
|
15 |
|
16 |
+
Gravity forms allows you to create posts from a form using 'post fields'. By default the submitted form will create a post, but I wanted a way to save a custom post type instead. It can be done quite easily with some php code, but I wanted it to be easier without any code at all. Now it is easy. Maybe too easy :)
|
17 |
|
18 |
+
You can also link a custom taxomony to the field types : Drop Downs, Mulit Selects, Radio Buttons, Checkboxes and Single Line Text. So when the form is displayed a list of terms for the custom taxonomy are listed. And then when the post (or custom post type) is created, it automatically links the post to the selected taxonomy term(s).
|
19 |
|
20 |
**features**
|
21 |
|
22 |
+
* Map a form to a custom post type (using the post title field)
|
23 |
* Map fields (Drop Downs, Multiple Choice or Checkboxes) to a custom taxonomy
|
24 |
+
* Supports Gravity Forms v1.5 and over (including v1.6)
|
|
|
25 |
* Ability to have more than 1 taxonomy linked in a form (see screenshots)
|
26 |
* Hierarchical dropdowns for hierarchical taxonomies (see screenshots)
|
27 |
+
* Populate a dropdown with posts
|
28 |
+
* Ability to set a parent post using the dropdown control
|
29 |
+
* Single line text field can link to taxonomies by entering a comma seperated list
|
30 |
+
* Enhanced UI on single line text fields to show a "tag input" styled control (see screenshots)
|
31 |
|
32 |
**How to map a form to a custom post type**
|
33 |
|
34 |
+
Add a post title field to your form and under the advanced tab, tick the "Save As Post Type" checkbox. A dropdown will appear with the available post types. Select the one you want.
|
|
|
|
|
|
|
35 |
|
36 |
**How to link a field to a custom taxonomy**
|
37 |
|
38 |
+
Custom taxonomies can be linked to Drop Downs, Mulit Selects, Radio Buttons and Checkboxes. Under the advanced tab for your field, tick the "Populate with a Taxonomy" checkbox. A dropdown will appear and you can select your custom taxonomy from the list.
|
39 |
+
|
40 |
+
**How to link the saved post to taxonomies using a single line text field**
|
41 |
+
|
42 |
+
You can also link a Single Line Text field to a taxonomy, so it can be used to input existing and new taxonomy terms. Under the Advanced tab, click "Save to Taxonomy" checkbox and then select the taxonomy from thr drop down. You can also choose to show an advanced UI by checking the "Enable enhanced UI" checkbox. This will enable an awesome "tag input" style control. See screenshot for more info. If the control contains exising terms, then they are linked to the saved post. If there are new terms in the control, then the terms are created and they are also linked.
|
43 |
+
|
44 |
+
**How to set a parent post with the dropdown field**
|
45 |
|
46 |
+
You can now link the dropdown field to a post type and try to make it set the parent item. Under the advanced tab, check the "Populate with Post Type" checkbox. Select the SAME post type that you selected when adding a post title field (above), and check "Try to set parent". This then fills the dropdown with a list of existing posts, so when you save the form and the post is created, it trys to set the parent post to whatever was selected in the dropdown.
|
47 |
|
48 |
== Installation ==
|
49 |
|
55 |
|
56 |
1. An example of what the end result can look like
|
57 |
2. Support for hierarchical taxonomies
|
58 |
+
3. How to map a form to a post type
|
59 |
+
4. How to map a field to a custom taxonomy
|
60 |
+
5. How to map a dropdown field to save the parent post
|
61 |
+
6. Single Line Text field with enhanced UI
|
62 |
+
7. How to map a single line text field to a taxonomy
|
63 |
|
64 |
== Changelog ==
|
65 |
|
66 |
+
= 3.0 =
|
67 |
+
* Removed support for Gravity Forms v1.4.5. Now supports v1.5 and up (including 1.6)
|
68 |
+
* Added support for single line text fields
|
69 |
+
* Added ability to populate a dropdown with posts
|
70 |
+
* Added ability to set a parent post when saving a post form
|
71 |
+
* Multiselect control now supports "populate with taxonomy" too
|
72 |
+
* "first value" default overriden when populating with a taxonomy
|
73 |
+
* Shows taxonomy selections when designing the form
|
74 |
+
* Fixed support for conditional logic
|
75 |
+
* Previews now load taxonomy terms
|
76 |
+
* Previews can show enhanced UI (only in V1.6 and above)
|
77 |
|
78 |
= 2.0 =
|
79 |
* Added support for both Gravity Forms v1.5 beta and v.1.4.5
|
screenshot-3.png
CHANGED
Binary file
|
screenshot-4.png
CHANGED
Binary file
|
screenshot-5.png
CHANGED
Binary file
|
screenshot-6.png
CHANGED
Binary file
|
screenshot-7.png
ADDED
Binary file
|