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