$data = &$this->objectTypes;
}
- // no data provided and no POST data exists
- /*if ($data === null || !is_array($data)) {
- // nothing to do here
- return;
- }*/
-
foreach ($this->labelObjectTypeContainers as $objectTypeID => $container) {
- if ($container->isBooleanOption()) {
- $optionValue = isset($data[$objectTypeID]) ? 1 : 0;
- $container->setOptionValue($optionValue);
- }
- else {
- $hasData = isset($data[$objectTypeID]);
- foreach ($container as $object) {
- if (!$hasData) {
- $object->setOptionValue(0);
- }
- else {
- $optionValue = in_array($object->getObjectID(), $data[$objectTypeID]) ? 1 : 0;
- $object->setOptionValue($optionValue);
- }
+ $hasData = isset($data[$objectTypeID]);
+ foreach ($container as $object) {
+ if (!$hasData) {
+ $object->setOptionValue(0);
+ }
+ else {
+ $optionValue = in_array($object->getObjectID(), $data[$objectTypeID]) ? 1 : 0;
+ $object->setOptionValue($optionValue);
}
}
}
* @package WoltLabSuite\Core\System\Label\Object\Type
*/
class LabelObjectTypeContainer implements \Countable, \Iterator {
- /**
- * true if container represents only a boolean option
- * @var boolean
- */
- public $isBooleanOption = false;
-
/**
* list of object types
* @var LabelObjectType[]
*/
public $objectTypeID = 0;
- /**
- * option value if container is a boolean option itself
- * @var boolean
- */
- public $optionValue = false;
-
/**
* iterator position
* @var integer
* Creates a new LabelObjectTypeContainer object.
*
* @param integer $objectTypeID
- * @param boolean $isBooleanOption
- * @param boolean $optionValue
*/
- public function __construct($objectTypeID, $isBooleanOption = false, $optionValue = false) {
+ public function __construct($objectTypeID) {
$this->objectTypeID = $objectTypeID;
- $this->isBooleanOption = $isBooleanOption;
- $this->optionValue = $optionValue;
}
/**
return ObjectTypeCache::getInstance()->getObjectType($this->getObjectTypeID())->objectType;
}
- /**
- * Returns true, if container represents only a boolean option.
- *
- * @return boolean
- */
- public function isBooleanOption() {
- return $this->isBooleanOption;
- }
-
- /**
- * Returns option value.
- *
- * @return boolean
- */
- public function getOptionValue() {
- return $this->optionValue;
- }
-
/**
* @inheritDoc
* @return LabelObjectType