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


PHP Settings::getInstance方法代碼示例

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


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

示例1: setMinimalContainerPreKernel

 public function setMinimalContainerPreKernel()
 {
     // Create a minimal mocked container to support calls to t() in the pre-kernel
     // base system verification code paths below. The strings are not actually
     // used or output for these calls.
     $container = new ContainerBuilder();
     $container->setParameter('language.default_values', Language::$defaultValues);
     $container->register('language.default', 'Drupal\\Core\\Language\\LanguageDefault')->addArgument('%language.default_values%');
     $container->register('string_translation', 'Drupal\\Core\\StringTranslation\\TranslationManager')->addArgument(new Reference('language.default'));
     // Register the stream wrapper manager.
     $container->register('stream_wrapper_manager', 'Drupal\\Core\\StreamWrapper\\StreamWrapperManager')->addMethodCall('setContainer', array(new Reference('service_container')));
     $container->register('file_system', 'Drupal\\Core\\File\\FileSystem')->addArgument(new Reference('stream_wrapper_manager'))->addArgument(Settings::getInstance())->addArgument((new LoggerChannelFactory())->get('file'));
     \Drupal::setContainer($container);
 }
開發者ID:jeyram,項目名稱:DrupalConsole,代碼行數:14,代碼來源:DrupalApi.php

示例2: testGetInstance

 /**
  * @covers ::getInstance
  */
 public function testGetInstance()
 {
     $singleton = $this->settings->getInstance();
     $this->assertEquals($singleton, $this->settings);
 }
開發者ID:alnutile,項目名稱:drunatra,代碼行數:8,代碼來源:SettingsTest.php

示例3: getSettingsService

 /**
  * Gets the 'settings' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Drupal\Core\Site\Settings A Drupal\Core\Site\Settings instance.
  */
 protected function getSettingsService()
 {
     $this->services['settings'] = $instance = \Drupal\Core\Site\Settings::getInstance();
     $instance->_serviceId = 'settings';
     return $instance;
 }
開發者ID:Nouveau,項目名稱:gishtips,代碼行數:14,代碼來源:742b68919a9d7ff14289a2d915b41c1157fde904dd832ad5776c8ad66b5975e8.php

示例4: getSettings

 /**
  * @return \Drupal\Core\Site\Settings
  */
 public function getSettings()
 {
     if ($settings = $this->getService('settings')) {
         return $settings;
     }
     $kernelHelper = $this->getKernelHelper();
     $drupal = $this->getDrupalHelper();
     if ($kernelHelper && $drupal) {
         Settings::initialize($drupal->getRoot(), $kernelHelper->getSitePath(), $kernelHelper->getClassLoader());
         return Settings::getInstance();
     }
     return null;
 }
開發者ID:blasoliva,項目名稱:DrupalConsole,代碼行數:16,代碼來源:ContainerAwareCommand.php

示例5: setSetting

 /**
  * Sets an in-memory Settings variable.
  *
  * @param string $name
  *   The name of the setting to set.
  * @param bool|string|int|array|null $value
  *   The value to set. Note that array values are replaced entirely; use
  *   \Drupal\Core\Site\Settings::get() to perform custom merges.
  */
 protected function setSetting($name, $value)
 {
     $settings = Settings::getInstance() ? Settings::getAll() : [];
     $settings[$name] = $value;
     new Settings($settings);
 }
開發者ID:eigentor,項目名稱:tommiblog,代碼行數:15,代碼來源:KernelTestBase.php


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