public function WebformGroupManager::getAccessRules in Webform 6.x
Same name and namespace in other branches
- 8.5 modules/webform_group/src/WebformGroupManager.php \Drupal\webform_group\WebformGroupManager::getAccessRules()
Get a webform's access rules with group roles.
Parameters
\Drupal\webform\WebformInterface $webform: A webform.
Return value
array An associative array containiong a webform's access rules with group roles.
Overrides WebformGroupManagerInterface::getAccessRules
File
- modules/
webform_group/ src/ WebformGroupManager.php, line 231
Class
- WebformGroupManager
- Webform group manager manager.
Namespace
Drupal\webform_groupCode
public function getAccessRules(WebformInterface $webform) {
$webform_id = $webform
->id();
if (isset($this->accessRules[$webform_id])) {
return $this->accessRules[$webform_id];
}
$access_rules = $webform
->getAccessRules() + $this->accessRulesManager
->getDefaultAccessRules();
// Remove configuration access rules which is never applicate the webform
// group integration.
unset($access_rules['configuration']);
// Set default group roles for each permission.
foreach ($access_rules as &$access_rule) {
$access_rule += [
'group_roles' => [],
];
}
$this->accessRules[$webform_id] = $access_rules;
return $access_rules;
}