Provides language switcher block plugin definitions for all languages.
Expanded class hierarchy of LanguageBlock
class LanguageBlock implements DerivativeInterface {
/**
* List of derivative definitions.
*
* @var array
*/
protected $derivatives = array();
/**
* Implements \Drupal\Component\Plugin\Derivative\DerivativeInterface::getDerivativeDefinition().
*/
public function getDerivativeDefinition($derivative_id, array $base_plugin_definition) {
if (!empty($this->derivatives) && !empty($this->derivatives[$derivative_id])) {
return $this->derivatives[$derivative_id];
}
$this
->getDerivativeDefinitions($base_plugin_definition);
return $this->derivatives[$derivative_id];
}
/**
* Implements \Drupal\Component\Plugin\Derivative\DerivativeInterface::getDerivativeDefinitions().
*/
public function getDerivativeDefinitions(array $base_plugin_definition) {
include_once DRUPAL_ROOT . '/core/includes/language.inc';
$info = language_types_info();
foreach (language_types_get_configurable(FALSE) as $type) {
$this->derivatives[$type] = $base_plugin_definition;
$this->derivatives[$type]['admin_label'] = t('Language switcher (!type)', array(
'!type' => $info[$type]['name'],
));
$this->derivatives[$type]['cache'] = DRUPAL_NO_CACHE;
}
return $this->derivatives;
}
}
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LanguageBlock:: |
protected | property | List of derivative definitions. | |
LanguageBlock:: |
public | function |
Implements \Drupal\Component\Plugin\Derivative\DerivativeInterface::getDerivativeDefinition(). Overrides DerivativeInterface:: |
|
LanguageBlock:: |
public | function |
Implements \Drupal\Component\Plugin\Derivative\DerivativeInterface::getDerivativeDefinitions(). Overrides DerivativeInterface:: |