Conditions | 5 |
Paths | 4 |
Total Lines | 23 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
13 | public function frontpage() { |
||
14 | $build = []; |
||
15 | if ($this->currentUser()->isAnonymous()) { |
||
16 | $build['form'] = $this->formBuilder()->getForm(UserLoginForm::class); |
||
17 | } |
||
18 | else { |
||
19 | if (\Drupal::moduleHandler()->moduleExists('moderation_dashboard') |
||
20 | && $this->currentUser()->hasPermission('use moderation dashboard')) { |
||
21 | // Permitted users are directed to their moderation dashboard. |
||
22 | return $this->redirect('view.moderation_dashboard.page_1', ['user' => $this->currentUser()->id()]); |
||
23 | } |
||
24 | elseif ($this->currentUser()->hasPermission('access content overview')) { |
||
25 | // Permitted users are directed to the admin content page. |
||
26 | return $this->redirect('view.content.page_1'); |
||
27 | } |
||
28 | else { |
||
29 | $build['heading'] = [ |
||
30 | '#type' => 'markup', |
||
31 | '#markup' => $this->t('This site has no homepage content.'), |
||
32 | ]; |
||
33 | } |
||
34 | } |
||
35 | return $build; |
||
36 | } |
||
38 |