Completed
Push — 8.x-1.x ( 48b271...fbaab6 )
by Janez
02:46
created

CtoolsFallback   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A displayMessage() 0 8 1
1
<?php
2
3
namespace Drupal\entity_browser\Controllers;
4
5
use Drupal\Core\Controller\ControllerBase;
6
use Drupal\Core\Url;
7
8
/**
9
 * Returns markup for entity browser entity add/edit page if ctools is missing.
10
 */
11
class CtoolsFallback extends ControllerBase {
12
13
  /**
14
   * Displays message about missing dependency on edit/add page.
15
   *
16
   * @return \Drupal\Core\Ajax\AjaxResponse
17
   *   An Ajax response with a command for opening or closing the dialog
18
   *   containing the edit form.
19
   */
20
  public function displayMessage() {
21
    return [
22
      '#markup' => $this->t(
23
        'This form depends on <a href=":url">Chaos tool suite module</a>. Enable it and reload this page.',
24
        [':url' => Url::fromUri('https://drupal.org/project/ctools')->toString()]
25
      ),
26
    ];
27
  }
28
29
}
30