/** * 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) { $field_data = parent::to_json($load); $this->set_options(apply_filters('crb_gravity_form_options', $this->options)); $field_data = array_merge($field_data, array('options' => $this->parse_options($this->options))); 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) { if ($this->enable_add_new) { $this->options['new'] = _x('Add New', 'sidebar', 'carbon-fields'); } $field_data = parent::to_json($load); if (!empty($this->excluded_sidebars)) { if (!is_array($this->excluded_sidebars)) { $this->excluded_sidebars = array($this->excluded_sidebars); } $field_data = array_merge($field_data, array('excluded_sidebars' => $this->excluded_sidebars)); } return $field_data; }