public function FlexiformFormEntityNewCommerceLineItem::getEntity in Flexiform 7
Get the entity for the form.
Return value
A loaded or created entity object ready for use in the form.
Overrides FlexiformFormEntityBase::getEntity
File
- includes/
form_entity/ commerce_line_item.form_entity.inc, line 15 - Contains class for a basic entity getter.
Class
- FlexiformFormEntityNewCommerceLineItem
- Form Entity Class for getting new commerce line items.
Code
public function getEntity() {
parent::getEntity();
// Get the base order
$order = $this
->getParam('base');
// Check we have enough information to load the entity.
if (!$order) {
return FALSE;
}
$target_entity = commerce_line_item_new($this->settings['bundle'], $order->order_id);
return $this
->checkBundle($target_entity) ? $target_entity : FALSE;
}