ConfigurableLanguageManagerInterface.php 3.02 KB
Newer Older
1 2 3 4 5 6 7 8 9
<?php

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

namespace Drupal\language;

10
use Drupal\Core\Language\LanguageInterface;
11 12 13 14 15 16 17 18
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
  /**
   * Returns the language negotiator.
   *
27
   * @return \Drupal\language\LanguageNegotiatorInterface
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
   *   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
48
   *   An array of language type machine names.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
   */
  public function getDefinedLanguageTypes();

  /**
   * 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();

67 68 69 70 71 72 73 74
  /**
   * Gets a language config override object.
   *
   * @param string $langcode
   *   The language code for the override.
   * @param string $name
   *   The language configuration object name.
   *
75
   * @return \Drupal\language\Config\LanguageConfigOverride
76 77 78 79
   *   The language config override object.
   */
  public function getLanguageConfigOverride($langcode, $name);

80 81 82 83 84 85 86 87 88 89 90 91
  /**
   * Gets a language configuration override storage object.
   *
   * @param string $langcode
   *   The language code for the override.
   *
   * @return \Drupal\Core\Config\StorageInterface $storage
   *   A storage object to use for reading and writing the
   *   configuration override.
   */
  public function getLanguageConfigOverrideStorage($langcode);

92
  /**
93
   * Returns the standard language list excluding already configured languages.
94 95
   *
   * @return array
96
   *   A list of standard language names keyed by langcode.
97
   */
98
  public function getStandardLanguageListWithoutConfigured();
99

100 101 102 103 104 105 106 107 108 109 110 111
  /**
   * Gets the negotiated language method ID.
   *
   * @param string $type
   *   (optional) The language type; e.g., the interface or the content
   *   language.
   *
   * @return string
   *   The negotiated language method ID.
   */
  public function getNegotiatedLanguageMethod($type = LanguageInterface::TYPE_INTERFACE);

112
}