public function FlexiformDisplayBase::getBaseEntity in Flexiform 7
Get the base entity for a flexiform.
By default we just create a new entity.
Overrides FlexiformDisplayInterface::getBaseEntity
3 calls to FlexiformDisplayBase::getBaseEntity()
- FlexiformDisplayBase::access in includes/
flexiform.display.inc - Check the access for this form display.
- FlexiformDisplayBase::build in includes/
flexiform.display.inc - Build the form ready for rendering.
- FlexiformDisplayCreateModal::build in includes/
display/ add_modal.display.inc - Build the form ready for rendering.
4 methods override FlexiformDisplayBase::getBaseEntity()
- FlexiformDisplayEditModal::getBaseEntity in includes/
display/ edit_modal.display.inc - Get the base entity for a flexiform.
- FlexiformDisplayEditPage::getBaseEntity in includes/
display/ edit_page.display.inc - Get the base entity for a flexiform.
- FlexiformDisplayEditPane::getBaseEntity in includes/
display/ edit_pane.display.inc - Get the base entity for a flexiform.
- FlexiformDisplayUserCategory::getBaseEntity in includes/
display/ user_category.display.inc - Get the base entity for a flexiform.
File
- includes/
flexiform.display.inc, line 106 - Specify base display classes for flexiforms.
Class
- FlexiformDisplayBase
- Base class for all flexiform displays.
Code
public function getBaseEntity($context = array()) {
$info = entity_get_info($this->flexiform->base_entity);
$values = array();
if (!empty($info['entity keys']['bundle'])) {
$values[$info['entity keys']['bundle']] = $this->flexiform->base_entity_bundle;
}
$base_entity = entity_create($this->flexiform->base_entity, $values);
// Make sure the entity label is always set to play nicely with ctools.
if (!empty($info['entity keys']['label']) && !isset($base_entity->{$info['entity keys']['label']})) {
$base_entity->{$info['entity keys']['label']} = '';
}
// Make sure the id key is always set to play nicely with ctools.
if (!empty($info['entity keys']['id']) && !isset($base_entity->{$info['entity keys']['id']})) {
$base_entity->{$info['entity keys']['id']} = NULL;
}
return $base_entity;
}