You are here

public function DefaultController::page in Shorten URLs 8.2

Same name and namespace in other branches
  1. 8 modules/record_shorten/src/Controller/DefaultController.php \Drupal\record_shorten\Controller\DefaultController::page()

Page build for Record Shorten.

1 string reference to 'DefaultController::page'
record_shorten.routing.yml in modules/record_shorten/record_shorten.routing.yml
modules/record_shorten/record_shorten.routing.yml

File

modules/record_shorten/src/Controller/DefaultController.php, line 55

Class

DefaultController
Default controller for the record_shorten module.

Namespace

Drupal\record_shorten\Controller

Code

public function page() {
  $build = [];
  $total = $this->database
    ->query("SELECT COUNT(sid) FROM {record_shorten}")
    ->fetchField();
  $build['summary']['#markup'] = '<p>' . $this
    ->formatPlural($total, '1 shortened URL has been recorded.', '@count shortened URLs have been recorded.');
  $build['records_table']['#markup'] = record_shorten_records_table();
  $form = $this
    ->formBuilder()
    ->getForm('Drupal\\record_shorten\\Form\\RecordshortenClearAll');
  $build['clear']['#markup'] = $this->renderer
    ->render($form);
  return $build;
}