GFPDFHelperFieldsField_Textarea

Controls the display and output of a Gravity Form field.

Defined (1)

The class is defined in the following location(s).

/src/helper/fields/Field_Textarea.php  
  1. class Field_Textarea extends Helper_Abstract_Fields { 
  2.  
  3. /** 
  4. * Check the appropriate variables are parsed in send to the parent construct 
  5. * @param object $field The GF_Field_* Object 
  6. * @param array $entry The Gravity Forms Entry 
  7. * @param \GFPDF\Helper\Helper_Abstract_Form $gform 
  8. * @param \GFPDF\Helper\Helper_Misc $misc 
  9. * @throws Exception 
  10. * @since 4.0 
  11. */ 
  12. public function __construct( $field, $entry, Helper_Abstract_Form $gform, Helper_Misc $misc ) { 
  13.  
  14. if ( ! is_object( $field ) || ! $field instanceof GF_Field_Textarea ) { 
  15. throw new Exception( '$field needs to be in instance of GF_Field_Textarea' ); 
  16.  
  17. /** call our parent method */ 
  18. parent::__construct( $field, $entry, $gform, $misc ); 
  19.  
  20. public function html( $value = '', $label = true ) { 
  21. $value = $this->value(); 
  22.  
  23. return parent::html( $value ); 
  24.  
  25. /** 
  26. * Get the standard GF value of this field 
  27. * @return string|array 
  28. * @since 4.0 
  29. */ 
  30. public function value() { 
  31. if ( $this->has_cache() ) { 
  32. return $this->cache(); 
  33.  
  34. $value = $this->get_value(); 
  35.  
  36. if ( isset( $this->field->useRichTextEditor ) && true === $this->field->useRichTextEditor ) { 
  37. $html = wp_kses_post( wpautop( $value ) ); 
  38. } else { 
  39. $html = nl2br( esc_html( $value ) ); 
  40.  
  41. $this->cache( $html ); 
  42.  
  43. return $this->cache();