class Config in Bamboo Twig 8.3
Same name and namespace in other branches
- 8.5 bamboo_twig_config/src/TwigExtension/Config.php \Drupal\bamboo_twig_config\TwigExtension\Config
- 8.2 bamboo_twig_config/src/TwigExtension/Config.php \Drupal\bamboo_twig_config\TwigExtension\Config
- 8.4 bamboo_twig_config/src/TwigExtension/Config.php \Drupal\bamboo_twig_config\TwigExtension\Config
Provides getter for configs drupal storage as Twig Extensions.
Hierarchy
- class \Drupal\bamboo_twig\TwigExtension\TwigExtensionBase extends \Drupal\bamboo_twig\TwigExtension\Twig_Extension uses \Symfony\Component\DependencyInjection\ContainerAwareTrait
- class \Drupal\bamboo_twig_config\TwigExtension\Config
Expanded class hierarchy of Config
1 string reference to 'Config'
- bamboo_twig_config.services.yml in bamboo_twig_config/
bamboo_twig_config.services.yml - bamboo_twig_config/bamboo_twig_config.services.yml
1 service uses Config
File
- bamboo_twig_config/
src/ TwigExtension/ Config.php, line 10
Namespace
Drupal\bamboo_twig_config\TwigExtensionView source
class Config extends TwigExtensionBase {
/**
* List of all Twig functions.
*/
public function getFunctions() {
return [
new \Twig_SimpleFunction('bamboo_settings_get', [
$this,
'getSettings',
]),
new \Twig_SimpleFunction('bamboo_config_get', [
$this,
'getConfig',
]),
new \Twig_SimpleFunction('bamboo_state_get', [
$this,
'getState',
]),
];
}
/**
* Unique identifier for this Twig extension.
*/
public function getName() {
return 'bamboo_twig_config.twig.config';
}
/**
* Load given Config Settings from the settings.php file.
*
* @param string $key
* The key of the data to retrieve.
*
* @return mixed|null
* Returns the stored value for a given key, or NULL if no value exists.
*/
public function getSettings($key) {
return $this
->getSettingsSingleton()
->get($key);
}
/**
* Load given Config API configuration.
*
* @param string $key
* The key of the data to retrieve.
* @param string $name
* The name of config to retrieve.
*
* @return mixed|null
* Returns the stored value for a given key, or NULL if no value exists.
*/
public function getConfig($key, $name) {
return $this
->getConfigFactory()
->get($key)
->get($name);
}
/**
* Load given State API configuration.
*
* @param string $key
* The key of the data to retrieve.
*
* @return mixed|null
* Returns the stored value for a given key, or NULL if no value exists.
*/
public function getState($key) {
return $this
->getStateFactory()
->get($key);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Config:: |
public | function | Load given Config API configuration. | |
Config:: |
public | function | List of all Twig functions. | |
Config:: |
public | function |
Unique identifier for this Twig extension. Overrides TwigExtensionBase:: |
|
Config:: |
public | function | Load given Config Settings from the settings.php file. | |
Config:: |
public | function | Load given State API configuration. | |
TwigExtensionBase:: |
protected | function | Return the block storage. | |
TwigExtensionBase:: |
protected | function | Provides an interface for a configuration object factory. | |
TwigExtensionBase:: |
protected | function | Return the current route match. | |
TwigExtensionBase:: |
protected | function | Lazy loading for the Drupal current user account proxy. | |
TwigExtensionBase:: |
protected | function | Provides a service to handle various date related functionality. | |
TwigExtensionBase:: |
protected | function | Lazy loading for the Drupal entity type manager. | |
TwigExtensionBase:: |
protected | function | Return a singleton mime type to file extension guesser. | |
TwigExtensionBase:: |
protected | function | Return the factory for image objects. | |
TwigExtensionBase:: |
protected | function | Return the file storage. | |
TwigExtensionBase:: |
protected | function | Provides helpers to operate on files and stream wrappers. | |
TwigExtensionBase:: |
protected | function | Provides an interface for form building and processing. | |
TwigExtensionBase:: |
protected | function | Return the factory for image objects. | |
TwigExtensionBase:: |
protected | function | Provides an interface defining an image style. | |
TwigExtensionBase:: |
protected | function | Returns the language manager service. | |
TwigExtensionBase:: |
protected | function | Interface for loading, transforming and rendering menu link trees. | |
TwigExtensionBase:: |
protected | function | Manages discovery and instantiation of block plugins. | |
TwigExtensionBase:: |
protected | function | Read only settings singleton. | |
TwigExtensionBase:: |
protected | function | The state storage service. | |
TwigExtensionBase:: |
protected | function | Return the token service. | |
TwigExtensionBase:: |
protected | function | Return the user storage. |