public FieldStorageConfig::preSave(EntityStorageInterface $storage)
Overrides \Drupal\Core\Entity\Entity::preSave().
Throws
\Drupal\Core\Field\FieldException If the field definition is invalid.
\Drupal\Core\Entity\EntityStorageException In case of failures at the configuration storage level.
Overrides ConfigEntityBase::preSave
File
- core/modules/field/src/Entity/FieldStorageConfig.php, line 274
Class
- FieldStorageConfig
- Defines the Field storage configuration entity.
Namespace
Drupal\field\Entity
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | public function preSave(EntityStorageInterface $storage ) { // Clear the derived data about the field. unset( $this ->schema); // Filter out unknown settings and make sure all settings are present, so // that a complete field definition is passed to the various hooks and // written to config. $field_type_manager = \Drupal::service( 'plugin.manager.field.field_type' ); $default_settings = $field_type_manager ->getDefaultStorageSettings( $this ->type); $this ->settings = array_intersect_key ( $this ->settings, $default_settings ) + $default_settings ; if ( $this ->isNew()) { $this ->preSaveNew( $storage ); } else { $this ->preSaveUpdated( $storage ); } parent::preSave( $storage ); } |
Please login to continue.