You are here

public function FlexiformFormEntityManager::getEntity in Flexiform 8

Get the entity at a given namespace.

Parameters

string $namespace: The entity namespace to get.

File

src/FormEntity/FlexiformFormEntityManager.php, line 186

Class

FlexiformFormEntityManager
Class for form entity managers.

Namespace

Drupal\flexiform\FormEntity

Code

public function getEntity($namespace = '') {
  if (!isset($this->contexts[$namespace])) {
    throw new \Exception($this
      ->t('No entity at namespace :namespace', [
      ':namespace' => $namespace,
    ]));
  }
  $context = $this->contexts[$namespace];
  if ($context
    ->hasContextValue()) {
    return $context
      ->getContextValue();
  }
  return NULL;
}