You are here

public function FlexiformFormEntityLegacy::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/legacy.form_entity.inc, line 15
Contains Legacy Form Entity Class to Utilise Old Getters and Setters.

Class

FlexiformFormEntityLegacy
Legacy form entity class.

Code

public function getEntity() {
  parent::getEntity();
  $getter = $this->getter;
  $base_entity = $this->manager
    ->getBaseEntity();
  $entities = $this->manager
    ->getEntitiesRaw();
  if (isset($getter['file']) && file_exists(drupal_get_path('module', $getter['module']) . '/' . $getter['file'])) {
    include_once drupal_get_path('module', $getter['module']) . '/' . $getter['file'];
  }
  $callback = $getter['getter callback'];
  if (function_exists($callback)) {

    // Todo: Sort out params
    return $callback($this->manager
      ->getBuilder()
      ->getFlexiform(), $base_entity, $entities, $this->entity_namespace, $getter);
  }
}