/core/fields/message.php

  1. <?php 
  2.  
  3. class acf_field_message extends acf_field 
  4.  
  5. /** 
  6. * __construct 
  7. * 
  8. * Set name / label needed for actions / filters 
  9. * 
  10. * @since 3.6 
  11. * @date 23/01/13 
  12. */ 
  13.  
  14. function __construct() 
  15. // vars 
  16. $this->name = 'message'; 
  17. $this->label = __("Message", 'acf'); 
  18. $this->category = __("Layout", 'acf'); 
  19. $this->defaults = array( 
  20. 'message' => '',  
  21. ); 
  22.  
  23.  
  24. // do not delete! 
  25. parent::__construct(); 
  26.  
  27.  
  28. /** 
  29. * create_field() 
  30. * 
  31. * Create the HTML interface for your field 
  32. * 
  33. * @param $field - an array holding all the field's data 
  34. * 
  35. * @type action 
  36. * @since 3.6 
  37. * @date 23/01/13 
  38. */ 
  39.  
  40. function create_field( $field ) 
  41. echo wpautop( $field['message'] ); 
  42.  
  43.  
  44. /** 
  45. * create_options() 
  46. * 
  47. * Create extra options for your field. This is rendered when editing a field. 
  48. * The value of $field['name'] can be used (like bellow) to save extra data to the $field 
  49. * 
  50. * @param $field - an array holding all the field's data 
  51. * 
  52. * @type action 
  53. * @since 3.6 
  54. * @date 23/01/13 
  55. */ 
  56.  
  57. function create_options( $field ) 
  58. // vars 
  59. $key = $field['name']; 
  60.  
  61. ?> 
  62. <tr class="field_option field_option_<?php echo $this->name; ?>"> 
  63. <td class="label"> 
  64. <label for=""><?php _e("Message", 'acf'); ?></label> 
  65. <p class="description"><?php _e("Text & HTML entered here will appear inline with the fields", 'acf'); ?><br /><br /> 
  66. <?php _e("Please note that all text will first be passed through the wp function ", 'acf'); ?><a href="http://codex.wordpress.org/Function_Reference/wpautop" target="_blank">wpautop</a></p> 
  67. </td> 
  68. <td> 
  69. <?php  
  70. do_action('acf/create_field', array( 
  71. 'type' => 'textarea',  
  72. 'class' => 'textarea',  
  73. 'name' => 'fields['.$key.'][message]',  
  74. 'value' => $field['message'],  
  75. )); 
  76. ?> 
  77. </td> 
  78. </tr> 
  79. <?php 
  80.  
  81.  
  82.  
  83. new acf_field_message(); 
  84.  
  85. ?> 
.