1 | <?php |
||
16 | abstract class ControllerBase extends CoreControllerBase { |
||
17 | |||
18 | use LoggerAwareTrait; |
||
19 | |||
20 | /** |
||
21 | * The items_per_page configuration value. |
||
22 | * |
||
23 | * @var int |
||
24 | */ |
||
25 | protected $itemsPerPage; |
||
26 | |||
27 | /** |
||
28 | * The MongoDB logger, to load events. |
||
29 | * |
||
30 | * @var \Drupal\mongodb_watchdog\Logger |
||
31 | */ |
||
32 | protected $watchdog; |
||
33 | |||
34 | /** |
||
35 | * ControllerBase constructor. |
||
36 | * |
||
37 | * @param \Drupal\Core\Config\ImmutableConfig $config |
||
38 | * The module configuration. |
||
39 | */ |
||
40 | public function __construct(LoggerInterface $logger, Logger $watchdog, ImmutableConfig $config) { |
||
46 | |||
47 | /** |
||
48 | * The default build() implementation. |
||
49 | * |
||
50 | * Cannot be a build() method because each controller build() has a |
||
51 | * different signature. |
||
52 | * |
||
53 | * @param array $main |
||
54 | * A render array for the main table. |
||
55 | * @param array|null $top |
||
56 | * A render array for the top element present on some controllers results. |
||
57 | * |
||
58 | * @return string[string|array] |
||
|
|||
59 | * A render array for the whole controller. |
||
60 | */ |
||
61 | protected function buildDefaults(array $main, array $top = NULL) { |
||
74 | |||
75 | /** |
||
76 | * Build markup for a message about the lack of results. |
||
77 | * |
||
78 | * @param \Drupal\Core\StringTranslation\TranslatableMarkup $markup |
||
79 | * The message proper. |
||
80 | * |
||
81 | * @return string[string|\Drupal\Core\StringTranslation\TranslatableMarkup] |
||
82 | * A render array for a message. |
||
83 | */ |
||
84 | protected function buildEmpty(TranslatableMarkup $markup) { |
||
93 | |||
94 | /** |
||
95 | * Return the top element: empty by default. |
||
96 | * |
||
97 | * @return array |
||
98 | * A render array for the top filter form. |
||
99 | */ |
||
100 | protected function getTop() { |
||
104 | |||
105 | /** |
||
106 | * Set up the pager. |
||
107 | * |
||
108 | * @param \Symfony\Component\HttpFoundation\Request $request |
||
109 | * The current request. |
||
110 | * @param int $count |
||
111 | * The total number of possible rows. |
||
112 | * |
||
113 | * @return int |
||
114 | * The number of the page to display, starting at 0. |
||
115 | */ |
||
116 | public function setupPager(Request $request, $count) { |
||
125 | |||
126 | /** |
||
127 | * Return a reliable page number based on available data. |
||
128 | * |
||
129 | * @param int $count |
||
130 | * The number of events templates in the collection. |
||
131 | * @param int $requestedPage |
||
132 | * The page number requested by the user, starting at 0. |
||
133 | * @param int $height |
||
134 | * The pager height. |
||
135 | * |
||
136 | * @return int |
||
137 | * The actual index of the page to display. |
||
138 | */ |
||
139 | public static function getPage(int $count, int $requestedPage, int $height): int { |
||
153 | |||
154 | } |
||
155 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.