You are here

public function PriceItem::toPrice in Price 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::toPrice()
  2. 3.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::toPrice()
  3. 2.0.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.

File

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

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);
}