Sets the value of the group, this will define which elements are selected or checked.
If an array is given multiple checkboxes can be enabled.

@param  mixed $value

@return $this

@since 2.0
770001
public function setValue($value)
	{
		$this->value = $value;

		if ( ! is_array($value) && ! $value instanceof \ArrayAccess)
		{
			$valueArray = [$value];
		}
		else
		{
			$valueArray = $value;
		}

		// Loop through the contents and make any checked that need to be
		foreach ($this->getContents() as $checkbox)
		{
			$checkboxValue = $checkbox->getValue();
			if (in_array($checkboxValue, $valueArray))
			{
				$checkbox->setChecked(true);
			}
			else
			{
				$checkbox->setChecked(false);
			}
		}

		return $this;
	}
899160
public function setValue($value)
    {
        if (!is_array($value)) {
            $value = [];
        }
        foreach ($value as $key => $value) {
            $element = $this->getElement($key);
            if (!$element) {
                $this->setElement($key, ['value' => $value]);
            } else {
                $element->setValue($value);
            }
        }

        return $this;
    }
906164
public function setValue($value)
    {
        if (!isset($value)) {
            unset($this->value);
            return $this;
        }
        $this->value = (string) $value;
        return $this;
    }
880422
public function setValue($value)
    {
        if (is_array($value)) {
            $value = implode(', ', $value);
        }

        if (!is_null($value)) {
            $this->_value = $value;
            $this->appendChild($value);
        }
    }
771937
public function setValue($value)
    {
        $this->value = $value;
        if ($value instanceof ValueAwareInterface) {
            $this->value = $value->getFormValue();
        }
        return $this;
    }
258628
public function set($selector, $value)
    {
        $value = self::prepareToStore($value);

        // modify
        $arraySelector = explode('.', $selector);
        $chunksNum = count($arraySelector);

        // optimize one-level selector search
        if (1 == $chunksNum) {
            // update only if new value different from current
            if (!isset($this->data[$selector]) || $this->data[$selector] !== $value) {
                // modify
                $this->data[$selector] = $value;
                // mark field as modified
                $this->modifiedFields[] = $selector;
            }

            return $this;
        }

        // selector is nested
        $section = &$this->data;

        for ($i = 0; $i < $chunksNum - 1; $i++) {
            $field = $arraySelector[$i];

            if (!isset($section[$field])) {
                $section[$field] = array();
            } elseif (!is_array($section[$field])) {
                throw new Exception('Assigning sub-document to scalar value not allowed');
            }

            $section = &$section[$field];
        }

        // update only if new value different from current
        if (!isset($section[$arraySelector[$chunksNum - 1]]) || $section[$arraySelector[$chunksNum - 1]] !== $value) {
            // modify
            $section[$arraySelector[$chunksNum - 1]] = $value;
            // mark field as modified
            $this->modifiedFields[] = $selector;
        }

        return $this;
    }
419482
public function setValue($value)
	{
		if ( is_array($value) ) {
			return $this->setSelected($value);
		}

		return $this->selectByValue((string)$value);
	}
1129994
public function setItems(array $value) {
    if (isset($value[0]) &&
        is_object($value[0]) &&
        !$value[0] instanceof GalleryItem
    ) {
      $this->triggerError('Object not of type GalleryItem');
    }
    else {
      $this->items = $value;
    }
    return $this;
  }
1293074
public function setValue($value)
    {
        switch ($this->type) {
            case Parameter::TYPE_INTEGER:
                $this->value = (int) $value;
                break;
            case Parameter::TYPE_STRING:
            case Parameter::TYPE_ANY:
            default:
                $this->value = (string) $value;
        }

        return $this;
    }
848862
public function setValue($value): FieldTypeInterface
    {
        parent::setValue($value);

        if ($this->getValue()) {
            // The value is only set on the field when it fails
            // or when the option "flush" is set to "false".
            // If true, let's automatically add the "checked" attribute.
            $this->options['attributes']['checked'] = 'checked';
        }

        return $this;
    }
1083359
public function set($value): bool {
        //TODO throw exception instead?
        if (\is_int($value)) {
            $info = $this->getIndexAndMask($value);
            $i = $info["i"];
            $k = $info["k"];

            $flag = 1;
            $flag = $flag << $k;

            if (isset($this->array[$i])) {
                $this->array[$i] |= $flag;
            } else {
                $this->array[$i] = $flag;
            }
            return true;
        }
        return false;
    }
18623
public function setValue($value)
    {
        if ($this->validation && !$this->validates($value)) {
            throw new Invalid($this->getValidationMessage($value));
        }

        if ($this->isMultiple()) {
            $this->value = $this->value === null ? [ $value ] : array_merge($this->value, [ $value ]);
        } else {
            $this->value = $value;
        }

        return $this;
    }
815073
public function set($value = null) 
    {
        if (is_null($value)) {
            $value = array();
        }
        
        if (!is_array($value)) {
            $value = func_get_args();
        }
        
        $this->__construct($value);
        
        return $this;
    }
772197
public function setValue($value) {
        switch ($this->type) {
            case self::TYPE_BOOLEAN:
                $this->value = (bool) $value;
                break;
            case self::TYPE_STRING:
                $this->value = (string) $value;
                break;
        }
        return $this;
    }
745710
public function setValue($value)
	{
		if ( ! is_string($value) && ! is_int($value))
		{
			throw new \InvalidArgumentException('A RadioGroup value must be a string or int');
		}

		$this->value = $value;

		// Work out which of our children need to be selected
		foreach ($this->getContents() as $item)
		{
			if ($item->getValue() == $value)
			{
				$item->setChecked(true);
			}
			else
			{
				$item->setChecked(false);
			}
		}

		return $this;
	}
148868
public function setValue( $value ) {
		$this->value = $this->cleanUpValue( $value );
		$this->input->setValue( $this->value );
		return $this;
	}
1191451
public function setValue($value)
    {
        if ($value == $this->getAttribute('value')) {
            $this->check();
        } else {
            $this->uncheck();
        }
        return $this;
    }