class-acf-field-password.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. if ( ! class_exists( 'acf_field_password' ) ) :
  3. class acf_field_password extends acf_field {
  4. /*
  5. * initialize
  6. *
  7. * This function will setup the field type data
  8. *
  9. * @type function
  10. * @date 5/03/2014
  11. * @since 5.0.0
  12. *
  13. * @param n/a
  14. * @return n/a
  15. */
  16. function initialize() {
  17. // vars
  18. $this->name = 'password';
  19. $this->label = __( 'Password', 'acf' );
  20. $this->defaults = array(
  21. 'placeholder' => '',
  22. 'prepend' => '',
  23. 'append' => '',
  24. );
  25. }
  26. /*
  27. * render_field()
  28. *
  29. * Create the HTML interface for your field
  30. *
  31. * @param $field - an array holding all the field's data
  32. *
  33. * @type action
  34. * @since 3.6
  35. * @date 23/01/13
  36. */
  37. function render_field( $field ) {
  38. acf_get_field_type( 'text' )->render_field( $field );
  39. }
  40. /*
  41. * render_field_settings()
  42. *
  43. * Create extra options for your field. This is rendered when editing a field.
  44. * The value of $field['name'] can be used (like bellow) to save extra data to the $field
  45. *
  46. * @type action
  47. * @since 3.6
  48. * @date 23/01/13
  49. *
  50. * @param $field - an array holding all the field's data
  51. */
  52. function render_field_settings( $field ) {
  53. // TODO: Delete this method?
  54. }
  55. /**
  56. * Renders the field settings used in the "Presentation" tab.
  57. *
  58. * @since 6.0
  59. *
  60. * @param array $field The field settings array.
  61. * @return void
  62. */
  63. function render_field_presentation_settings( $field ) {
  64. acf_render_field_setting(
  65. $field,
  66. array(
  67. 'label' => __( 'Placeholder Text', 'acf' ),
  68. 'instructions' => __( 'Appears within the input', 'acf' ),
  69. 'type' => 'text',
  70. 'name' => 'placeholder',
  71. )
  72. );
  73. acf_render_field_setting(
  74. $field,
  75. array(
  76. 'label' => __( 'Prepend', 'acf' ),
  77. 'instructions' => __( 'Appears before the input', 'acf' ),
  78. 'type' => 'text',
  79. 'name' => 'prepend',
  80. )
  81. );
  82. acf_render_field_setting(
  83. $field,
  84. array(
  85. 'label' => __( 'Append', 'acf' ),
  86. 'instructions' => __( 'Appears after the input', 'acf' ),
  87. 'type' => 'text',
  88. 'name' => 'append',
  89. )
  90. );
  91. }
  92. }
  93. // initialize
  94. acf_register_field_type( 'acf_field_password' );
  95. endif; // class_exists check