You are here

protected function FlexiformFormEntityEntityReference::createEntity in Flexiform 7

Create an entity if the settings allow it.

1 call to FlexiformFormEntityEntityReference::createEntity()
FlexiformFormEntityEntityReference::getEntity in includes/form_entity/entityreference.form_entity.inc
Get the entity for the form.

File

includes/form_entity/entityreference.form_entity.inc, line 48
Contains class for a basic entity getter.

Class

FlexiformFormEntityEntityReference
Form Entity Class for Managing the Entity Reference fields

Code

protected function createEntity() {
  if (empty($this->settings['create'])) {
    return FALSE;
  }
  $entity_info = entity_get_info($this->entity_type);
  $values = array();
  if (!empty($entity_info['entity keys']['bundle'])) {
    $values[$entity_info['entity keys']['bundle']] = $this->settings['bundle'];
  }
  return entity_create($this->entity_type, $values);
}