Commit 761a5a84 authored by Qiangjun Ran's avatar Qiangjun Ran
Browse files

Issue #3320608: Adjust weights of form elements on the nodeaccess settings page

parent d3724546
Loading
Loading
Loading
Loading
+28 −29
Original line number Diff line number Diff line
@@ -64,35 +64,7 @@ final class SettingsForm extends ConfigFormBase {
  public function buildForm(array $form, FormStateInterface $form_state) {
    $settings = $this->config('nodeaccess.settings');

    // Set allowed_grant_operations.
    // Select permissions/grant operations you want to allow users to view and
    // edit.
    $allowed_grant_operations = $settings->get('allowed_grant_operations');
    $form['allowed_grant_operations'] = [
      '#type' => 'details',
      '#open' => TRUE,
      '#title' => $this->t('Allowed grants operations'),
      '#tree' => TRUE,
      '#description' => '<small>' . $this->t('The selected grant operations will be listed on individual node grants. If you wish for certain grants to be hidden from users on the node grants tab, make sure they are not selected here.') . '</small>',
    ];
    $form['allowed_grant_operations']['grant_view'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('View'),
      '#default_value' => $allowed_grant_operations['grant_view'],
    ];
    $form['allowed_grant_operations']['grant_update'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Edit'),
      '#default_value' => $allowed_grant_operations['grant_update'],
    ];
    $form['allowed_grant_operations']['grant_delete'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Delete'),
      '#default_value' => $allowed_grant_operations['grant_delete'],
    ];

    $roles = $this->entityTypeManager->getStorage('user_role')->loadMultiple();
    ;

    // Set roles_settings.
    // Select roles the permissions of which you want to allow users to
@@ -166,7 +138,7 @@ final class SettingsForm extends ConfigFormBase {
      $bundle_roles_grants = $bundles_roles_grants[$bundle];
      $form['bundles_roles_grants'][$bundle] = [
        '#type' => 'details',
        '#open' => TRUE,
        '#open' => FALSE,
        '#title' => $node_type->label(),
        '#tree' => TRUE,
        '#description' => $this->t('Note: the settings selected for the node author will define what permissions the node author has. This cannot be changed on individual node grants.'),
@@ -226,6 +198,33 @@ final class SettingsForm extends ConfigFormBase {
        ],
      ];
    }

    // Set allowed_grant_operations.
    // Select permissions/grant operations you want to allow users to view and
    // edit.
    $allowed_grant_operations = $settings->get('allowed_grant_operations');
    $form['allowed_grant_operations'] = [
      '#type' => 'details',
      '#open' => TRUE,
      '#title' => $this->t('Allowed grants operations'),
      '#tree' => TRUE,
      '#description' => '<small>' . $this->t('The selected grant operations will be listed on individual node grants. If you wish for certain grants to be hidden from users on the node grants tab, make sure they are not selected here.') . '</small>',
    ];
    $form['allowed_grant_operations']['grant_view'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('View'),
      '#default_value' => $allowed_grant_operations['grant_view'],
    ];
    $form['allowed_grant_operations']['grant_update'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Edit'),
      '#default_value' => $allowed_grant_operations['grant_update'],
    ];
    $form['allowed_grant_operations']['grant_delete'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Delete'),
      '#default_value' => $allowed_grant_operations['grant_delete'],
    ];
    return parent::buildForm($form, $form_state);
  }