public function FileEntity::updateBundle in File Entity (fieldable files) 8.2
Updates the file bundle.
3 calls to FileEntity::updateBundle()
- FileEntity::postCreate in src/
Entity/ FileEntity.php - Acts on a created entity before hooks are invoked.
- FileEntity::preSave in src/
Entity/ FileEntity.php - Acts on an entity before the presave hook is invoked.
- FileEntity::validate in src/
Entity/ FileEntity.php - Validates the currently set values.
File
- src/
Entity/ FileEntity.php, line 309
Class
- FileEntity
- Replace for the core file entity class.
Namespace
Drupal\file_entity\EntityCode
public function updateBundle($type = NULL) {
if (!$type) {
$type = $this
->determineType();
if (!$type) {
return;
}
}
// Update the type field.
$this
->get('type')->target_id = $type;
// Clear the field definitions, so that they will be fetched for the new bundle.
$this->fieldDefinitions = NULL;
$this->typedData = NULL;
// Update the entity keys cache.
$this->entityKeys['bundle'] = $type;
}