Including security review as a submodule - with patched for Yaffs.
[yaffs-website] / web / modules / contrib / layout_plugin / src / Layout.php
1 <?php
2
3 namespace Drupal\layout_plugin;
4
5 /**
6  * Class Layout.
7  */
8 class Layout {
9
10   /**
11    * Returns the plugin manager for the Layout plugin type.
12    *
13    * @return \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface
14    *   Layout manager.
15    */
16   public static function layoutPluginManager() {
17     return \Drupal::service('plugin.manager.layout_plugin');
18   }
19
20   /**
21    * Return all available layout as an options array.
22    *
23    * If group_by_category option/parameter passed group the options by
24    * category.
25    *
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
30    *   associative array.
31    *
32    * @return array
33    *   Layout options, as array.
34    *
35    * @deprecated
36    *   Use \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface::getLayoutOptions().
37    */
38   public static function getLayoutOptions(array $params = []) {
39     return static::layoutPluginManager()->getLayoutOptions($params);
40   }
41
42   /**
43    * Return theme implementations for layouts that give only a template.
44    *
45    * @return array
46    *   An associative array of the same format as returned by hook_theme().
47    *
48    * @see hook_theme()
49    *
50    * @deprecated
51    *   Use \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface::getThemeImplementations().
52    */
53   public static function getThemeImplementations() {
54     return static::layoutPluginManager()->getThemeImplementations();
55   }
56
57   /**
58    * Modifies the theme implementations for the layouts that we registered.
59    *
60    * @param array &$theme_registry
61    *   An associative array of the same format as passed to hook_theme_registry_alter().
62    *
63    * @see hook_theme_registry_alter()
64    *
65    * @deprecated
66    *   Use \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface::alterThemeImplementations().
67    */
68   public static function alterThemeImplementations(array &$theme_registry) {
69     static::layoutPluginManager()->alterThemeImplementations($theme_registry);
70   }
71
72   /**
73    * Return library info for layouts that want to automatically register CSS.
74    *
75    * @return array
76    *   An associative array of the same format as returned by
77    *   hook_library_info_build().
78    *
79    * @see hook_library_info_build()
80    *
81    * @deprecated
82    *   Use \Drupal\layout_plugin\Plugin\Layout\LayoutPluginManagerInterface::alterThemeImplementations().
83    */
84   public static function getLibraryInfo() {
85     return static::layoutPluginManager()->getLibraryInfo();
86   }
87
88 }