Confirm.php 1020 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. /**
  3. * Class NF_Fields_Confirm
  4. */
  5. class NF_Fields_Confirm extends NF_Abstracts_Input
  6. {
  7. protected $_name = 'confirm';
  8. protected $_type = 'confirm';
  9. protected $_nicename = 'Confirm';
  10. protected $_section = 'misc';
  11. protected $_icon = 'check-circle-o';
  12. protected $_error_message = '';
  13. protected $_settings = array( 'confirm_field' );
  14. public function __construct()
  15. {
  16. parent::__construct();
  17. $this->_nicename = __( 'Confirm', 'ninja-forms' );
  18. $this->_settings[ 'confirm_field' ][ 'field_value_format' ] = 'key';
  19. add_filter( 'nf_sub_hidden_field_types', array( $this, 'hide_field_type' ) );
  20. }
  21. function hide_field_type( $field_types )
  22. {
  23. $field_types[] = $this->_name;
  24. return $field_types;
  25. }
  26. public function validate( $field, $data )
  27. {
  28. if( false ){
  29. $errors[] = __( 'Fields do not match.', 'ninja-forms' );
  30. }
  31. return $errors;
  32. }
  33. }