function TestMediaFilterController::preview
Same name and namespace in other branches
- 8.9.x core/modules/media/tests/modules/media_test_ckeditor/src/Controller/TestMediaFilterController.php \Drupal\media_test_ckeditor\Controller\TestMediaFilterController::preview()
- 10 core/modules/media/tests/modules/media_test_embed/src/Controller/TestMediaFilterController.php \Drupal\media_test_embed\Controller\TestMediaFilterController::preview()
- 9 core/modules/media/tests/modules/media_test_embed/src/Controller/TestMediaFilterController.php \Drupal\media_test_embed\Controller\TestMediaFilterController::preview()
- main core/modules/media/tests/modules/media_test_embed/src/Controller/TestMediaFilterController.php \Drupal\media_test_embed\Controller\TestMediaFilterController::preview()
Returns a HTML response containing a preview of the text after filtering.
Applies all of the given text format's filters, not just the `media_embed` filter, because for example `filter_align` and `filter_caption` may apply to it as well.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request object.
\Drupal\filter\FilterFormatInterface $filter_format: The text format.
Return value
\Symfony\Component\HttpFoundation\Response The filtered text.
Overrides MediaFilterController::preview
File
-
core/
modules/ media/ tests/ modules/ media_test_embed/ src/ Controller/ TestMediaFilterController.php, line 20
Class
- TestMediaFilterController
- Controller to allow testing of error handling of Media Embed in text editors.
Namespace
Drupal\media_test_embed\ControllerCode
public function preview(Request $request, FilterFormatInterface $filter_format) {
if (\Drupal::state()->get('test_media_filter_controller_throw_error', FALSE)) {
throw new NotFoundHttpException();
}
return parent::preview($request, $filter_format);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.