Caldera_Forms_Entry_Field

Object representation of an entry field - cf_form_entry_values.

Defined (1)

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

/classes/entry/field.php  
  1. class Caldera_Forms_Entry_Field extends Caldera_Forms_Entry_Object { 
  2.  
  3. /** @var string */ 
  4. protected $id; 
  5.  
  6. /** @var string */ 
  7. protected $entry_id; 
  8.  
  9. /** @var string */ 
  10. protected $field_id; 
  11.  
  12. /** @var string */ 
  13. protected $slug; 
  14.  
  15. /** @var string|array */ 
  16. protected $value; 
  17.  
  18.  
  19. /** 
  20. * Set field value 
  21. * NOTE: Does not update in DB 
  22. * @since 1.5.0.7 
  23. * @param string|array $value New value 
  24. * @return array|string 
  25. */ 
  26. public function set_value( $value ) { 
  27. $this->value_set( $value ); 
  28. return $this->value; 
  29.  
  30.  
  31. /** 
  32. * Get field value 
  33. * @since 1.5.0.7 
  34. * @return array|int|string 
  35. */ 
  36. public function get_value() { 
  37. return $this->value_get(); 
  38.  
  39. /** 
  40. * Apply deserialization/json_decoding if needed to value column 
  41. * @since 1.4.0 
  42. * @param string $value Value 
  43. */ 
  44. protected function value_set( $value ) { 
  45. if( is_array( $value ) ) { 
  46. $this->value = $value; 
  47. }elseif( is_serialized( $value ) ) { 
  48. $this->value = unserialize( $value ); 
  49. }elseif( 0 === strpos( $value, '{' ) && is_object( $_value = json_decode( $value ) ) ) { 
  50. $this->value = (array) $_value; 
  51. }else{ 
  52. $this->value = $value; 
  53.  
  54. /** 
  55. * Get value and ensure is not still serialized 
  56. * @since 1.4.0 
  57. * @return array|string|int 
  58. */ 
  59. protected function value_get() { 
  60.  
  61. if ( is_serialized( $this->value ) ) { 
  62. $this->value = unserialize( $this->value ); 
  63. } elseif ( is_string( $this->value ) && 0 === strpos( $this->value, '{' ) && is_object( $_value = json_decode( $this->value ) ) ) { 
  64. $this->value = (array) $_value; 
  65.  
  66. return $this->value; 
  67.  
  68.  
  69.  
  70.  
  71.  
  72.