to_json() public méthode

This data will be available in the Underscore template and the Backbone Model.
public to_json ( boolean $load ) : array
$load boolean Should the value be loaded from the database or use the value from the current instance.
Résultat array
 /**
  * to_json()
  * 
  * You can use this method to modify the field properties that are added to the JSON object.
  * The JSON object is used by the Backbone Model and the Underscore template.
  * 
  * @param bool $load  Should the value be loaded from the database or use the value from the current instance.
  * @return array
  */
 function to_json($load)
 {
     $field_data = parent::to_json($load);
     // do not delete
     $field_data = array_merge($field_data, array('example_property' => $this->example_property));
     return $field_data;
 }
 /**
  * Returns an array that holds the field data, suitable for JSON representation.
  * This data will be available in the Underscore template and the Backbone Model.
  *
  * @param bool $load  Should the value be loaded from the database or use the value from the current instance.
  * @return array
  */
 public function to_json($load)
 {
     $complex_data = parent::to_json($load);
     $groups_data = array();
     $values_data = array();
     foreach ($this->groups as $group) {
         $groups_data[] = $group->to_json(false);
     }
     foreach ($this->values as $fields) {
         $group = $this->get_group_by_name($fields['type']);
         unset($fields['type']);
         $data = array('name' => $group->get_name(), 'label' => $group->get_label(), 'group_id' => $group->get_group_id(), 'fields' => array());
         foreach ($fields as $index => $field) {
             $data['fields'][] = $field->to_json(false);
         }
         $values_data[] = $data;
     }
     $complex_data = array_merge($complex_data, array('layout' => $this->layout, 'labels' => $this->labels, 'min' => $this->get_min(), 'max' => $this->get_max(), 'multiple_groups' => count($groups_data) > 1, 'groups' => $groups_data, 'value' => $values_data));
     return $complex_data;
 }