protected function ElementInfoManager::buildInfo in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Render/ElementInfoManager.php \Drupal\Core\Render\ElementInfoManager::buildInfo()
Builds up all element information.
Parameters
string $theme_name: The theme name.
Return value
array
1 call to ElementInfoManager::buildInfo()
- ElementInfoManager::getInfo in core/
lib/ Drupal/ Core/ Render/ ElementInfoManager.php - Retrieves the default properties for the defined element type.
File
- core/
lib/ Drupal/ Core/ Render/ ElementInfoManager.php, line 105 - Contains \Drupal\Core\Render\ElementInfoManager.
Class
- ElementInfoManager
- Provides a plugin manager for element plugins.
Namespace
Drupal\Core\RenderCode
protected function buildInfo($theme_name) {
// Get cached definitions.
$cid = $this
->getCid($theme_name);
if ($cache = $this->cacheBackend
->get($cid)) {
return $cache->data;
}
// Otherwise, rebuild and cache.
$info = [];
foreach ($this
->getDefinitions() as $element_type => $definition) {
$element = $this
->createInstance($element_type);
$element_info = $element
->getInfo();
// If this is element is to be used exclusively in a form, denote that it
// will receive input, and assign the value callback.
if ($element instanceof FormElementInterface) {
$element_info['#input'] = TRUE;
$element_info['#value_callback'] = array(
$definition['class'],
'valueCallback',
);
}
$info[$element_type] = $element_info;
}
foreach ($info as $element_type => $element) {
$info[$element_type]['#type'] = $element_type;
}
// Allow modules to alter the element type defaults.
$this->moduleHandler
->alter('element_info', $info);
$this->themeManager
->alter('element_info', $info);
$this->cacheBackend
->set($cid, $info, Cache::PERMANENT, [
'element_info_build',
]);
return $info;
}