UserInfo.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. /**
  3. * Class NF_Abstracts_UserInfo
  4. */
  5. abstract class NF_Abstracts_UserInfo extends NF_Fields_Textbox
  6. {
  7. protected $_name = 'input';
  8. protected $_section = 'userinfo';
  9. protected $_type = 'textbox';
  10. public static $_base_template = 'textbox';
  11. public function __construct()
  12. {
  13. parent::__construct();
  14. $this->_settings = $this->load_settings(
  15. array( 'key',
  16. 'label',
  17. 'label_pos',
  18. 'required',
  19. 'default',
  20. 'placeholder',
  21. 'classes',
  22. 'admin_label',
  23. 'help',
  24. 'description',
  25. 'custom_name_attribute',
  26. 'personally_identifiable',
  27. 'disable_browser_autocomplete' )
  28. );
  29. $this->_settings[ 'default' ][ 'settings' ][ 'default_type' ][ 'options' ][] = array(
  30. 'label' => __( 'User Meta (if logged in)', 'ninja-forms' ),
  31. 'value' => 'user-meta'
  32. );
  33. $this->_settings[ 'default' ][ 'settings' ][ 'default_type' ][ 'value' ] = 'user-meta';
  34. add_filter( 'ninja_forms_render_default_value', array( $this, 'filter_default_value' ), 10, 3 );
  35. }
  36. abstract public function filter_default_value( $default_value, $field_class, $settings );
  37. }