You are here

public static function PagererPreset::preCreate in Pagerer 8

Same name and namespace in other branches
  1. 8.2 src/Entity/PagererPreset.php \Drupal\pagerer\Entity\PagererPreset::preCreate()

Changes the values of an entity before it is created.

Load defaults for example.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.

mixed[] $values: An array of values to set, keyed by property name. If the entity type has bundles the bundle key has to be specified.

Overrides EntityBase::preCreate

File

src/Entity/PagererPreset.php, line 79

Class

PagererPreset
Defines a Pagerer preset configuration entity.

Namespace

Drupal\pagerer\Entity

Code

public static function preCreate(EntityStorageInterface $storage, array &$values) {

  // Set default preset data if not set.
  if (!isset($values['panes'])) {
    $values['panes'] = \Drupal::config('pagerer.style.multipane')
      ->get('default_config.panes');
  }
}