You are here

public function PriceItem::toPrice in Price 8

Same name and namespace in other branches
  1. 3.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::toPrice()
  2. 2.0.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::toPrice()
  3. 2.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::toPrice()
  4. 3.0.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::toPrice()

Gets the Price value object for the current field item.

Return value

\Drupal\price\Price The Price value object.

1 method overrides PriceItem::toPrice()
PriceModifiedItem::toPrice in src/Plugin/Field/FieldType/PriceModifiedItem.php
Gets the Price value object for the current field item.

File

src/Plugin/Field/FieldType/PriceItem.php, line 145

Class

PriceItem
Plugin implementation of the 'price' field type.

Namespace

Drupal\price\Plugin\Field\FieldType

Code

public function toPrice() {
  return new Price($this->number, $this->currency_code);
}