callback.php 705 B

12345678910111213141516171819202122232425262728293031
  1. <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
  2. /**
  3. *
  4. * Field: callback
  5. *
  6. * @since 1.0.0
  7. * @version 1.0.0
  8. *
  9. */
  10. if ( ! class_exists( 'CSF_Field_callback' ) ) {
  11. class CSF_Field_callback extends CSF_Fields {
  12. public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
  13. parent::__construct( $field, $value, $unique, $where, $parent );
  14. }
  15. public function render() {
  16. if ( isset( $this->field['function'] ) && is_callable( $this->field['function'] ) ) {
  17. $args = ( isset( $this->field['args'] ) ) ? $this->field['args'] : null;
  18. call_user_func( $this->field['function'], $args );
  19. }
  20. }
  21. }
  22. }