Skip to content

Commit

Permalink
125: Cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Jan 7, 2025
1 parent 568c884 commit 31d72d9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
1 change: 1 addition & 0 deletions config/sync/taxonomy.vocabulary.department.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ name: Afdeling
vid: department
description: 'Afdeling (Magistrat) for brugere og indhold'
weight: 0
new_revision: false
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,6 @@ public function load() {
$paragraph->save();
$this->addReference('paragraph:content_list:all_public_meetings', $paragraph);

$paragraph = Paragraph::create([
'type' => 'content_list',
'field_content_list' => [
'target_id' => 'all_hearings',
'display_id' => 'default',
],
'field_list_title' => 'Alle høringer',
]);
$paragraph->save();
$this->addReference('paragraph:content_list:all_hearings', $paragraph);

$paragraph = Paragraph::create([
'type' => 'info_box',
'field_content_block_text' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ private function getDepartments(ContentEntityBase $entity): array {
* @param \Drupal\Core\Session\AccountInterface $account
* The account.
*/
private function getUserDepartments(AccountInterface $account = NULL): array {
private function getUserDepartments(?AccountInterface $account = NULL): array {
$account ??= $this->currentUser;
if (empty($this->userDepartments[$account->id()])) {
$user = $this->userStorage->load($account->id());
Expand All @@ -276,7 +276,7 @@ private function getUserDepartments(AccountInterface $account = NULL): array {
/**
* Get list of node IDs an account has edit access to.
*/
private function getUserDepartmentNodeIds(AccountInterface $account = NULL): array {
private function getUserDepartmentNodeIds(?AccountInterface $account = NULL): array {
$account ??= $this->currentUser;
$departments = $this->getUserDepartments($account);
$query = $this->nodeStorage->getQuery();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function getTicketDepartments(array $query = [], $noFilter = FALSE) {

if (!$noFilter) {
// Filter out unavailable departments.
$availableIds = $this->config->getAvailableDepartments();
$availableIds = $this->config->getAvailableDepartments() ?? [];
$data = array_filter($data,
function (array $department) use ($availableIds) {
return in_array($department['id'], $availableIds);
Expand Down

0 comments on commit 31d72d9

Please sign in to comment.