You are here

private function EntityConfigSettingsForm::buildUserRoleForm in Acquia Content Hub 8

Build user role form.

Return value

array User role form.

1 call to EntityConfigSettingsForm::buildUserRoleForm()
EntityConfigSettingsForm::buildForm in src/Form/EntityConfigSettingsForm.php
Form constructor.

File

src/Form/EntityConfigSettingsForm.php, line 277

Class

EntityConfigSettingsForm
Defines the form to configure the entity types and bundles to be exported.

Namespace

Drupal\acquia_contenthub\Form

Code

private function buildUserRoleForm() {
  $user_role = $this
    ->config('acquia_contenthub.entity_config')
    ->get('user_role');
  $user_role_names = user_role_names();
  $form = [
    '#type' => 'select',
    '#title' => $this
      ->t('User Role'),
    '#description' => $this
      ->t('Your item will be rendered as seen by a user with the selected role. We recommend to just use "@anonymous" here to prevent data leaking out to unauthorized roles.', [
      '@anonymous' => $user_role_names[AccountInterface::ANONYMOUS_ROLE],
    ]),
    '#options' => $user_role_names,
    '#multiple' => FALSE,
    '#default_value' => $user_role ?: AccountInterface::ANONYMOUS_ROLE,
    '#required' => TRUE,
  ];
  return $form;
}