/**
  * Method to get the data to be passed to the layout for rendering.
  *
  * @return  array
  *
  * @since   3.5
  */
 protected function getLayoutData()
 {
     $data = parent::getLayoutData();
     // True if the field has 'value' set. In other words, it has been stored, don't use the default values.
     $hasValue = isset($this->value) && !empty($this->value);
     // If a value has been stored, use it. Otherwise, use the defaults.
     $checkedOptions = $hasValue ? $this->value : $this->checkedOptions;
     $extraData = array('checkedOptions' => is_array($checkedOptions) ? $checkedOptions : explode(',', (string) $checkedOptions), 'hasValue' => $hasValue, 'options' => $this->getOptions());
     return array_merge($data, $extraData);
 }
Example #2
0
 /**
  * Method to get the data to be passed to the layout for rendering.
  *
  * @return  array
  *
  * @since   3.5
  */
 protected function getLayoutData()
 {
     $data = parent::getLayoutData();
     $extraData = array('options' => $this->getOptions(), 'value' => (string) $this->value);
     return array_merge($data, $extraData);
 }