示例#1
0
 /**
  * Method to get the data to be passed to the layout for rendering.
  *
  * @return  array
  *
  * @since 3.5
  */
 protected function getInputLayoutData()
 {
     $displayData = parent::getInputLayoutData();
     $displayData['value'] = (string) $this->value;
     $displayData['options'] = $this->getOptions();
     return $displayData;
 }
示例#2
0
 /**
  * Method to get the data to be passed to the layout for rendering.
  *
  * @return  array
  *
  * @since 3.5
  */
 protected function getInputLayoutData()
 {
     $displayData = parent::getInputLayoutData();
     // 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;
     $displayData['checkedOptions'] = is_array($checkedOptions) ? $checkedOptions : explode(',', (string) $checkedOptions);
     $displayData['hasValue'] = $hasValue;
     $displayData['options'] = $this->getOptions();
     return $displayData;
 }