3 namespace Drupal\layout_plugin;
11 * Returns the plugin manager for the Layout plugin type.
13 * @return \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface
16 public static function layoutPluginManager() {
17 return \Drupal::service('plugin.manager.layout_plugin');
21 * Return all available layout as an options array.
23 * If group_by_category option/parameter passed group the options by
26 * @param array $params
27 * (optional) An associative array with the following keys:
28 * - group_by_category: (bool) If set to TRUE, return an array of arrays
29 * grouped by the category name; otherwise, return a single-level
33 * Layout options, as array.
36 * Use \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface::getLayoutOptions().
38 public static function getLayoutOptions(array $params = []) {
39 return static::layoutPluginManager()->getLayoutOptions($params);
43 * Return theme implementations for layouts that give only a template.
46 * An associative array of the same format as returned by hook_theme().
51 * Use \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface::getThemeImplementations().
53 public static function getThemeImplementations() {
54 return static::layoutPluginManager()->getThemeImplementations();
58 * Modifies the theme implementations for the layouts that we registered.
60 * @param array &$theme_registry
61 * An associative array of the same format as passed to hook_theme_registry_alter().
63 * @see hook_theme_registry_alter()
66 * Use \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface::alterThemeImplementations().
68 public static function alterThemeImplementations(array &$theme_registry) {
69 static::layoutPluginManager()->alterThemeImplementations($theme_registry);
73 * Return library info for layouts that want to automatically register CSS.
76 * An associative array of the same format as returned by
77 * hook_library_info_build().
79 * @see hook_library_info_build()
82 * Use \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface::alterThemeImplementations().
84 public static function getLibraryInfo() {
85 return static::layoutPluginManager()->getLibraryInfo();