function skinr_get_group_info in Skinr 8.2
Same name and namespace in other branches
- 7.2 skinr.module \skinr_get_group_info()
Retrieves all skin groups registered by modules and themes.
Return value
An array of groups.
5 calls to skinr_get_group_info()
- LibraryListForm::buildForm in skinr_ui/
src/ Form/ LibraryListForm.php - Form constructor.
- SkinrApiTest::testSkinrGroupInfo in src/
Tests/ SkinrApiTest.php - Tests hook_skinr_group_info().
- SkinrApiTestCase::testSkinrGroupInfo in src/
Tests/ skinr.test - Tests hook_skinr_group_info().
- SkinsEditForm::buildForm in skinr_ui/
src/ Form/ SkinsEditForm.php - Form constructor.
- SkinsEditForm::validateForm in skinr_ui/
src/ Form/ SkinsEditForm.php - Form validation handler.
File
- ./
skinr.module, line 1195 - Handles core Skinr functionality.
Code
function skinr_get_group_info() {
$group_info =& drupal_static(__FUNCTION__);
if ($group_info === NULL) {
if ($cached = \Drupal::cache()
->get('skinr_group_info')) {
$group_info = $cached->data;
return $group_info;
}
$group_info = [];
$plugins = \Drupal::service('plugin.manager.skin')
->getDefinitions();
foreach ($plugins as $plugin) {
if (empty($plugin['groups'])) {
continue;
}
foreach ($plugin['groups'] as $group_name => $group_data) {
$group_info[$group_name] = $group_data + [
'title' => '',
'description' => '',
'weight' => 0,
];
}
}
// Allow modules to alter groups through hook_skinr_group_info_alter().
\Drupal::moduleHandler()
->alter('skinr_group_info', $group_info);
\Drupal::cache()
->set('skinr_group_info', $group_info);
}
return $group_info;
}