upgrade
4 days ago
widgets
4 days ago
components-admin.php
4 days ago
field-option.php
4 days ago
form-settings.php
4 days ago
form.php
4 days ago
help.php
4 days ago
postbox-header.php
4 days ago
settings-reset.php
4 days ago
settings-settings.php
4 days ago
settings-tools.php
4 days ago
settings.php
4 days ago
setup-add.php
4 days ago
setup-edit-field-fluid.php
4 days ago
setup-edit-field.php
4 days ago
setup-edit.php
4 days ago
shortcode.php
4 days ago
view.php
4 days ago
setup-edit-field-fluid.php
311 lines
| 1 | <?php |
| 2 | $field = array_merge( $field_settings['field_defaults'], $field ); |
| 3 | |
| 4 | $pick_object = trim( pods_v_sanitized( 'pick_object', $field ) . '-' . pods_v_sanitized( 'pick_val', $field ), '-' ); |
| 5 | ?> |
| 6 | <tr id="row-<?php echo esc_attr( $pods_i ); ?>" class="pods-manage-row pods-field-new pods-field-<?php echo esc_attr( pods_v_sanitized( 'name', $field ) ) . ( '--1' === $pods_i ? ' flexible-row' : ' pods-submittable-fields' ); ?>" valign="top" data-row="<?php echo esc_attr( $pods_i ); ?>"> |
| 7 | <th scope="row" class="check-field pods-manage-sort"> |
| 8 | <img src="<?php echo esc_url( PODS_URL ); ?>ui/images/handle.gif" alt="<?php esc_attr_e( 'Move', 'pods' ); ?>" /> |
| 9 | </th> |
| 10 | <td class="pods-manage-row-label"> |
| 11 | <strong> |
| 12 | <a class="pods-manage-row-edit row-label" title="<?php esc_attr_e( 'Edit this field', 'pods' ); ?>" href="#edit-field"> |
| 13 | <?php _e( 'New Field', 'pods' ); ?> |
| 14 | </a> <abbr title="required" class="required hidden">*</abbr> </strong> |
| 15 | |
| 16 | <div class="row-actions"> |
| 17 | <span class="edit"> |
| 18 | <a title="<?php esc_attr_e( 'Edit this field', 'pods' ); ?>" class="pods-manage-row-edit" href="#edit-field"><?php _e( 'Edit', 'pods' ); ?></a> | |
| 19 | </span> <span class="duplicate"> |
| 20 | <a title="<?php esc_attr_e( 'Duplicate this field', 'pods' ); ?>" class="pods-manage-row-duplicate" href="#duplicate-field"><?php _e( 'Duplicate', 'pods' ); ?></a> | |
| 21 | </span> <span class="trash pods-manage-row-delete"> |
| 22 | <a class="submitdelete" title="<?php esc_attr_e( 'Delete this field', 'pods' ); ?>" href="#delete-field"><?php _e( 'Delete', 'pods' ); ?></a> |
| 23 | </span> |
| 24 | </div> |
| 25 | <div class="pods-manage-row-wrapper" id="pods-manage-field-<?php echo esc_attr( $pods_i ); ?>"> |
| 26 | <input type="hidden" name="field_data_json[<?php echo esc_attr( $pods_i ); ?>]" value="" class="field_data" /> |
| 27 | |
| 28 | <div class="pods-manage-field pods-dependency"> |
| 29 | <div class="pods-tabbed"> |
| 30 | <ul class="pods-tabs"> |
| 31 | <?php |
| 32 | $default = 'basic'; |
| 33 | |
| 34 | foreach ( $field_tabs as $tab => $label ) { |
| 35 | if ( ! in_array( |
| 36 | $tab, array( |
| 37 | 'basic', |
| 38 | 'additional-field', |
| 39 | 'advanced', |
| 40 | ), true |
| 41 | ) && ( ! isset( $field_tab_options[ $tab ] ) || empty( $field_tab_options[ $tab ] ) ) ) { |
| 42 | continue; |
| 43 | } |
| 44 | |
| 45 | $class = ''; |
| 46 | $extra_classes = ''; |
| 47 | |
| 48 | $tab = sanitize_title( $tab ); |
| 49 | |
| 50 | if ( $tab === $default ) { |
| 51 | $class = ' selected'; |
| 52 | } |
| 53 | |
| 54 | if ( 'additional-field' === $tab ) { |
| 55 | $extra_classes = ' pods-excludes-on pods-excludes-on-field-data-type pods-excludes-on-field-data-type-' . implode( ' pods-excludes-on-field-data-type-', $no_additional ); |
| 56 | } |
| 57 | ?> |
| 58 | <li class="pods-tab<?php echo esc_attr( $extra_classes ); ?>"> |
| 59 | <a href="#pods-<?php echo esc_attr( $tab ); ?>-options-<?php echo esc_attr( $pods_i ); ?>" class="pods-tab-link<?php echo esc_attr( $class ); ?>"> |
| 60 | <?php echo $label; ?> |
| 61 | </a> |
| 62 | </li> |
| 63 | <?php |
| 64 | }//end foreach |
| 65 | ?> |
| 66 | </ul> |
| 67 | |
| 68 | <div class="pods-tab-group"> |
| 69 | <div id="pods-basic-options-<?php echo esc_attr( $pods_i ); ?>" class="pods-tab pods-basic-options"> |
| 70 | <div class="pods-field-option"> |
| 71 | <?php echo PodsForm::label( 'field_data[' . $pods_i . '][label]', __( 'Label', 'pods' ), __( 'help', 'pods' ) ); ?> |
| 72 | <?php echo PodsForm::field( 'field_data[' . $pods_i . '][label]', pods_v( 'label', $field, '' ), 'text', array( 'class' => 'pods-validate pods-validate-required' ) ); ?> |
| 73 | </div> |
| 74 | <div class="pods-field-option"> |
| 75 | <?php echo PodsForm::label( 'field_data[' . $pods_i . '][name]', __( 'Name', 'pods' ), __( 'You will use this name to programatically reference this field throughout WordPress', 'pods' ) ); ?> |
| 76 | <?php |
| 77 | echo PodsForm::field( |
| 78 | 'field_data[' . $pods_i . '][name]', pods_v( 'name', $field, '' ), 'db', array( |
| 79 | 'attributes' => array( |
| 80 | 'maxlength' => 50, |
| 81 | 'data-sluggable' => 'field_data[' . $pods_i . '][label]', |
| 82 | ), |
| 83 | 'class' => 'pods-validate pods-validate-required pods-slugged-lower pods-slugged-sanitize-title', |
| 84 | ) |
| 85 | ); |
| 86 | ?> |
| 87 | </div> |
| 88 | <div class="pods-field-option"> |
| 89 | <?php echo PodsForm::label( 'field_data[' . $pods_i . '][description]', __( 'Description', 'pods' ), __( 'help', 'pods' ) ); ?> |
| 90 | <?php echo PodsForm::field( 'field_data[' . $pods_i . '][description]', pods_v( 'description', $field, '' ), 'text' ); ?> |
| 91 | </div> |
| 92 | <div class="pods-field-option"> |
| 93 | <?php echo PodsForm::label( 'field_data[' . $pods_i . '][type]', __( 'Field Type', 'pods' ), __( 'help', 'pods' ) ); ?> |
| 94 | <?php |
| 95 | echo PodsForm::field( |
| 96 | 'field_data[' . $pods_i . '][type]', pods_v( 'type', $field, '' ), 'pick', array( |
| 97 | 'data' => pods_v( 'field_types_select', $field_settings ), |
| 98 | 'class' => 'pods-dependent-toggle', |
| 99 | ) |
| 100 | ); |
| 101 | ?> |
| 102 | </div> |
| 103 | <div class="pods-field-option-container pods-depends-on pods-depends-on-field-data-type pods-depends-on-field-data-type-pick"> |
| 104 | <div class="pods-field-option"> |
| 105 | <?php echo PodsForm::label( 'field_data[' . $pods_i . '][pick_object]', __( 'Related To', 'pods' ), __( 'help', 'pods' ) ); ?> |
| 106 | <?php |
| 107 | echo PodsForm::field( |
| 108 | 'field_data[' . $pods_i . '][pick_object]', $pick_object, 'pick', array( |
| 109 | 'required' => true, |
| 110 | 'data' => pods_v( 'pick_object', $field_settings ), |
| 111 | 'class' => 'pods-dependent-toggle', |
| 112 | ) |
| 113 | ); |
| 114 | ?> |
| 115 | </div> |
| 116 | <div class="pods-field-option pods-depends-on pods-depends-on-field-data-pick-object pods-depends-on-field-data-pick-object-custom-simple"> |
| 117 | <?php echo PodsForm::label( 'field_data[' . $pods_i . '][pick_custom]', __( 'Custom Defined Options', 'pods' ), __( 'One option per line, use <em>value|Label</em> for separate values and labels', 'pods' ) ); ?> |
| 118 | <?php echo PodsForm::field( 'field_data[' . $pods_i . '][pick_custom]', pods_v( 'pick_custom', $field, '' ), 'paragraph' ); ?> |
| 119 | </div> |
| 120 | <div class="pods-field-option pods-depends-on pods-depends-on-field-data-pick-object pods-depends-on-field-data-pick-object-table"> |
| 121 | <?php echo PodsForm::label( 'field_data[' . $pods_i . '][pick_table]', __( 'Related Table', 'pods' ), __( 'help', 'pods' ) ); ?> |
| 122 | <?php |
| 123 | echo PodsForm::field( |
| 124 | 'field_data[' . $pods_i . '][pick_table]', pods_v( 'pick_table', $field, '' ), 'pick', array( |
| 125 | 'required' => true, |
| 126 | 'data' => pods_v( 'pick_table', $field_settings ), |
| 127 | ) |
| 128 | ); |
| 129 | ?> |
| 130 | </div> |
| 131 | <div class="pods-field-option pods-depends-on pods-depends-on-field-data-pick-object pods-depends-on-field-data-pick-object-<?php echo esc_attr( str_replace( '_', '-', implode( ' pods-depends-on-field-data-pick-object-', $bidirectional_objects ) ) ); ?>" data-dependency-trigger="pods_sister_field"> |
| 132 | <?php echo PodsForm::label( 'field_data[' . $pods_i . '][sister_id]', __( 'Bi-directional Field', 'pods' ), __( 'Bi-directional fields will update their related field for any item you select. This feature is only available for two relationships between two Pods.<br /><br />For example, when you update a Parent pod item to relate to a Child item, when you go to edit that Child item you will see the Parent pod item selected.', 'pods' ) ); ?> |
| 133 | |
| 134 | <div class="pods-sister-field"> |
| 135 | <?php echo PodsForm::field( 'field_data[' . $pods_i . '][sister_id]', pods_v( 'sister_id', $field, '' ), 'text' ); ?> |
| 136 | </div> |
| 137 | </div> |
| 138 | </div> |
| 139 | <div class="pods-field-option-group"> |
| 140 | <p class="pods-field-option-group-label"> |
| 141 | <?php _e( 'Options', 'pods' ); ?> |
| 142 | </p> |
| 143 | |
| 144 | <?php |
| 145 | $required_option = PodsForm::field( 'field_data[' . $pods_i . '][required]', pods_v( 'required', $field, 0 ), 'boolean', array( |
| 146 | 'class' => 'pods-dependent-toggle', |
| 147 | 'boolean_yes_label' => __( 'Required', 'pods' ), |
| 148 | 'help' => __( 'help', 'pods' ) |
| 149 | ) ); |
| 150 | if ( 'table' == $pod[ 'storage' ] ) { |
| 151 | ?> |
| 152 | <div class="pods-pick-values pods-pick-checkbox"> |
| 153 | <ul> |
| 154 | <li> |
| 155 | <?php echo $required_option; ?> |
| 156 | </li> |
| 157 | <li class="pods-excludes-on pods-excludes-on-field-data-type pods-excludes-on-field-data-type-pick pods-excludes-on-field-data-type-file pods-excludes-on-field-data-type-boolean pods-excludes-on-field-data-type-date pods-excludes-on-field-data-type-datetime pods-excludes-on-field-data-type-time"> |
| 158 | <?php echo PodsForm::field( 'field_data[' . $pods_i . '][unique]', pods_v( 'unique', $field, 0 ), 'boolean', array( |
| 159 | 'class' => 'pods-dependent-toggle', |
| 160 | 'boolean_yes_label' => __( 'Unique', 'pods' ), |
| 161 | 'help' => __( 'help', 'pods' ) |
| 162 | ) ); ?> |
| 163 | </li> |
| 164 | </ul> |
| 165 | </div> |
| 166 | <?php |
| 167 | } else { |
| 168 | echo $required_option; |
| 169 | } |
| 170 | ?> |
| 171 | </div> |
| 172 | </div> |
| 173 | |
| 174 | <?php |
| 175 | foreach ( $field_tabs as $tab => $tab_label ) { |
| 176 | $tab = sanitize_title( $tab ); |
| 177 | |
| 178 | if ( 'basic' === $tab || ! isset( $field_tab_options[ $tab ] ) || empty( $field_tab_options[ $tab ] ) ) { |
| 179 | continue; |
| 180 | } |
| 181 | ?> |
| 182 | <div id="pods-<?php echo esc_attr( $tab ); ?>-options-<?php echo esc_attr( $pods_i ); ?>" class="pods-tab pods-<?php echo esc_attr( $tab ); ?>-options"> |
| 183 | <?php |
| 184 | $field_tab_fields = $field_tab_options[ $tab ]; |
| 185 | |
| 186 | if ( 'additional-field' === $tab ) { |
| 187 | foreach ( $field_tab_fields as $field_type => $field_type_fields ) { |
| 188 | $first_field = current( $field_type_fields ); |
| 189 | ?> |
| 190 | <div class="pods-depends-on pods-depends-on-field-data-type pods-depends-on-field-data-type-<?php echo esc_attr( sanitize_title( $field_type ) ); ?>"> |
| 191 | <?php |
| 192 | if ( ! isset( $first_field[ 'name' ] ) && ! isset( $first_field[ 'label' ] ) ) { |
| 193 | foreach ( $field_type_fields as $group => $group_fields ) { |
| 194 | ?> |
| 195 | <h4><?php echo $group; ?></h4> |
| 196 | <?php |
| 197 | $field_options = PodsForm::fields_setup( $group_fields ); |
| 198 | |
| 199 | include PODS_DIR . 'ui/admin/field-option.php'; |
| 200 | } |
| 201 | } else { |
| 202 | $field_options = PodsForm::fields_setup( $field_type_fields ); |
| 203 | |
| 204 | include PODS_DIR . 'ui/admin/field-option.php'; |
| 205 | } |
| 206 | ?> |
| 207 | </div> |
| 208 | <?php |
| 209 | }//end foreach |
| 210 | } else { |
| 211 | $first_field = current( $field_tab_fields ); |
| 212 | |
| 213 | if ( ! isset( $first_field[ 'name' ] ) && ! isset( $first_field[ 'label' ] ) ) { |
| 214 | foreach ( $field_tab_fields as $group => $group_fields ) { |
| 215 | ?> |
| 216 | <h4><?php echo $group; ?></h4> |
| 217 | <?php |
| 218 | $field_options = PodsForm::fields_setup( $group_fields ); |
| 219 | |
| 220 | include PODS_DIR . 'ui/admin/field-option.php'; |
| 221 | } |
| 222 | } else { |
| 223 | $field_options = PodsForm::fields_setup( $field_tab_fields ); |
| 224 | |
| 225 | include PODS_DIR . 'ui/admin/field-option.php'; |
| 226 | } |
| 227 | }//end if |
| 228 | ?> |
| 229 | </div> |
| 230 | <?php |
| 231 | }//end foreach |
| 232 | ?> |
| 233 | </div> |
| 234 | |
| 235 | <div class="pods-manage-row-actions submitbox"> |
| 236 | <div class="pods-manage-row-delete"> |
| 237 | <a class="submitdelete deletion" href="#delete-field"><?php _e( 'Delete Field', 'pods' ); ?></a> |
| 238 | </div> |
| 239 | <p class="pods-manage-row-save"> |
| 240 | <a class="pods-manage-row-cancel" href="#cancel-edit-field"><?php _e( 'Cancel', 'pods' ); ?></a> |
| 241 | <a href="#save-field" class="button-primary pods-button-update"><?php _e( 'Update Field', 'pods' ); ?></a><a href="#save-field" class="button-primary pods-button-add"><?php _e( 'Save Field', 'pods' ); ?></a> |
| 242 | </p> |
| 243 | </div> |
| 244 | </div> |
| 245 | </div> |
| 246 | </div> |
| 247 | </td> |
| 248 | <td class="pods-manage-row-name"> |
| 249 | <a title="Edit this field" class="pods-manage-row-edit row-name" href="#edit-field"><?php echo esc_html( pods_v( 'name', $field ) ); ?></a> |
| 250 | </td> |
| 251 | <td class="pods-manage-row-type"> |
| 252 | <?php |
| 253 | $type = 'Unknown'; |
| 254 | |
| 255 | if ( isset( $field_types[ pods_v_sanitized( 'type', $field ) ] ) ) { |
| 256 | $type = $field_types[ pods_v_sanitized( 'type', $field ) ][ 'label' ]; |
| 257 | } |
| 258 | |
| 259 | echo esc_html( $type ) . ' <span class="pods-manage-row-more">[type: ' . pods_v_sanitized( 'type', $field ) . ']</span>'; |
| 260 | |
| 261 | if ( 'pick' == pods_v_sanitized( 'type', $field ) && '' != pods_v_sanitized( 'pick_object', $field, '' ) ) { |
| 262 | $pick_object_name = null; |
| 263 | |
| 264 | foreach ( $field_settings[ 'pick_object' ] as $object => $object_label ) { |
| 265 | if ( null !== $pick_object_name ) { |
| 266 | break; |
| 267 | } |
| 268 | |
| 269 | if ( '-- Select --' === $object_label ) { |
| 270 | continue; |
| 271 | } |
| 272 | |
| 273 | if ( is_array( $object_label ) ) { |
| 274 | foreach ( $object_label as $sub_object => $sub_object_label ) { |
| 275 | if ( $pick_object === $sub_object ) { |
| 276 | $object = rtrim( $object, 's' ); |
| 277 | |
| 278 | if ( false !== strpos( $object, 'ies' ) ) { |
| 279 | $object = str_replace( 'ies', 'y', $object ); |
| 280 | } |
| 281 | |
| 282 | $pick_object_name = esc_html( $sub_object_label ) . ' <small>(' . esc_html( $object ) . ')</small>'; |
| 283 | |
| 284 | break; |
| 285 | } |
| 286 | } |
| 287 | } elseif ( pods_v_sanitized( 'pick_object', $field ) === $object ) { |
| 288 | $pick_object_name = $object_label; |
| 289 | |
| 290 | break; |
| 291 | } |
| 292 | }//end foreach |
| 293 | |
| 294 | if ( null === $pick_object_name ) { |
| 295 | $pick_object_name = ucwords( str_replace( array( |
| 296 | '-', |
| 297 | '_' |
| 298 | ), ' ', pods_v( 'pick_object', $field ) ) ); |
| 299 | |
| 300 | if ( 0 < strlen( pods_v( 'pick_val', $field ) ) ) { |
| 301 | $pick_object_name = pods_v( 'pick_val', $field ) . ' (' . $pick_object_name . ')'; |
| 302 | } |
| 303 | } |
| 304 | ?> |
| 305 | <br /><span class="pods-manage-field-type-desc">› <?php echo $pick_object_name; ?></span> |
| 306 | <?php |
| 307 | }//end if |
| 308 | ?> |
| 309 | </td> |
| 310 | </tr> |
| 311 |