public function RecentlyReadType::preSave in Recently Read 8
Acts on an entity before the presave hook is invoked.
Used before the entity is saved and before invoking the presave hook.
Ensure that config entities which are bundles of other entities cannot have their ID changed.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.
Throws
\Drupal\Core\Config\ConfigNameException Thrown when attempting to rename a bundle entity.
Overrides ConfigEntityBundleBase::preSave
File
- src/
Entity/ RecentlyReadType.php, line 78
Class
- RecentlyReadType
- Defines the Recently read type entity.
Namespace
Drupal\recently_read\EntityCode
public function preSave(EntityStorageInterface $storage) {
parent::preSave($storage);
$types = array_filter($this
->get('types'));
sort($types);
$this
->set('types', $types);
}