public function Number::setValue in SCSS Compiler 1.0.x
Same name in this branch
- 1.0.x src/Config/Schema/Number.php \Drupal\compiler_scss\Config\Schema\Number::setValue()
- 1.0.x src/Plugin/DataType/Number.php \Drupal\compiler_scss\Plugin\DataType\Number::setValue()
Sets the data value.
Parameters
mixed|null $value: The value to set in the format as documented for the data type or NULL to unset the data value.
bool $notify: (optional) Whether to notify the parent object of the change. Defaults to TRUE. If a property is updated from a parent object, set it to FALSE to avoid being notified again.
Throws
\InvalidArgumentException If the value input is inappropriate.
\Drupal\Core\TypedData\Exception\ReadOnlyException If the data is read-only.
Overrides TypedData::setValue
File
- src/
Config/ Schema/ Number.php, line 59
Class
- Number
- A config schema type used to represent a Sass number.
Namespace
Drupal\compiler_scss\Config\SchemaCode
public function setValue($value, $notify = TRUE) {
if ($value instanceof IntermediateNumber) {
$value = [
'value' => $value
->value(),
'unit' => $value
->unit(),
];
}
elseif (is_numeric($value)) {
$value = [
'value' => $value,
];
}
parent::setValue($value, $notify);
}