class-acf-field-accordion.php
5 months ago
class-acf-field-button-group.php
5 months ago
class-acf-field-checkbox.php
2 months ago
class-acf-field-color_picker.php
5 months ago
class-acf-field-date_picker.php
5 months ago
class-acf-field-date_time_picker.php
5 months ago
class-acf-field-email.php
5 months ago
class-acf-field-file.php
5 months ago
class-acf-field-google-map.php
5 months ago
class-acf-field-group.php
5 months ago
class-acf-field-icon_picker.php
6 months ago
class-acf-field-image.php
1 month ago
class-acf-field-link.php
5 months ago
class-acf-field-message.php
6 months ago
class-acf-field-number.php
5 months ago
class-acf-field-oembed.php
2 months ago
class-acf-field-output.php
6 months ago
class-acf-field-page_link.php
1 month ago
class-acf-field-password.php
5 months ago
class-acf-field-post_object.php
1 month ago
class-acf-field-radio.php
2 months ago
class-acf-field-range.php
5 months ago
class-acf-field-relationship.php
1 month ago
class-acf-field-select.php
2 months ago
class-acf-field-separator.php
6 months ago
class-acf-field-tab.php
6 months ago
class-acf-field-taxonomy.php
2 months ago
class-acf-field-text.php
5 months ago
class-acf-field-textarea.php
5 months ago
class-acf-field-time_picker.php
5 months ago
class-acf-field-true_false.php
5 months ago
class-acf-field-url.php
5 months ago
class-acf-field-user.php
2 months ago
class-acf-field-wysiwyg.php
5 months ago
class-acf-field.php
5 months ago
index.php
2 years ago
class-acf-field-password.php
130 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package ACF |
| 4 | * @author WP Engine |
| 5 | * |
| 6 | * © 2026 Advanced Custom Fields (ACF®). All rights reserved. |
| 7 | * "ACF" is a trademark of WP Engine. |
| 8 | * Licensed under the GNU General Public License v2 or later. |
| 9 | * https://www.gnu.org/licenses/gpl-2.0.html |
| 10 | */ |
| 11 | |
| 12 | if ( ! class_exists( 'acf_field_password' ) ) : |
| 13 | |
| 14 | class acf_field_password extends acf_field { |
| 15 | |
| 16 | |
| 17 | /** |
| 18 | * This function will setup the field type data |
| 19 | * |
| 20 | * @type function |
| 21 | * @date 5/03/2014 |
| 22 | * @since 5.0.0 |
| 23 | * |
| 24 | * @param n/a |
| 25 | * @return n/a |
| 26 | */ |
| 27 | function initialize() { |
| 28 | |
| 29 | // vars |
| 30 | $this->name = 'password'; |
| 31 | $this->label = __( 'Password', 'acf' ); |
| 32 | $this->description = __( 'An input for providing a password using a masked field.', 'acf' ); |
| 33 | $this->preview_image = acf_get_url() . '/assets/images/field-type-previews/field-preview-password.png'; |
| 34 | $this->doc_url = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/password/', 'docs', 'field-type-selection' ); |
| 35 | $this->defaults = array( |
| 36 | 'placeholder' => '', |
| 37 | 'prepend' => '', |
| 38 | 'append' => '', |
| 39 | ); |
| 40 | } |
| 41 | |
| 42 | |
| 43 | /** |
| 44 | * Create the HTML interface for your field |
| 45 | * |
| 46 | * @param $field - an array holding all the field's data |
| 47 | * |
| 48 | * @type action |
| 49 | * @since 3.6 |
| 50 | * @date 23/01/13 |
| 51 | */ |
| 52 | function render_field( $field ) { |
| 53 | |
| 54 | acf_get_field_type( 'text' )->render_field( $field ); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Create extra options for your field. This is rendered when editing a field. |
| 59 | * The value of $field['name'] can be used (like bellow) to save extra data to the $field |
| 60 | * |
| 61 | * @type action |
| 62 | * @since 3.6 |
| 63 | * @date 23/01/13 |
| 64 | * |
| 65 | * @param $field - an array holding all the field's data |
| 66 | */ |
| 67 | function render_field_settings( $field ) { |
| 68 | // TODO: Delete this method? |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Renders the field settings used in the "Presentation" tab. |
| 73 | * |
| 74 | * @since 6.0 |
| 75 | * |
| 76 | * @param array $field The field settings array. |
| 77 | * @return void |
| 78 | */ |
| 79 | function render_field_presentation_settings( $field ) { |
| 80 | acf_render_field_setting( |
| 81 | $field, |
| 82 | array( |
| 83 | 'label' => __( 'Placeholder Text', 'acf' ), |
| 84 | 'instructions' => __( 'Appears within the input', 'acf' ), |
| 85 | 'type' => 'text', |
| 86 | 'name' => 'placeholder', |
| 87 | ) |
| 88 | ); |
| 89 | |
| 90 | acf_render_field_setting( |
| 91 | $field, |
| 92 | array( |
| 93 | 'label' => __( 'Prepend', 'acf' ), |
| 94 | 'instructions' => __( 'Appears before the input', 'acf' ), |
| 95 | 'type' => 'text', |
| 96 | 'name' => 'prepend', |
| 97 | ) |
| 98 | ); |
| 99 | |
| 100 | acf_render_field_setting( |
| 101 | $field, |
| 102 | array( |
| 103 | 'label' => __( 'Append', 'acf' ), |
| 104 | 'instructions' => __( 'Appears after the input', 'acf' ), |
| 105 | 'type' => 'text', |
| 106 | 'name' => 'append', |
| 107 | ) |
| 108 | ); |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Formats the field value for JSON-LD output. |
| 113 | * |
| 114 | * @since 6.8.0 |
| 115 | * |
| 116 | * @param mixed $value The value of the field. |
| 117 | * @param integer|string $post_id The ID of the post. |
| 118 | * @param array $field The field array. |
| 119 | * @return mixed |
| 120 | */ |
| 121 | public function format_value_for_jsonld( $value, $post_id, $field ) { |
| 122 | return false; |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | |
| 127 | // initialize |
| 128 | acf_register_field_type( 'acf_field_password' ); |
| 129 | endif; // class_exists check |
| 130 |