field-advanced-link.php
6 years ago
field-button.php
6 years ago
field-clone.php
6 years ago
field-column.php
6 years ago
field-dynamic-message.php
6 years ago
field-file.php
6 years ago
field-flexible-content.php
6 years ago
field-forms.php
6 years ago
field-group.php
6 years ago
field-hidden.php
6 years ago
field-image.php
6 years ago
field-post-statuses.php
6 years ago
field-post-types.php
6 years ago
field-recaptcha.php
6 years ago
field-repeater.php
6 years ago
field-select.php
6 years ago
field-slug.php
6 years ago
field-taxonomies.php
6 years ago
field-taxonomy-terms.php
6 years ago
field-textarea.php
6 years ago
field-user-roles.php
6 years ago
field-hidden.php
50 lines
| 1 | <?php |
| 2 | |
| 3 | if(!defined('ABSPATH')) |
| 4 | exit; |
| 5 | |
| 6 | class acfe_field_hidden extends acf_field{ |
| 7 | |
| 8 | function __construct(){ |
| 9 | |
| 10 | $this->name = 'acfe_hidden'; |
| 11 | $this->label = __('Hidden', 'acfe'); |
| 12 | $this->category = 'basic'; |
| 13 | $this->defaults = array( |
| 14 | 'default_value' => '' |
| 15 | ); |
| 16 | |
| 17 | parent::__construct(); |
| 18 | |
| 19 | } |
| 20 | |
| 21 | function render_field($field){ |
| 22 | |
| 23 | ?> |
| 24 | <style type="text/css"> |
| 25 | .field_key-<?php echo $field['key']; ?>, |
| 26 | .acf-<?php echo str_replace('_', '-', $field['key']); ?>, |
| 27 | .acf-field-<?php echo str_replace('_', '-', $field['key']); ?>{ |
| 28 | display: none; |
| 29 | } |
| 30 | </style> |
| 31 | <input type="hidden" name="<?php echo esc_attr($field['name']) ?>" value="<?php echo esc_attr($field['value']) ?>" style="display:none;" /> |
| 32 | <?php |
| 33 | |
| 34 | } |
| 35 | |
| 36 | function render_field_settings($field){ |
| 37 | |
| 38 | // default_value |
| 39 | acf_render_field_setting( $field, array( |
| 40 | 'label' => __('Value','acf'), |
| 41 | 'instructions' => __('Default value in the hidden input','acf'), |
| 42 | 'type' => 'text', |
| 43 | 'name' => 'default_value', |
| 44 | )); |
| 45 | |
| 46 | } |
| 47 | |
| 48 | } |
| 49 | |
| 50 | new acfe_field_hidden(); |