GFPDFHelperFieldsField_v3_List

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_v3_List.php  
  1. class Field_v3_List extends Field_List { 
  2.  
  3. /** 
  4. * Display the HTML version of this field 
  5. * @param string $value 
  6. * @param bool $label 
  7. * @return string 
  8. * @since 4.0 
  9. */ 
  10. public function html( $value = '', $label = true ) { 
  11.  
  12. /** exit early if list field is empty */ 
  13. if ( $this->is_empty() ) { 
  14. return parent::html( '' ); 
  15.  
  16. /** get out field value */ 
  17. $value = $this->value(); 
  18. $columns = is_array( $value[0] ); 
  19.  
  20. /** Check if we have columns or not */ 
  21. if ( $columns ) { 
  22. /** use the parent HTML */ 
  23. return parent::html(); 
  24.  
  25. /** Start buffer and generate a the single list bullet list */ 
  26. ob_start(); 
  27. ?> 
  28.  
  29. <ul class="bulleted single-column-list"> 
  30. <?php foreach ( $value as $item ) : ?> 
  31. <li><?php echo $item; ?></li> 
  32. <?php endforeach; ?> 
  33. </ul> 
  34. <?php 
  35.  
  36. /** get buffer and return HTML */ 
  37.  
  38. return Helper_Abstract_Fields::html( ob_get_clean() );