You are here

class TestMediaFilterController in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/media/tests/modules/media_test_embed/src/Controller/TestMediaFilterController.php \Drupal\media_test_embed\Controller\TestMediaFilterController

Controller to allow testing of error handling of Media Embed in text editors.

Hierarchy

Expanded class hierarchy of TestMediaFilterController

File

core/modules/media/tests/modules/media_test_embed/src/Controller/TestMediaFilterController.php, line 13

Namespace

Drupal\media_test_embed\Controller
View source
class TestMediaFilterController extends MediaFilterController {

  /**
   * {@inheritdoc}
   */
  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);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MediaFilterController::$entityRepository protected property The entity repository.
MediaFilterController::$mediaStorage protected property The media storage.
MediaFilterController::$renderer protected property The renderer service.
MediaFilterController::checkCsrf private static function Throws an AccessDeniedHttpException if the request fails CSRF validation.
MediaFilterController::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
MediaFilterController::formatUsesMediaEmbedFilter public static function Checks access based on media_embed filter status on the text format.
MediaFilterController::__construct public function Constructs an MediaFilterController instance.
TestMediaFilterController::preview public function Returns a HTML response containing a preview of the text after filtering. Overrides MediaFilterController::preview