You are here

protected function WebformEntityStorage::doCreate in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/WebformEntityStorage.php \Drupal\webform\WebformEntityStorage::doCreate()

Performs storage-specific creation of entities.

Parameters

array $values: An array of values to set, keyed by property name.

Return value

\Drupal\Core\Entity\EntityInterface

Overrides ConfigEntityStorage::doCreate

File

src/WebformEntityStorage.php, line 100

Class

WebformEntityStorage
Storage controller class for "webform" configuration entities.

Namespace

Drupal\webform

Code

protected function doCreate(array $values) {
  $entity = parent::doCreate($values);

  // Cache new created webform entity so that it can be loaded using just the
  // webform's id.
  // @see '_webform_ui_temp_form'
  // @see \Drupal\webform_ui\Form\WebformUiElementTestForm
  // @see \Drupal\webform_ui\Form\WebformUiElementTypeFormBase
  $id = $entity
    ->id();
  if ($id && $id === '_webform_ui_temp_form') {
    $this
      ->setStaticCache([
      $id => $entity,
    ]);
  }
  return $entity;
}