Drupal 8  8.0.2
ConfigurableLanguageManager Class Reference
Inheritance diagram for ConfigurableLanguageManager:

Public Member Functions

 __construct (LanguageDefault $default_language, ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, LanguageConfigFactoryOverrideInterface $config_override, RequestStack $request_stack)
 
 init ()
 
 isMultilingual ()
 
 getLanguageTypes ()
 
 getDefinedLanguageTypes ()
 
 getDefinedLanguageTypesInfo ()
 
 saveLanguageTypesConfiguration (array $values)
 
 getCurrentLanguage ($type=LanguageInterface::TYPE_INTERFACE)
 
 reset ($type=NULL)
 
 getNegotiator ()
 
 setNegotiator (LanguageNegotiatorInterface $negotiator)
 
 getLanguages ($flags=LanguageInterface::STATE_CONFIGURABLE)
 
 getNativeLanguages ()
 
 updateLockedLanguageWeights ()
 
 getFallbackCandidates (array $context=array())
 
 getLanguageSwitchLinks ($type, Url $url)
 
 setConfigOverrideLanguage (LanguageInterface $language=NULL)
 
 getConfigOverrideLanguage ()
 
 getLanguageConfigOverride ($langcode, $name)
 
 getLanguageConfigOverrideStorage ($langcode)
 
 getStandardLanguageListWithoutConfigured ()
 
 getNegotiatedLanguageMethod ($type=LanguageInterface::TYPE_INTERFACE)
 
- Public Member Functions inherited from LanguageManager
 __construct (LanguageDefault $default_language)
 
 isMultilingual ()
 
 getLanguageTypes ()
 
 getDefinedLanguageTypesInfo ()
 
 getCurrentLanguage ($type=LanguageInterface::TYPE_INTERFACE)
 
 reset ($type=NULL)
 
 getDefaultLanguage ()
 
 getLanguages ($flags=LanguageInterface::STATE_CONFIGURABLE)
 
 getNativeLanguages ()
 
 getLanguage ($langcode)
 
 getLanguageName ($langcode)
 
 getDefaultLockedLanguages ($weight=0)
 
 isLanguageLocked ($langcode)
 
 getFallbackCandidates (array $context=array())
 
 getLanguageSwitchLinks ($type, Url $url)
 
 setConfigOverrideLanguage (LanguageInterface $language=NULL)
 
 getConfigOverrideLanguage ()
 

Static Public Member Functions

static rebuildServices ()
 
- Static Public Member Functions inherited from LanguageManager
static getStandardLanguageList ()
 

Protected Member Functions

 loadLanguageTypesConfiguration ()
 
- Protected Member Functions inherited from LanguageManager
 filterLanguages (array $languages, $flags=LanguageInterface::STATE_CONFIGURABLE)
 

Protected Attributes

 $configFactory
 
 $moduleHandler
 
 $configFactoryOverride
 
 $requestStack
 
 $negotiator
 
 $languageTypes
 
 $languageTypesInfo
 
 $negotiatedLanguages
 
 $negotiatedMethods
 
 $initialized = FALSE
 
 $initializing = FALSE
 
- Protected Attributes inherited from LanguageManager
 $languages = array()
 
 $defaultLanguage
 

Detailed Description

Overrides default LanguageManager to provide configured languages.

Constructor & Destructor Documentation

__construct ( LanguageDefault  $default_language,
ConfigFactoryInterface  $config_factory,
ModuleHandlerInterface  $module_handler,
LanguageConfigFactoryOverrideInterface  $config_override,
RequestStack  $request_stack 
)

Constructs a new ConfigurableLanguageManager object.

Parameters
\Drupal\Core\Language\LanguageDefault$default_languageThe default language service.
\Drupal\Core\Config\ConfigFactoryInterface$config_factoryThe configuration factory service.
\Drupal\Core\Extension\ModuleHandlerInterface$module_handlerThe module handler service.
\Drupal\language\Config\LanguageConfigFactoryOverrideInterface$config_overrideThe language configuration override service.
\Symfony\Component\HttpFoundation\RequestStack$request_stackThe request stack object.

References Drupal\configFactory(), Drupal\moduleHandler(), and Drupal\requestStack().

Here is the call graph for this function:

Member Function Documentation

getConfigOverrideLanguage ( )

{Gets the current configuration override language.

Returns
The current configuration override language.
}

Implements LanguageManagerInterface.

Referenced by ConfigurableLanguageManager\getLanguages(), and ConfigurableLanguageManager\getNativeLanguages().

Here is the caller graph for this function:

