acf_field_password

The Advanced Custom Fields acf field password class.

Defined (1)

The class is defined in the following location(s).

/core/fields/password.php  
  1. class acf_field_password extends acf_field 
  2.  
  3. /** 
  4. * __construct 
  5. * Set name / label needed for actions / filters 
  6. * @since 3.6 
  7. * @date 23/01/13 
  8. */ 
  9.  
  10. function __construct() 
  11. // vars 
  12. $this->name = 'password'; 
  13. $this->label = __("Password", 'acf'); 
  14. $this->defaults = array( 
  15. 'placeholder' => '',  
  16. 'prepend' => '',  
  17. 'append' => '' 
  18. ); 
  19.  
  20.  
  21. // do not delete! 
  22. parent::__construct(); 
  23.  
  24.  
  25. /** 
  26. * create_field() 
  27. * Create the HTML interface for your field 
  28. * @param $field - an array holding all the field's data 
  29. * @type action 
  30. * @since 3.6 
  31. * @date 23/01/13 
  32. */ 
  33.  
  34. function create_field( $field ) 
  35. // vars 
  36. $o = array( 'id', 'class', 'name', 'value', 'placeholder' ); 
  37. $e = ''; 
  38.  
  39.  
  40. // prepend 
  41. if( $field['prepend'] !== "" ) 
  42. $field['class'] .= ' acf-is-prepended'; 
  43. $e .= '<div class="acf-input-prepend">' . $field['prepend'] . '</div>'; 
  44.  
  45.  
  46. // append 
  47. if( $field['append'] !== "" ) 
  48. $field['class'] .= ' acf-is-appended'; 
  49. $e .= '<div class="acf-input-append">' . $field['append'] . '</div>'; 
  50.  
  51.  
  52. $e .= '<div class="acf-input-wrap">'; 
  53. $e .= '<input type="password"'; 
  54.  
  55. foreach( $o as $k ) 
  56. $e .= ' ' . $k . '="' . esc_attr( $field[ $k ] ) . '"';  
  57.  
  58. $e .= ' />'; 
  59. $e .= '</div>'; 
  60.  
  61.  
  62. // return 
  63. echo $e; 
  64.  
  65.  
  66. /** 
  67. * create_options() 
  68. * Create extra options for your field. This is rendered when editing a field. 
  69. * The value of $field['name'] can be used (like bellow) to save extra data to the $field 
  70. * @type action 
  71. * @since 3.6 
  72. * @date 23/01/13 
  73. * @param $field - an array holding all the field's data 
  74. */ 
  75.  
  76. function create_options( $field ) 
  77. // vars 
  78. $key = $field['name']; 
  79.  
  80. ?> 
  81. <tr class="field_option field_option_<?php echo $this->name; ?>"> 
  82. <td class="label"> 
  83. <label><?php _e("Placeholder Text", 'acf'); ?></label> 
  84. <p><?php _e("Appears within the input", 'acf') ?></p> 
  85. </td> 
  86. <td> 
  87. <?php  
  88. do_action('acf/create_field', array( 
  89. 'type' => 'text',  
  90. 'name' => 'fields[' .$key.'][placeholder]',  
  91. 'value' => $field['placeholder'],  
  92. )); 
  93. ?> 
  94. </td> 
  95. </tr> 
  96. <tr class="field_option field_option_<?php echo $this->name; ?>"> 
  97. <td class="label"> 
  98. <label><?php _e("Prepend", 'acf'); ?></label> 
  99. <p><?php _e("Appears before the input", 'acf') ?></p> 
  100. </td> 
  101. <td> 
  102. <?php  
  103. do_action('acf/create_field', array( 
  104. 'type' => 'text',  
  105. 'name' => 'fields[' .$key.'][prepend]',  
  106. 'value' => $field['prepend'],  
  107. )); 
  108. ?> 
  109. </td> 
  110. </tr> 
  111. <tr class="field_option field_option_<?php echo $this->name; ?>"> 
  112. <td class="label"> 
  113. <label><?php _e("Append", 'acf'); ?></label> 
  114. <p><?php _e("Appears after the input", 'acf') ?></p> 
  115. </td> 
  116. <td> 
  117. <?php  
  118. do_action('acf/create_field', array( 
  119. 'type' => 'text',  
  120. 'name' => 'fields[' .$key.'][append]',  
  121. 'value' => $field['append'],  
  122. )); 
  123. ?> 
  124. </td> 
  125. </tr> 
  126. <?php 
  127.