ConfigurableLanguageManagerInterface.php 2.77 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<?php

/**
 * @file
 * Contains \Drupal\language\ConfigurableLanguageManagerInterface
 */

namespace Drupal\language;

use Drupal\Core\Language\Language;
use Drupal\Core\Language\LanguageManagerInterface;
use Symfony\Component\HttpFoundation\Request;

/**
 * Common interface for language negotiation services.
 */
interface ConfigurableLanguageManagerInterface extends LanguageManagerInterface {

19 20 21 22 23
  /**
   * Rebuild the container to register services needed on multilingual sites.
   */
  public static function rebuildServices();

24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
  /**
   * Injects the request object.
   *
   * @param \Symfony\Component\HttpFoundation\Request
   *   The request object.
   */
  public function setRequest(Request $request);

  /**
   * Returns the language negotiator.
   *
   * @retun \Drupal\language\LanguageNegotiatorInterface
   *   The language negotiator.
   */
  public function getNegotiator();

  /**
   * Injects the language negotiator.
   *
   * @param \Drupal\language\LanguageNegotiatorInterface $negotiator
   *   The language negotiator.
   */
  public function setNegotiator(LanguageNegotiatorInterface $negotiator);

  /**
   * Returns all the defined language types including fixed ones.
   *
   * A language type maybe configurable or fixed. A fixed language type is a
   * type whose language negotiation methods are module-defined and not altered
   * through the user interface.
   *
   * @return array
   *   An array of language type names.
   */
  public function getDefinedLanguageTypes();

  /**
   * Returns information about all defined language types.
   *
   * @return array
   *   An associative array of language type information arrays keyed by type
   *   names. Based on information from hook_language_types_info().
   *
   * @see hook_language_types_info()
   */
  public function getDefinedLanguageTypesInfo();

  /**
   * Stores language types configuration.
   *
   * @param array
   *   An indexed array with the following keys_
   *   - configurable: an array of configurable language type names.
   *   - all: an array of all the defined language type names.
   */
  public function saveLanguageTypesConfiguration(array $config);

  /**
   * Updates locked system language weights.
   */
  public function updateLockedLanguageWeights();

86 87 88 89 90 91 92 93 94 95 96 97 98
  /**
   * Gets a language config override object.
   *
   * @param string $langcode
   *   The language code for the override.
   * @param string $name
   *   The language configuration object name.
   *
   * @return \Drupal\Core\Config\Config
   *   The language config override object.
   */
  public function getLanguageConfigOverride($langcode, $name);

99 100 101 102 103 104 105 106
  /**
   * Prepare a language code list for unused predefined languages.
   *
   * @return array
   *   List of predefined language names keyed by langcode.
   */
  public function getUnusedPredefinedList();

107
}