getCurrentLanguage (   $type = LanguageInterface::TYPE_INTERFACE)

{Returns the current language for the given type.

Parameters
string$type(optional) The language type; e.g., the interface or the content language. Defaults to ::TYPE_INTERFACE.
Returns
The current language object for the given type of language.
}

Implements LanguageManagerInterface.

References LanguageManager\getDefaultLanguage(), ConfigurableLanguageManager\isMultilingual(), LanguageInterface\LANGCODE_SYSTEM, ConfigurableLanguageManager\reset(), and LanguageInterface\TYPE_INTERFACE.

Referenced by ConfigurableLanguageManager\getLanguages(), and ConfigurableLanguageManager\init().

Here is the call graph for this function:

Here is the caller graph for this function:

getDefinedLanguageTypes ( )

{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.

Returns
array An array of language type machine names.
}

Implements ConfigurableLanguageManagerInterface.

References ConfigurableLanguageManager\loadLanguageTypesConfiguration().

Referenced by ConfigurableLanguageManager\init().

Here is the call graph for this function:

Here is the caller graph for this function:

getDefinedLanguageTypesInfo ( )

{Returns information about all defined language types.

Returns
array An associative array of language type information arrays keyed by language type machine name, in the format of hook_language_types_info(). In some implementing classes, this is based on information from hook_language_types_info() and hook_language_types_info_alter().
}

Implements LanguageManagerInterface.

References Drupal\moduleHandler().

Here is the call graph for this function:

getFallbackCandidates ( array  $context = array())

{Returns the language fallback candidates for a given context.

Parameters
array$context(optional) An associative array of data that can be useful to determine the fallback sequence. The following keys are used in core:
  • langcode: Language code of the desired language.
  • operation: The name of the operation indicating the context where language fallback is being applied. The following operations are defined in core, but more may be defined in contributed modules:
    • entity_view: Invoked when an entity is about to be displayed. The data key contains the loaded entity.
    • views_query: Invoked when a field based views query is performed. The data key contains a reference to the field object.
    • locale_lookup: Invoked when a string translation was not found. The data key contains the source string.
  • data: A data structure that makes sense in the provided context, see above.
Returns
array An array of language codes sorted by priority: first values should be tried first.
}

Implements LanguageManagerInterface.

References ConfigurableLanguageManager\getLanguages(), ConfigurableLanguageManager\isMultilingual(), LanguageInterface\LANGCODE_NOT_SPECIFIED, and Drupal\moduleHandler().

Here is the call graph for this function:

getLanguageConfigOverride (   $langcode,
  $name 
)

{Gets a language config override object.

Parameters
string$langcodeThe language code for the override.
string$nameThe language configuration object name.
Returns
The language config override object.
}

Implements ConfigurableLanguageManagerInterface.

getLanguageConfigOverrideStorage (   $langcode)

{Gets a language configuration override storage object.

Parameters
string$langcodeThe language code for the override.
Returns
$storage A storage object to use for reading and writing the configuration override.
}

Implements ConfigurableLanguageManagerInterface.

getLanguages (   $flags = LanguageInterface::STATE_CONFIGURABLE)

{Returns a list of languages set up on the site.

Parameters
int$flags(optional) Specifies the state of the languages that have to be returned. It can be: LanguageInterface::STATE_CONFIGURABLE, LanguageInterface::STATE_LOCKED, or LanguageInterface::STATE_ALL.
Returns
[] An associative array of languages, keyed by the language code.
}

Implements LanguageManagerInterface.

References Drupal\configFactory(), LanguageManager\filterLanguages(), ConfigurableLanguageManager\getConfigOverrideLanguage(), ConfigurableLanguageManager\getCurrentLanguage(), LanguageManager\getDefaultLanguage(), LanguageManager\getDefaultLockedLanguages(), and Language\sort().

Referenced by ConfigurableLanguageManager\getFallbackCandidates(), ConfigurableLanguageManager\getNativeLanguages(), ConfigurableLanguageManager\getStandardLanguageListWithoutConfigured(), ConfigurableLanguageManager\isMultilingual(), and ConfigurableLanguageManager\updateLockedLanguageWeights().

Here is the call graph for this function:

Here is the caller graph for this function:

getLanguageSwitchLinks (   $type,
Url  $url 
)

{}

References Drupal\moduleHandler(), and Drupal\requestStack().

Here is the call graph for this function:

getLanguageTypes ( )

{Returns an array of the available language types.

Returns
array An array of language type machine names.
}

Implements LanguageManagerInterface.

References ConfigurableLanguageManager\loadLanguageTypesConfiguration().

Here is the call graph for this function:

