public function MediaController::dialog in Gutenberg 8.2
Same name and namespace in other branches
- 8 src/Controller/MediaController.php \Drupal\gutenberg\Controller\MediaController::dialog()
Render Drupal's media library dialog.
Parameters
\Symfony\Component\HttpFoundation\Request $request: Current request.
Return value
\Symfony\Component\HttpFoundation\JsonResponse The JSON response.
Throws
\Symfony\Component\HttpKernel\Exception\NotFoundHttpException
1 string reference to 'MediaController::dialog'
File
- src/
Controller/ MediaController.php, line 90
Class
- MediaController
- Returns responses for our image routes.
Namespace
Drupal\gutenberg\ControllerCode
public function dialog(Request $request) {
try {
return new JsonResponse([
'html' => $this->mediaService
->renderDialog(explode(',', $request->query
->get('types', ''))),
]);
} catch (MediaTypeNotFoundException $exception) {
throw new NotFoundHttpException($exception
->getMessage(), $exception);
}
}