TestMediaFilterController.php in Drupal 9
File
core/modules/media/tests/modules/media_test_embed/src/Controller/TestMediaFilterController.php
View source
<?php
namespace Drupal\media_test_embed\Controller;
use Drupal\filter\FilterFormatInterface;
use Drupal\media\Controller\MediaFilterController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class TestMediaFilterController extends MediaFilterController {
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);
}
}