field-advanced-link.php
3 months ago
field-button-group.php
1 week ago
field-button.php
7 months ago
field-checkbox.php
3 months ago
field-clone.php
2 years ago
field-code-editor.php
3 months ago
field-column.php
3 years ago
field-dynamic-render.php
3 years ago
field-file.php
3 months ago
field-flexible-content-actions-title.php
3 months ago
field-flexible-content-actions-toggle.php
3 months ago
field-flexible-content-actions.php
3 months ago
field-flexible-content-async.php
4 months ago
field-flexible-content-compatibility.php
3 months ago
field-flexible-content-controls.php
9 months ago
field-flexible-content-hide.php
3 months ago
field-flexible-content-hooks.php
9 months ago
field-flexible-content-modal-edit.php
9 months ago
field-flexible-content-modal-select.php
3 months ago
field-flexible-content-modal-settings.php
3 months ago
field-flexible-content-popup.php
3 months ago
field-flexible-content-preview.php
3 months ago
field-flexible-content-state.php
9 months ago
field-flexible-content-thumbnail.php
9 months ago
field-flexible-content-wysiwyg.php
9 months ago
field-flexible-content.php
3 months ago
field-forms.php
3 months ago
field-gallery.php
3 months ago
field-google-map.php
3 months ago
field-group.php
3 months ago
field-hidden.php
3 years ago
field-image.php
3 months ago
field-post-object.php
3 months ago
field-post-statuses.php
3 months ago
field-post-types.php
3 months ago
field-radio.php
3 months ago
field-recaptcha.php
3 months ago
field-relationship.php
3 months ago
field-repeater.php
3 months ago
field-select.php
3 months ago
field-slug.php
1 year ago
field-taxonomies.php
3 months ago
field-taxonomy-terms.php
3 months ago
field-taxonomy.php
3 months ago
field-textarea.php
3 months ago
field-user-roles.php
3 months ago
field-user.php
3 months ago
field-wysiwyg.php
3 months ago
field-hidden.php
79 lines
| 1 | <?php |
| 2 | |
| 3 | if(!defined('ABSPATH')){ |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | if(!class_exists('acfe_field_hidden')): |
| 8 | |
| 9 | class acfe_field_hidden extends acf_field{ |
| 10 | |
| 11 | /** |
| 12 | * initialize |
| 13 | */ |
| 14 | function initialize(){ |
| 15 | |
| 16 | $this->name = 'acfe_hidden'; |
| 17 | $this->label = __('Hidden', 'acfe'); |
| 18 | $this->category = 'basic'; |
| 19 | $this->defaults = array( |
| 20 | 'default_value' => '' |
| 21 | ); |
| 22 | |
| 23 | } |
| 24 | |
| 25 | |
| 26 | /** |
| 27 | * prepare_field |
| 28 | * |
| 29 | * @param $field |
| 30 | * |
| 31 | * @return array |
| 32 | */ |
| 33 | function prepare_field($field){ |
| 34 | |
| 35 | $field['wrapper']['class'] = 'acf-hidden'; |
| 36 | |
| 37 | return $field; |
| 38 | |
| 39 | } |
| 40 | |
| 41 | |
| 42 | /** |
| 43 | * render_field |
| 44 | * |
| 45 | * @param $field |
| 46 | */ |
| 47 | function render_field($field){ |
| 48 | |
| 49 | acf_hidden_input(array( |
| 50 | 'name' => $field['name'], |
| 51 | 'value' => $field['value'], |
| 52 | )); |
| 53 | |
| 54 | } |
| 55 | |
| 56 | |
| 57 | /** |
| 58 | * render_field_settings |
| 59 | * |
| 60 | * @param $field |
| 61 | */ |
| 62 | function render_field_settings($field){ |
| 63 | |
| 64 | // default_value |
| 65 | acf_render_field_setting($field, array( |
| 66 | 'label' => __('Value', 'acf'), |
| 67 | 'instructions' => __('Default value in the hidden input', 'acf'), |
| 68 | 'type' => 'text', |
| 69 | 'name' => 'default_value', |
| 70 | )); |
| 71 | |
| 72 | } |
| 73 | |
| 74 | } |
| 75 | |
| 76 | // initialize |
| 77 | acf_register_field_type('acfe_field_hidden'); |
| 78 | |
| 79 | endif; |