当前位置: 首页>>代码示例>>PHP>>正文


PHP LanguageManagerInterface::getLanguageConfigOverride方法代码示例

本文整理汇总了PHP中Drupal\Core\Language\LanguageManagerInterface::getLanguageConfigOverride方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageManagerInterface::getLanguageConfigOverride方法的具体用法?PHP LanguageManagerInterface::getLanguageConfigOverride怎么用?PHP LanguageManagerInterface::getLanguageConfigOverride使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Language\LanguageManagerInterface的用法示例。


在下文中一共展示了LanguageManagerInterface::getLanguageConfigOverride方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: routes

 /**
  * Returns an array of route objects.
  *
  * @return \Symfony\Component\Routing\Route[]
  *   An array of route objects.
  */
 public function routes()
 {
     $routes = array();
     $is_multilingual = $this->languageManager->isMultilingual();
     /* @var $search_api_page \Drupal\search_api_page\SearchApiPageInterface */
     foreach ($this->entityManager->getStorage('search_api_page')->loadMultiple() as $search_api_page) {
         // Default path.
         $default_path = $search_api_page->getPath();
         // Loop over all languages so we can get the translated path (if any).
         foreach ($this->languageManager->getLanguages() as $language) {
             // Check if we are multilingual or not.
             if ($is_multilingual) {
                 $path = $this->languageManager->getLanguageConfigOverride($language->getId(), 'search_api_page.search_api_page.' . $search_api_page->id())->get('path');
             }
             if (empty($path)) {
                 $path = $default_path;
             }
             $args = ['_controller' => 'Drupal\\search_api_page\\Controller\\SearchApiPageController::page', 'search_api_page_name' => $search_api_page->id()];
             // Use clean urls or not.
             if ($search_api_page->getCleanUrl()) {
                 $path .= '/{keys}';
                 $args['keys'] = '';
             }
             $routes['search_api_page.' . $language->getId() . '.' . $search_api_page->id()] = new Route($path, $args, array('_permission' => 'view search api pages'));
         }
     }
     return $routes;
 }
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:34,代码来源:SearchApiPageRoutes.php

示例2: import

 /**
  * {@inheritdoc}
  */
 public function import(Row $row, array $old_destination_id_values = array())
 {
     if ($row->hasDestinationProperty('langcode')) {
         $this->config = $this->language_manager->getLanguageConfigOverride($row->getDestinationProperty('langcode'), $this->config->getName());
     }
     foreach ($row->getRawDestination() as $key => $value) {
         if (isset($value) || !empty($this->configuration['store null'])) {
             $this->config->set(str_replace(Row::PROPERTY_SEPARATOR, '.', $key), $value);
         }
     }
     $this->config->save();
     return [$this->config->getName()];
 }
开发者ID:systemick3,项目名称:systemick.co.uk,代码行数:16,代码来源:Config.php

示例3: importTranslations

 /**
  * {@inheritdoc}
  */
 public function importTranslations(array $langcodes)
 {
     $available_translations = $this->getAvailableTranslations();
     $available_translations = array_intersect_key($available_translations, array_flip($langcodes));
     foreach ($available_translations as $langcode => $country_codes) {
         $address_formats = $this->storage->loadMultiple($country_codes);
         foreach ($address_formats as $country_code => $address_format) {
             $external_translation = $this->externalRepository->get($country_code, $langcode);
             $config_name = $address_format->getConfigDependencyName();
             $config_translation = $this->languageManager->getLanguageConfigOverride($langcode, $config_name);
             $config_translation->set('format', $external_translation->getFormat());
             $config_translation->save();
         }
     }
 }
开发者ID:r-daneelolivaw,项目名称:chalk,代码行数:18,代码来源:AddressFormatImporter.php

示例4: importEntityTranslations

  /**
   * Imports translations for the given currency entity.
   *
   * @param \Drupal\commerce_price\Entity\CurrencyInterface $currency
   *   The currency entity.
   * @param array $langcodes
   *   The langcodes.
   */
  protected function importEntityTranslations(CurrencyInterface $currency, array $langcodes) {
    $currencyCode = $currency->getCurrencyCode();
    $configName = $currency->getConfigDependencyName();
    foreach ($langcodes as $langcode) {
      try {
        $translatedCurrency = $this->externalRepository->get($currencyCode, $langcode);
      }
      catch (UnknownLocaleException $e) {
        // No translation found.
        continue;
      }

      $configTranslation = $this->languageManager->getLanguageConfigOverride($langcode, $configName);
      if ($configTranslation->isNew()) {
        $configTranslation->set('name', $translatedCurrency->getName());
        $configTranslation->set('symbol', $translatedCurrency->getSymbol());
        $configTranslation->save();
      }
    }
  }
开发者ID:housineali,项目名称:drpl8_dv,代码行数:28,代码来源:CurrencyImporter.php


注:本文中的Drupal\Core\Language\LanguageManagerInterface::getLanguageConfigOverride方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。