protected ConfigImporter::importInvokeOwner($collection, $op, $name)
Invokes import* methods on configuration entity storage.
Allow modules to take over configuration change operations for higher-level configuration data.
@todo Add support for other extension types; e.g., themes etc.
Parameters
string $collection: The configuration collection.
string $op: The change operation to get the unprocessed list for, either delete, create, rename, or update.
string $name: The name of the configuration to process.
Return value
bool TRUE if the configuration was imported as a configuration entity. FALSE otherwise.
Throws
\Drupal\Core\Entity\EntityStorageException Thrown if the data is owned by an entity type, but the entity storage does not support imports.
File
- core/lib/Drupal/Core/Config/ConfigImporter.php, line 945
Class
- ConfigImporter
- Defines a configuration importer.
Namespace
Drupal\Core\Config
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | protected function importInvokeOwner( $collection , $op , $name ) { // Renames are handled separately. if ( $op == 'rename' ) { return $this ->importInvokeRename( $collection , $name ); } // Validate the configuration object name before importing it. // Config::validateName($name); if ( $entity_type = $this ->configManager->getEntityTypeIdByName( $name )) { $old_config = new Config( $name , $this ->storageComparer->getTargetStorage( $collection ), $this ->eventDispatcher, $this ->typedConfigManager); if ( $old_data = $this ->storageComparer->getTargetStorage( $collection )->read( $name )) { $old_config ->initWithData( $old_data ); } $data = $this ->storageComparer->getSourceStorage( $collection )->read( $name ); $new_config = new Config( $name , $this ->storageComparer->getTargetStorage( $collection ), $this ->eventDispatcher, $this ->typedConfigManager); if ( $data !== FALSE) { $new_config ->setData( $data ); } $method = 'import' . ucfirst( $op ); $entity_storage = $this ->configManager->getEntityManager()->getStorage( $entity_type ); // Call to the configuration entity's storage to handle the configuration // change. if (!( $entity_storage instanceof ImportableEntityStorageInterface)) { throw new EntityStorageException(sprintf( 'The entity storage "%s" for the "%s" entity type does not support imports' , get_class( $entity_storage ), $entity_type )); } $entity_storage -> $method ( $name , $new_config , $old_config ); $this ->setProcessedConfiguration( $collection , $op , $name ); return TRUE; } return FALSE; } |
Please login to continue.