You are here

protected function FocalPointPreviewController::validTokenProvided in Focal Point 8

Was a valid token found?

Determine if a valid focal point token was provided in the query string of the current request. If no token is provided in the query string then this method will return FALSE.

Return value

bool Indicates if a valid token was provided in the query string.

1 call to FocalPointPreviewController::validTokenProvided()
FocalPointPreviewController::access in src/Controller/FocalPointPreviewController.php
Define access control for the preview page.

File

src/Controller/FocalPointPreviewController.php, line 263

Class

FocalPointPreviewController
Class FocalPointPreviewController.

Namespace

Drupal\focal_point\Controller

Code

protected function validTokenProvided() {
  try {
    if (\Drupal::request()->query
      ->has('focal_point_token')) {
      $token = \Drupal::request()->query
        ->get('focal_point_token');
      return FocalPointImageWidget::validatePreviewToken($token);
    }
    else {
      return FALSE;
    }
  } catch (\InvalidArgumentException $e) {
    return FALSE;
  }
}