protected ElementInfoManager::buildInfo($theme_name)
Builds up all element information.
Parameters
string $theme_name: The theme name.
Return value
array
File
- core/lib/Drupal/Core/Render/ElementInfoManager.php, line 100
Class
- ElementInfoManager
- Provides a plugin manager for element plugins.
Namespace
Drupal\Core\Render
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 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 ; } |
Please login to continue.