PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 3.2.7
Pods – Custom Content Types and Fields v3.2.7
trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / components / Roles / ui / edit.php
pods / components / Roles / ui Last commit date
add.php 4 years ago edit.php 4 years ago
edit.php
208 lines
1 <div class="wrap pods-admin">
2 <div id="icon-pods" class="icon32"><br /></div>
3
4 <form action="" method="post" class="pods-submittable pods-form">
5 <div class="pods-submittable-fields">
6 <?php echo PodsForm::field( 'action', 'pods_admin_components', 'hidden' ); ?>
7 <?php echo PodsForm::field( 'component', $component, 'hidden' ); ?>
8 <?php echo PodsForm::field( 'method', $method, 'hidden' ); ?>
9 <?php echo PodsForm::field( 'id', $id, 'hidden' ); ?>
10 <?php echo PodsForm::field( '_wpnonce', wp_create_nonce( 'pods-component-' . $component . '-' . $method ), 'hidden' ); ?>
11
12 <h2 class="italicized"><?php _e( 'Roles &amp; Capabilities: Edit Role', 'pods' ); ?></h2>
13
14 <?php
15 if ( isset( $_GET['do'] ) ) {
16 $action = __( 'saved', 'pods' );
17
18 if ( 'create' == pods_var( 'do', 'get', 'save' ) ) {
19 $action = __( 'created', 'pods' );
20 }
21
22 $message = sprintf( __( '<strong>Success!</strong> %1$s %2$s successfully.', 'pods' ), $obj->item, $action );
23
24 echo $obj->message( $message );
25 }
26 ?>
27
28 <p><?php _e( 'Choose below which Capabilities you would like this existing user role to have.', 'pods' ); ?></p>
29
30 <div id="poststuff" class="poststuff">
31 <div id="post-body" class="metabox-holder columns-2">
32
33 <div id="postbox-container-1" class="postbox-container">
34 <div id="side-sortables" class="meta-box-sortables ui-sortable">
35 <!-- BEGIN PUBLISH DIV -->
36 <div id="submitdiv" class="postbox">
37 <div class="handlediv" title="Click to toggle"><br /></div>
38 <h3 class="hndle"><span><?php _e( 'Manage', 'pods' ); ?></span></h3>
39
40 <div class="inside">
41 <div class="submitbox" id="submitpost">
42 <div id="minor-publishing">
43 <div id="major-publishing-actions">
44 <div id="publishing-action">
45 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
46 <input type="submit" name="publish" id="publish" class="button-primary" value="<?php _e( 'Save', 'pods' ); ?>" accesskey="p" />
47 </div>
48 <!-- /#publishing-action -->
49
50 <div class="clear"></div>
51 </div>
52 <!-- /#major-publishing-actions -->
53 </div>
54 <!-- /#minor-publishing -->
55 </div>
56 <!-- /#submitpost -->
57 </div>
58 <!-- /.inside -->
59 </div>
60 <!-- /#submitdiv --><!-- END PUBLISH DIV --><!-- TODO: minor column fields -->
61 </div>
62 <!-- /#side-sortables -->
63 </div>
64 <!-- /#side-info-column -->
65
66 <div id="postbox-container-2" class="postbox-container">
67 <div id="post-body-content">
68 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
69 <div id="pods-meta-box" class="postbox" style="">
70 <div class="handlediv" title="Click to toggle"><br /></div>
71 <h3 class="hndle">
72 <span>
73 <?php _e( 'Assign the Capabilities for', 'pods' ); ?>
74 <strong><?php echo $role_label; ?></strong>
75 </span>
76 </h3>
77
78 <div class="inside pods-manage-field pods-dependency">
79 <div class="pods-field-option-group">
80 <div class="pods-pick-values pods-pick-checkbox pods-zebra">
81 <p>
82 <a href="#toggle" class="button" id="toggle-all"><?php _e( 'Toggle All Capabilities on / off', 'pods' ); ?></a>
83 </p>
84
85 <ul>
86 <?php
87 $zebra = false;
88
89 foreach ( $capabilities as $capability ) {
90 $checked = false;
91
92 if ( true === (boolean) pods_var( $capability, $role_capabilities, false ) ) {
93 $checked = true;
94 }
95
96 $class = ( $zebra ? 'even' : 'odd' );
97
98 $zebra = ( ! $zebra );
99 ?>
100 <li class="pods-zebra-<?php echo esc_attr( $class ); ?>" data-capability="<?php echo esc_attr( $capability ); ?>">
101 <?php
102 echo PodsForm::field( 'capabilities[' . $capability . ']', pods_var_raw( 'capabilities[' . $capability . ']', 'post', $checked ), 'boolean', [
103 'boolean_yes_label' => $capability,
104 'disable_dfv' => true,
105 ] );
106 ?>
107 </li>
108 <?php
109 }
110 ?>
111 </ul>
112 </div>
113 </div>
114
115 <div class="pods-field-option-group">
116 <p class="pods-field-option-group-label">
117 <?php
118 echo PodsForm::label( 'custom_capabilities[0]', __( 'Custom Capabilities', 'pods' ), __( 'These capabilities will automatically be created and assigned to this role', 'pods' ) );
119 ?>
120 </p>
121
122 <div class="pods-pick-values pods-pick-checkbox">
123 <ul id="custom-capabilities">
124 <li class="pods-repeater hidden">
125 <?php
126 echo PodsForm::field( 'custom_capabilities[--1]', '', 'text', [
127 'disable_dfv' => true,
128 ] );
129 ?>
130 </li>
131 <li>
132 <?php
133 echo PodsForm::field( 'custom_capabilities[0]', '', 'text', [
134 'disable_dfv' => true,
135 ] );
136 ?>
137 </li>
138 </ul>
139
140 <p>
141 <a href="#add-capability" id="add-capability" class="button"><?php _e( 'Add Another Custom Capability', 'pods' ); ?></a>
142 </p>
143 </div>
144 </div>
145 </div>
146 <!-- /.inside -->
147 </div>
148 <!-- /#pods-meta-box -->
149 </div>
150 <!-- /#normal-sortables -->
151
152 <!-- <div id="advanced-sortables" class="meta-box-sortables ui-sortable"></div> -->
153 <!-- /#advanced-sortables -->
154
155 </div>
156 <!-- /#post-body-content -->
157
158 <br class="clear" />
159 </div>
160 <!-- /#post-body -->
161
162 <br class="clear" />
163
164 </div>
165 </div>
166 <!-- /#poststuff -->
167 </div>
168 </form>
169 <!-- /#pods-record -->
170 </div>
171
172 <script type="text/javascript">
173 var pods_admin_submit_callback = function ( id ) {
174 id = parseInt( id );
175 document.location = 'admin.php?page=pods-component-<?php echo esc_js( $component ); ?>&action=edit&id=<?php echo esc_js( $id ); ?>&do=save';
176 };
177
178 jQuery( function ( $ ) {
179 $( document ).Pods( 'validate' );
180 $( document ).Pods( 'submit' );
181 $( document ).Pods( 'wizard' );
182 $( document ).Pods( 'dependency' );
183 $( document ).Pods( 'advanced' );
184 $( document ).Pods( 'confirm' );
185 $( document ).Pods( 'sluggable' );
186
187 var toggle_all = true;
188
189 $( '#toggle-all' ).on( 'click', function ( e ) {
190 e.preventDefault();
191
192 $( '.pods-field.pods-boolean input[type="checkbox"]' ).prop( 'checked', toggle_all );
193
194 toggle_all = (!toggle_all);
195 } );
196
197 $( '#add-capability' ).on( 'click', function ( e ) {
198 e.preventDefault();
199
200 var new_id = $( 'ul#custom-capabilities li' ).length;
201 var html = $( 'ul#custom-capabilities li.pods-repeater' ).html().replace( /\-\-1/g, new_id );
202
203 $( 'ul#custom-capabilities' ).append( '<li id="capability-' + new_id + '">' + html + '</li>' );
204 $( 'li#capability-' + new_id + ' input' ).focus();
205 } );
206 } );
207 </script>
208