getNativeLanguages ( )

{Returns a list of languages set up on the site in their native form.

Returns
[] An associative array of languages, keyed by the language code, ordered by weight ascending and name ascending.
}

Implements LanguageManagerInterface.

References ConfigurableLanguageManager\getConfigOverrideLanguage(), ConfigurableLanguageManager\getLanguages(), Entity\load(), ConfigurableLanguageManager\setConfigOverrideLanguage(), Language\sort(), and LanguageInterface\STATE_CONFIGURABLE.

Here is the call graph for this function:

getNegotiatedLanguageMethod (   $type = LanguageInterface::TYPE_INTERFACE)

{Gets the negotiated language method ID.

Parameters
string$type(optional) The language type; e.g., the interface or the content language.
Returns
string The negotiated language method ID.
}

Implements ConfigurableLanguageManagerInterface.

getNegotiator ( )

{Returns the language negotiator.

Returns
The language negotiator.
}

Implements ConfigurableLanguageManagerInterface.

getStandardLanguageListWithoutConfigured ( )

{Returns the standard language list excluding already configured languages.

Returns
array A list of standard language names keyed by langcode.
}

Implements ConfigurableLanguageManagerInterface.

References ConfigurableLanguageManager\getLanguages(), and LanguageManager\getStandardLanguageList().

Here is the call graph for this function:

init ( )

{}

References ConfigurableLanguageManager\getCurrentLanguage(), and ConfigurableLanguageManager\getDefinedLanguageTypes().

Here is the call graph for this function:

isMultilingual ( )

{Returns whether or not the site has more than one language added.

Returns
bool TRUE if more than one language is added, FALSE otherwise.
}

Implements LanguageManagerInterface.

References ConfigurableLanguageManager\getLanguages(), and LanguageInterface\STATE_CONFIGURABLE.

Referenced by ConfigurableLanguageManager\getCurrentLanguage(), and ConfigurableLanguageManager\getFallbackCandidates().

Here is the call graph for this function:

Here is the caller graph for this function:

loadLanguageTypesConfiguration ( )
protected

Retrieves language types from the configuration storage.

Returns
array An array of language type names.

References Drupal\configFactory().

Referenced by ConfigurableLanguageManager\getDefinedLanguageTypes(), and ConfigurableLanguageManager\getLanguageTypes().

Here is the call graph for this function:

Here is the caller graph for this function:

static rebuildServices ( )
static

{Rebuild the container to register services needed on multilingual sites.}

Implements ConfigurableLanguageManagerInterface.

References Drupal\service().

Referenced by ConfigSubscriber\onConfigSave(), and ConfigurableLanguage\postDelete().

Here is the call graph for this function:

Here is the caller graph for this function:

reset (   $type = NULL)

{Resets the given language type or all types if none specified.

Parameters
string | null$type(optional) The language type to reset as a string, e.g., LanguageInterface::TYPE_INTERFACE, or NULL to reset all language types. Defaults to NULL.
Returns
The language manager that has been reset.
}

Implements LanguageManagerInterface.

Referenced by ConfigurableLanguageManager\getCurrentLanguage(), and ConfigurableLanguageManager\updateLockedLanguageWeights().

Here is the caller graph for this function:

saveLanguageTypesConfiguration ( array  $values)

{Stores language types configuration.

Parameters
arrayAn indexed array with the following keys_
  • configurable: an array of configurable language type names.
  • all: an array of all the defined language type names.
}

Implements ConfigurableLanguageManagerInterface.

References Drupal\configFactory().

Here is the call graph for this function:

setConfigOverrideLanguage ( LanguageInterface  $language = NULL)

{Sets the configuration override language.

Parameters
\Drupal\Core\Language\LanguageInterface$languageThe language to override configuration with.
Returns
$this
}

Implements LanguageManagerInterface.

Referenced by ConfigurableLanguageManager\getNativeLanguages().

Here is the caller graph for this function:

setNegotiator ( LanguageNegotiatorInterface  $negotiator)

{Injects the language negotiator.

Parameters
\Drupal\language\LanguageNegotiatorInterface$negotiatorThe language negotiator.
}

Implements ConfigurableLanguageManagerInterface.

updateLockedLanguageWeights ( )

{Updates locked system language weights.}

Implements ConfigurableLanguageManagerInterface.

References ConfigurableLanguageManager\getLanguages(), Entity\load(), ConfigurableLanguageManager\reset(), LanguageInterface\STATE_CONFIGURABLE, and LanguageInterface\STATE_LOCKED.

Here is the call graph for this function:


The documentation for this class was generated from the following file: