/** * Sets the field selected option. * * @param kyCustomFieldOption $option Field option. * @return kyCustomFieldWithOptions */ public function setSelectedOption($option) { $this->option = ky_assure_object($option, 'kyCustomFieldOption'); $this->raw_value = $this->option !== null ? $this->option->getValue() : null; return $this; }
/** * Returns field's possible options or empty list. * * @param bool $reload True to reload data from server. False to use the cached value (if present). * @return kyResultSet */ public function getOptions($reload = false) { if ($this->options !== null && !$reload) { return $this->options; } switch ($this->type) { case self::TYPE_CHECKBOX: case self::TYPE_LINKED_SELECT: case self::TYPE_MULTI_SELECT: case self::TYPE_RADIO: case self::TYPE_SELECT: $this->options = kyCustomFieldOption::getAll($this->getId(true)); break; default: $this->options = new kyResultSet(array(), 'kyCustomFieldOption'); } return $this->options; }