function UpdateScriptTestController::databaseUpdatesMenuItem

Same name in other branches
  1. 9 core/modules/system/tests/modules/update_script_test/src/Controller/UpdateScriptTestController.php \Drupal\update_script_test\Controller\UpdateScriptTestController::databaseUpdatesMenuItem()
  2. 8.9.x core/modules/system/tests/modules/update_script_test/src/Controller/UpdateScriptTestController.php \Drupal\update_script_test\Controller\UpdateScriptTestController::databaseUpdatesMenuItem()
  3. 10 core/modules/system/tests/modules/update_script_test/src/Controller/UpdateScriptTestController.php \Drupal\update_script_test\Controller\UpdateScriptTestController::databaseUpdatesMenuItem()

Outputs a link to the database updates URL.

1 string reference to 'UpdateScriptTestController::databaseUpdatesMenuItem'
update_script_test.routing.yml in core/modules/system/tests/modules/update_script_test/update_script_test.routing.yml
core/modules/system/tests/modules/update_script_test/update_script_test.routing.yml

File

core/modules/system/tests/modules/update_script_test/src/Controller/UpdateScriptTestController.php, line 19

Class

UpdateScriptTestController
Controller routines for update_script_test routes.

Namespace

Drupal\update_script_test\Controller

Code

public function databaseUpdatesMenuItem(Request $request) {
    // @todo Simplify with https://www.drupal.org/node/2548095
    $base_url = str_replace('/update.php', '', $request->getBaseUrl());
    $url = (new Url('system.db_update'))->setOption('base_url', $base_url);
    $build['main'] = [
        '#type' => 'link',
        '#title' => $this->t('Run database updates'),
        '#url' => $url,
        '#access' => $url->access($this->currentUser()),
    ];
    return $build;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.