public function MultiversionManager::allowToAlter in Multiversion 8
Same name and namespace in other branches
- 8.2 src/MultiversionManager.php \Drupal\multiversion\MultiversionManager::allowToAlter()
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type:
Return value
boolean
Overrides MultiversionManagerInterface::allowToAlter
File
- src/
MultiversionManager.php, line 227
Class
Namespace
Drupal\multiversionCode
public function allowToAlter(EntityTypeInterface $entity_type) {
$supported_entity_types = \Drupal::config('multiversion.settings')
->get('supported_entity_types') ?: [];
$id = $entity_type
->id();
$enable_migration = self::enableMigrationIsActive();
$disable_migration = self::disableMigrationIsActive();
// Don't allow to alter entity type that is not supported.
if (!in_array($id, $supported_entity_types)) {
return FALSE;
}
// Don't allow to alter entity type that is in process to be disabled.
if (is_array($disable_migration) && in_array($id, $disable_migration)) {
return FALSE;
}
// Allow to alter entity type that is in process to be enabled.
if (is_array($enable_migration) && in_array($id, $enable_migration)) {
return TRUE;
}
return $this
->isEnabledEntityType($entity_type);
}