/** * @param \Drupal\migrate\Event\MigrateImportEvent $event */ public function onMigratePostImport(MigrateImportEvent $event) { if ('basic_block' === $event->getMigration()->get('id')) { $files = ['block.block.callforpaper.yml', 'block.block.featuredfirst.yml', 'block.block.featuredsecond.yml', 'block.block.featuredthird.yml', 'block.block.mentorship.yml', 'block.block.training.yml']; foreach ($files as $file) { $base_path = $this->moduleHandler->getModule('ddd_fixtures')->getPath(); $contents = @file_get_contents($base_path . '/sources/block_configs/' . $file); $config_name = basename('sources/block_configs/' . $file, '.yml'); $data = (new InstallStorage())->decode($contents); $this->configFactory->getEditable($config_name)->setData($data)->save(); } } }
/** * Gets the currency config storage. * * @return \Drupal\Core\Config\StorageInterface */ protected function getConfigStorage() { if (!$this->configStorage) { $this->configStorage = new FileStorage($this->moduleHandler->getModule('currency')->getPath() . '/config/default/'); } return $this->configStorage; }
/** * {@inheritdoc} */ public function getDirectoryPath() { $module_path = $this->moduleHandler->getModule('libraries')->getPath(); return $module_path . '/tests/' . $this->directory; }