public function PriceItem::setValue in Price 8
Same name and namespace in other branches
- 3.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::setValue()
- 2.0.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::setValue()
- 2.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::setValue()
- 3.0.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::setValue()
Overrides \Drupal\Core\TypedData\TypedData::setValue().
Parameters
array|null $values: An array of property values.
Overrides FieldItemBase::setValue
1 call to PriceItem::setValue()
- PriceModifiedItem::setValue in src/
Plugin/ Field/ FieldType/ PriceModifiedItem.php - Sets the data value.
1 method overrides PriceItem::setValue()
- PriceModifiedItem::setValue in src/
Plugin/ Field/ FieldType/ PriceModifiedItem.php - Sets the data value.
File
- src/
Plugin/ Field/ FieldType/ PriceItem.php, line 127
Class
- PriceItem
- Plugin implementation of the 'price' field type.
Namespace
Drupal\price\Plugin\Field\FieldTypeCode
public function setValue($values, $notify = TRUE) {
// Allow callers to pass a Price value object as the field item value.
if ($values instanceof Price) {
$price = $values;
$values = [
'number' => $price
->getNumber(),
'currency_code' => $price
->getCurrencyCode(),
];
}
parent::setValue($values, $notify);
}