' . t('About') . ''; $output .= '

' . t('Single Directory Components is a module that aims to simplify the front-end development workflow, and improve maintainability of core and contrib themes. For more information, see the online documentation for the Single Directory Components module.', [ ':docs' => 'https://www.drupal.org/docs/develop/theming-drupal/using-single-directory-components', ]) . '

'; $output .= '
'; $output .= '
' . t('General') . '
'; $output .= '
' . t('Single Directory Components introduces the concept of UI components to Drupal core. A component is a combination of a Twig template, stylesheets, scripts, assets, and metadata, that live in the same directory. Components represent an encapsulated and re-usable UI element.') . '
'; $output .= '
' . t('Single Directory Components reduce the number of framework implementation details required to put templated HTML, CSS, and JS in a Drupal page. They also define explicit component APIs, and provide a methodology to replace a component provided upstream (in a parent theme or module).', [ ':sdc-docs' => 'https://www.drupal.org/docs/develop/theming-drupal/using-single-directory-components', ]) . '
'; $output .= '
'; return $output; } return NULL; } /** * Implements hook_library_info_build(). */ function sdc_library_info_build() { // Iterate over all the components to get the CSS and JS files. $plugin_manager = \Drupal::service('plugin.manager.sdc'); assert($plugin_manager instanceof ComponentPluginManager); $components = $plugin_manager->getAllComponents(); $libraries = array_reduce( $components, static function (array $libraries, Component $component) { $library = $component->library; if (empty($library)) { return $libraries; } $library_name = $component->getLibraryName(); [, $library_id] = explode('/', $library_name); return array_merge($libraries, [$library_id => $library]); }, [] ); $libraries['all'] = [ 'dependencies' => array_map( static fn(Component $component) => $component->getLibraryName(), $components ), ]; return $libraries; }