public function TeamPermissionsForm::submitForm in Apigee Edge 8
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- modules/
apigee_edge_teams/ src/ Form/ TeamPermissionsForm.php, line 205
Class
- TeamPermissionsForm
- Provides a form for configuring team-level permissions for all teams.
Namespace
Drupal\apigee_edge_teams\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$this
->configFactory()
->getEditable('apigee_edge_teams.team_settings')
->set('non_member_team_apps_visible_api_products', array_keys(array_filter($form_state
->getValue('non_member_team_apps_visible_api_products', []))))
->save();
/** @var \Drupal\apigee_edge_teams\Entity\Storage\TeamRoleStorageInterface $storage */
$storage = $this->entityTypeManager
->getStorage('team_role');
foreach ($form_state
->getValue('role_names') as $role_name => $name) {
$storage
->changePermissions($role_name, (array) $form_state
->getValue($role_name));
}
$this
->messenger()
->addStatus($this
->t('The changes have been saved.'));
}