You are here

class SiteVerifyRoutes in Site verification 8

Defines dynamic routes.

Hierarchy

Expanded class hierarchy of SiteVerifyRoutes

File

src/Routing/SiteVerifyRoutes.php, line 11

Namespace

Drupal\site_verify\Routing
View source
class SiteVerifyRoutes {

  /**
   * {@inheritdoc}
   */
  public function routes() {
    $verifications = \Drupal::database()
      ->select('site_verify', 'site_verify')
      ->fields('site_verify', [
      'svid',
      'file',
    ])
      ->condition('file', '', '<>')
      ->execute()
      ->fetchAll();
    $route_collection = new RouteCollection();
    foreach ($verifications as $verification) {
      $route = new Route($verification->file, [
        '_controller' => '\\Drupal\\site_verify\\Controller\\SiteVerifyController::verificationsFileContent',
        'svid' => $verification->svid,
      ], [
        '_access' => 'TRUE',
      ]);
      $route_collection
        ->add('site_verify.' . $verification->file, $route);
    }
    return $route_collection;
  }

}

Members