function _rac_form_user_role_form_submit in Role Access Control 8.2
Same name and namespace in other branches
- 8 rac.module \_rac_form_user_role_form_submit()
Implements hook_submit().
Handle submission of role form to grant access permission for own content.
1 string reference to '_rac_form_user_role_form_submit'
- rac_form_user_role_form_alter in ./rac.module 
- Implements hook_form_FORM_ID_alter().
File
- ./rac.module, line 151 
- Module providing role access relations.
Code
function _rac_form_user_role_form_submit(&$form, FormStateInterface $form_state) {
  $role = $form_state
    ->getFormObject()
    ->getEntity();
  $permission = "RAC_view_" . $role
    ->id();
  if (!$role
    ->hasPermission($permission)) {
    $role
      ->grantPermission($permission);
    $role
      ->save();
  }
}