You are here

public function ScreenLoaderManager::getScreen in Janrain Registration 8

Get Janrain screen contents by name and type.

Parameters

string $name: Janrain screen name.

string $type: Screen type.

Return value

string Janrain screen contents.

File

src/ScreenLoaderManager.php, line 103

Class

ScreenLoaderManager
Allow to load and manage Janrain screens (local and remote).

Namespace

Drupal\janrain_capture

Code

public function getScreen($name, $type) {
  if (!in_array($name, static::ALLOWED_SCREENS) || !in_array($type, static::ALLOWED_TYPES)) {
    return '';
  }
  $file_name = static::buildPath($this
    ->isRemote() ? static::CACHE_DIR : $this->path, $name, $type);
  if (!is_readable($file_name)) {
    $this->logger
      ->error('Unable to read @filename', [
      '@filename' => $file_name,
    ]);
    return '';
  }
  return file_get_contents($file_name);
}