You are here

public function SiteVerifyController::verificationsFileContent in Site verification 8

Controller content callback: Verifications File content.

Return value

\Symfony\Component\HttpFoundation\Response The response containing the Verification File content.

File

src/Controller/SiteVerifyController.php, line 88

Class

SiteVerifyController
Returns responses for Site Verify module routes.

Namespace

Drupal\site_verify\Controller

Code

public function verificationsFileContent($svid) {
  $verification = \Drupal::service('site_verify_service')
    ->siteVerifyLoad($svid);
  if ($verification['file_contents'] && $verification['engine']['file_contents']) {
    $response = new Response();
    $response
      ->setContent($verification['file_contents']);
    return $response;
  }
  else {
    $build = [];
    $build['#title'] = $this
      ->t('Verification page');
    $build['#markup'] = $this
      ->t('This is a verification page for the !title search engine.', [
      '!title' => $verification['engine']['name'],
    ]);
    return $build;
  }
}