class-acf-field-separator.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. if ( ! class_exists( 'acf_field_separator' ) ) :
  3. class acf_field_separator extends acf_field {
  4. /*
  5. * __construct
  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 = 'separator';
  19. $this->label = __( 'Separator', 'acf' );
  20. $this->category = 'layout';
  21. }
  22. /*
  23. * render_field()
  24. *
  25. * Create the HTML interface for your field
  26. *
  27. * @param $field - an array holding all the field's data
  28. *
  29. * @type action
  30. * @since 3.6
  31. * @date 23/01/13
  32. */
  33. function render_field( $field ) {
  34. /* do nothing */
  35. }
  36. /*
  37. * load_field()
  38. *
  39. * This filter is appied to the $field after it is loaded from the database
  40. *
  41. * @type filter
  42. * @since 3.6
  43. * @date 23/01/13
  44. *
  45. * @param $field - the field array holding all the field options
  46. *
  47. * @return $field - the field array holding all the field options
  48. */
  49. function load_field( $field ) {
  50. // remove name to avoid caching issue
  51. $field['name'] = '';
  52. // remove required to avoid JS issues
  53. $field['required'] = 0;
  54. // set value other than 'null' to avoid ACF loading / caching issue
  55. $field['value'] = false;
  56. // return
  57. return $field;
  58. }
  59. }
  60. // initialize
  61. acf_register_field_type( 'acf_field_separator' );
  62. endif; // class_exists check