public static function Newsletter::preCreate in Simplenews 8
Same name and namespace in other branches
- 8.2 src/Entity/Newsletter.php \Drupal\simplenews\Entity\Newsletter::preCreate()
- 3.x src/Entity/Newsletter.php \Drupal\simplenews\Entity\Newsletter::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/ Newsletter.php, line 147
Class
- Newsletter
- Defines the simplenews newsletter entity.
Namespace
Drupal\simplenews\EntityCode
public static function preCreate(EntityStorageInterface $storage, array &$values) {
$config = \Drupal::config('simplenews.settings');
$values += array(
'format' => $config
->get('newsletter.format'),
'priority' => $config
->get('newsletter.priority'),
'receipt' => $config
->get('newsletter.receipt'),
'from_name' => $config
->get('newsletter.from_name'),
'from_address' => $config
->get('newsletter.from_address'),
);
parent::preCreate($storage, $values);
}