You are here

public function FlexiformFormEntityManager::saveFormEntities in Flexiform 8

Save the form entities.

Parameters

bool $save_base: Whether or not to save the base entity.

File

src/FormEntity/FlexiformFormEntityManager.php, line 138

Class

FlexiformFormEntityManager
Class for form entity managers.

Namespace

Drupal\flexiform\FormEntity

Code

public function saveFormEntities($save_base = FALSE) {
  foreach ($this->contexts as $namespace => $context) {
    if ($namespace == '' && !$save_base) {
      continue;
    }
    if ($entity = $context
      ->getContextValue()) {
      $context
        ->getFormEntity()
        ->saveEntity($entity);
      $this
        ->clearDeferredSave($entity);
    }
  }

  // At the end loop over any deferred saves and perform them.
  foreach ($this->deferredSaves as $entity) {
    $entity
      ->save();
    $this
      ->clearDeferredSave($entity);
  }
}