@@ 15-50 (lines=36) @@ | ||
12 | * @author PyroCMS, Inc. <[email protected]> |
|
13 | * @author Ryan Thompson <[email protected]> |
|
14 | */ |
|
15 | class PermissionFormSections |
|
16 | { |
|
17 | ||
18 | /** |
|
19 | * Handle the fields. |
|
20 | * |
|
21 | * @param PermissionFormBuilder $builder |
|
22 | * @param AddonCollection $addons |
|
23 | * @param Translator $translator |
|
24 | * @param Repository $config |
|
25 | */ |
|
26 | public function handle(PermissionFormBuilder $builder, AddonCollection $addons, Repository $config) |
|
27 | { |
|
28 | $sections = []; |
|
29 | ||
30 | $sections['streams']['title'] = 'streams::message.system'; |
|
31 | ||
32 | foreach ($config->get('streams::permissions', []) as $group => $permissions) { |
|
33 | $sections['streams']['fields'][] = 'streams::' . $group; |
|
34 | } |
|
35 | ||
36 | /* @var Addon $addon */ |
|
37 | foreach ($addons->withConfig('permissions') as $addon) { |
|
38 | ||
39 | $sections[$addon->getNamespace()]['title'] = $addon->getName(); |
|
40 | $sections[$addon->getNamespace()]['description'] = $addon->getDescription(); |
|
41 | ||
42 | foreach ($config->get($addon->getNamespace('permissions'), []) as $group => $permissions) { |
|
43 | ||
44 | $sections[$addon->getNamespace()]['fields'][] = str_replace('.', '_', $addon->getNamespace($group)); |
|
45 | } |
|
46 | } |
|
47 | ||
48 | $builder->setSections($sections); |
|
49 | } |
|
50 | } |
|
51 |
@@ 15-50 (lines=36) @@ | ||
12 | * @author PyroCMS, Inc. <[email protected]> |
|
13 | * @author Ryan Thompson <[email protected]> |
|
14 | */ |
|
15 | class PermissionFormSections |
|
16 | { |
|
17 | ||
18 | /** |
|
19 | * Handle the fields. |
|
20 | * |
|
21 | * @param PermissionFormBuilder $builder |
|
22 | * @param AddonCollection $addons |
|
23 | * @param Translator $translator |
|
24 | * @param Repository $config |
|
25 | */ |
|
26 | public function handle(PermissionFormBuilder $builder, AddonCollection $addons, Repository $config) |
|
27 | { |
|
28 | $sections = []; |
|
29 | ||
30 | $sections['streams']['title'] = 'streams::message.system'; |
|
31 | ||
32 | foreach ($config->get('streams::permissions', []) as $group => $permissions) { |
|
33 | $sections['streams']['fields'][] = 'streams::' . $group; |
|
34 | } |
|
35 | ||
36 | /* @var Addon $addon */ |
|
37 | foreach ($addons->withConfig('permissions') as $addon) { |
|
38 | ||
39 | $sections[$addon->getNamespace()]['title'] = $addon->getName(); |
|
40 | $sections[$addon->getNamespace()]['description'] = $addon->getDescription(); |
|
41 | ||
42 | foreach ($config->get($addon->getNamespace('permissions'), []) as $group => $permissions) { |
|
43 | ||
44 | $sections[$addon->getNamespace()]['fields'][] = str_replace('.', '_', $addon->getNamespace($group)); |
|
45 | } |
|
46 | } |
|
47 | ||
48 | $builder->setSections($sections); |
|
49 | } |
|
50 | } |
|
51 |