當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ConfigImporter::getExtensionChangelist方法代碼示例

本文整理匯總了PHP中Drupal\Core\Config\ConfigImporter::getExtensionChangelist方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConfigImporter::getExtensionChangelist方法的具體用法?PHP ConfigImporter::getExtensionChangelist怎麽用?PHP ConfigImporter::getExtensionChangelist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Config\ConfigImporter的用法示例。


在下文中一共展示了ConfigImporter::getExtensionChangelist方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: validateThemes

 /**
  * Validates theme installations and uninstallations.
  *
  * @param \Drupal\Core\Config\ConfigImporter $config_importer
  *   The configuration importer.
  */
 protected function validateThemes(ConfigImporter $config_importer)
 {
     $core_extension = $config_importer->getStorageComparer()->getSourceStorage()->read('core.extension');
     // Get all themes including those that are not installed.
     $theme_data = $this->getThemeData();
     $installs = $config_importer->getExtensionChangelist('theme', 'install');
     foreach ($installs as $key => $theme) {
         if (!isset($theme_data[$theme])) {
             $config_importer->logError($this->t('Unable to install the %theme theme since it does not exist.', array('%theme' => $theme)));
             // Remove non-existing installs from the list so we can validate theme
             // dependencies later.
             unset($installs[$key]);
         }
     }
     // Ensure that all themes being installed have their dependencies met.
     foreach ($installs as $theme) {
         foreach (array_keys($theme_data[$theme]->requires) as $required_theme) {
             if (!isset($core_extension['theme'][$required_theme])) {
                 $theme_name = $theme_data[$theme]->info['name'];
                 $required_theme_name = $theme_data[$required_theme]->info['name'];
                 $config_importer->logError($this->t('Unable to install the %theme theme since it requires the %required_theme theme.', array('%theme' => $theme_name, '%required_theme' => $required_theme_name)));
             }
         }
     }
     // Ensure that all themes being uninstalled are not required by themes that
     // will be installed after the import.
     $uninstalls = $config_importer->getExtensionChangelist('theme', 'uninstall');
     foreach ($uninstalls as $theme) {
         foreach (array_keys($theme_data[$theme]->required_by) as $dependent_theme) {
             if ($theme_data[$dependent_theme]->status && !in_array($dependent_theme, $uninstalls, TRUE)) {
                 $theme_name = $theme_data[$theme]->info['name'];
                 $dependent_theme_name = $theme_data[$dependent_theme]->info['name'];
                 $config_importer->logError($this->t('Unable to uninstall the %theme theme since the %dependent_theme theme is installed.', array('%theme' => $theme_name, '%dependent_theme' => $dependent_theme_name)));
             }
         }
     }
 }
開發者ID:eigentor,項目名稱:tommiblog,代碼行數:43,代碼來源:ConfigImportSubscriber.php


注:本文中的Drupal\Core\Config\ConfigImporter::getExtensionChangelist方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。