function vapn_node_form_submit in View access per node 8
1 string reference to 'vapn_node_form_submit'
- vapn_form_node_form_alter in ./
vapn.module - Implements hook_form_FORM_ID_alter().
File
- ./
vapn.module, line 75 - Contains vapn.module.
Code
function vapn_node_form_submit($form, \Drupal\Core\Form\FormStateInterface $form_state) {
$vals = $form_state
->getValues();
if (isset($vals['vapn_roles'])) {
$roles = $vals['vapn_roles'];
if ($roles) {
$nid = $form_state
->getFormObject()
->getEntity()
->id();
\Drupal::service('vapn.handler')
->cleanEntriesByEntityId($nid);
foreach ($roles as $rid => $rid_selected) {
if ($rid === $rid_selected) {
\Drupal::service('vapn.handler')
->insertRoleEntry($nid, $rid);
}
}
}
}
}