Skip to content

Commit

Permalink
DGIR-148 : Hide file list when no node selected
Browse files Browse the repository at this point in the history
  • Loading branch information
Prashant-bd committed Jan 17, 2024
1 parent 5a81c4f commit bde9406
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions embargo.module
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ function embargo_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$options = embargo_get_filtered_file_options($node_id);
$form['embargoed_file']['widget']['#options'] = $options;
}
else {
// todo : we need to update file list when user add node in Embargoed Node
// field.
unset($form['embargoed_file']);
}

// JS to add Select/Unselect All link and functionality.
$form['#attached']['library'][] = 'embargo/custom_select_all_library';
Expand Down
4 changes: 3 additions & 1 deletion src/Entity/Embargo.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,9 @@ public function isUserExempt(AccountInterface $user): bool {
$exempt_users = $this->getExemptUsers();
$has_permission = $user->hasPermission('bypass embargo access');
return $has_permission || in_array($user->id(), array_map(function (UserInterface $user) {
return $user->id();}, $exempt_users));
return $user->id();
}, $exempt_users));

}

/**
Expand Down

0 comments on commit bde9406

Please sign in to comment.