You are here

public function LayoutPluginManager::getLibraryInfo in Layout Plugin (obsolete, use core's Layout Discovery) 8

Get library info for layouts that want to automatically register CSS.

Return value

array An associative array of the same format as returned by hook_library_info_build().

Overrides LayoutPluginManagerInterface::getLibraryInfo

Deprecated

when moving layout plugin to core

See also

hook_library_info_build()

File

src/Plugin/Layout/LayoutPluginManager.php, line 231

Class

LayoutPluginManager
Plugin type manager for all layouts.

Namespace

Drupal\layout_plugin\Plugin\Layout

Code

public function getLibraryInfo() {
  $plugins = $this
    ->getDefinitions();
  $library_info = [];
  foreach ($plugins as $id => $definition) {
    if (!empty($definition['css']) && !empty($definition['library'])) {
      list($library_module, $library_name) = explode('/', $definition['library']);

      // Make sure the library is from layout_plugin.
      if ($library_module != 'layout_plugin') {
        continue;
      }
      $library_info[$library_name] = [
        'version' => $this
          ->getProviderVersion($definition['provider_type'], $definition['provider']),
        'css' => [
          'theme' => [
            '/' . $definition['css'] => [],
          ],
        ],
      ];
    }
  }
  return $library_info;
}