Note.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. /**
  3. * Class NF_Fields_Note
  4. */
  5. class NF_Fields_Note extends NF_Fields_Hidden
  6. {
  7. protected $_name = 'note';
  8. protected $_type = 'note';
  9. protected $_nicename = 'Note';
  10. protected $_section = '';
  11. protected $_icon = 'sticky-note-o';
  12. protected $_templates = 'null';
  13. protected $_aliases = array( 'notes', 'info' );
  14. protected $_settings_only = array(
  15. 'label', 'default'
  16. );
  17. public function __construct()
  18. {
  19. parent::__construct();
  20. $this->_settings[ 'value_mirror' ] = array(
  21. 'name' => 'value_mirror',
  22. 'type' => 'html',
  23. 'label' => __( 'HTML', 'ninja-forms'),
  24. 'width' => 'full',
  25. 'group' => 'primary',
  26. 'mirror' => 'default',
  27. );
  28. $this->_settings[ 'label' ][ 'width' ] = 'full';
  29. $this->_settings[ 'label' ][ 'group' ] = 'advanced';
  30. $this->_settings[ 'default' ][ 'type' ] = 'rte';
  31. $this->_settings[ 'default' ][ 'group' ] = 'advanced';
  32. $this->_settings[ 'value_mirror' ][ 'value' ] = $this->_settings[ 'default' ][ 'value' ] = __( 'Note text can be edited in the note field\'s advanced settings below.' );
  33. $this->_nicename = __( 'Note', 'ninja-forms' );
  34. add_filter( 'nf_sub_hidden_field_types', array( $this, 'hide_field_type' ) );
  35. }
  36. function hide_field_type( $field_types )
  37. {
  38. $field_types[] = $this->_name;
  39. return $field_types;
  40. }
  41. }