You are here

public function YamlFormEntityStorage::load in YAML Form 8

Config entities are not cached and there is no easy way to enable static caching. See: Issue #1885830: Enable static caching for config entities.

Overriding just EntityStorageBase::load is much simpler than completely re-writting EntityStorageBase::loadMultiple. It is also worth noting that EntityStorageBase::resetCache() does purge all cached yamlform config entities.

Forms need to be cached when they are being loading via a form submission, which requires a form's elements and meta data to be initialized via YamlForm::initElements().

Overrides EntityStorageBase::load

See also

https://www.drupal.org/node/1885830

\Drupal\Core\Entity\EntityStorageBase::resetCache()

\Drupal\yamlform\Entity\YamlForm::initElements()

File

src/YamlFormEntityStorage.php, line 31

Class

YamlFormEntityStorage
Storage controller class for "yamlform" configuration entities.

Namespace

Drupal\yamlform

Code

public function load($id) {
  if (isset($this->entities[$id])) {
    return $this->entities[$id];
  }
  $this->entities[$id] = parent::load($id);
  return $this->entities[$id];
}