public function YamlFormHelpController::index in YAML Form 8
Returns dedicated help video page.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request.
string $id: The video id.
Return value
array A renderable array containing a help video player page.
1 string reference to 'YamlFormHelpController::index'
File
- src/
Controller/ YamlFormHelpController.php, line 54
Class
- YamlFormHelpController
- Provides route responses for form help.
Namespace
Drupal\yamlform\ControllerCode
public function index(Request $request, $id) {
$id = str_replace('-', '_', $id);
$video = $this->helpManager
->getVideo($id);
if (!$video) {
throw new NotFoundHttpException();
}
$build = [];
if (is_array($video['content'])) {
$build['content'] = $video['content'];
}
else {
$build['content'] = [
'#markup' => $video['content'],
];
}
if ($video['youtube_id']) {
$build['video'] = [
'#theme' => 'yamlform_help_video_youtube',
'#youtube_id' => $video['youtube_id'],
];
}
return $build;
}