/core/fields/tab.php

  1. <?php 
  2.  
  3. class acf_field_tab 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 = 'tab'; 
  17. $this->label = __("Tab", 'acf'); 
  18. $this->category = __("Layout", 'acf'); 
  19.  
  20.  
  21. // do not delete! 
  22. parent::__construct(); 
  23.  
  24.  
  25. /** 
  26. * create_field() 
  27. * 
  28. * Create the HTML interface for your field 
  29. * 
  30. * @param $field - an array holding all the field's data 
  31. * 
  32. * @type action 
  33. * @since 3.6 
  34. * @date 23/01/13 
  35. */ 
  36.  
  37. function create_field( $field ) 
  38. echo '<div class="acf-tab">' . $field['label'] . '</div>'; 
  39.  
  40.  
  41.  
  42. /** 
  43. * create_options() 
  44. * 
  45. * Create extra options for your field. This is rendered when editing a field. 
  46. * The value of $field['name'] can be used (like bellow) to save extra data to the $field 
  47. * 
  48. * @param $field - an array holding all the field's data 
  49. * 
  50. * @type action 
  51. * @since 3.6 
  52. * @date 23/01/13 
  53. */ 
  54.  
  55. function create_options( $field ) 
  56. ?> 
  57. <tr class="field_option field_option_<?php echo $this->name; ?>"> 
  58. <td class="label"> 
  59. <label><?php _e("Instructions", 'acf'); ?></label> 
  60. </td> 
  61. <td> 
  62. <p><?php _e("Use \"Tab Fields\" to better organize your edit screen by grouping your fields together under separate tab headings.", 'acf'); ?></p> 
  63. <p><?php _e("All the fields following this \"tab field\" (or until another \"tab field\" is defined) will be grouped together.", 'acf'); ?></p> 
  64. <p><?php _e("Use multiple tabs to divide your fields into sections.", 'acf'); ?></p> 
  65. </td> 
  66. </tr> 
  67. <?php 
  68.  
  69.  
  70.  
  71. new acf_field_tab(); 
  72.  
  73. ?> 
.