function ResourceController::setResource404

Same name in other branches
  1. 8.9.x core/modules/media/tests/modules/media_test_oembed/src/Controller/ResourceController.php \Drupal\media_test_oembed\Controller\ResourceController::setResource404()
  2. 10 core/modules/media/tests/modules/media_test_oembed/src/Controller/ResourceController.php \Drupal\media_test_oembed\Controller\ResourceController::setResource404()
  3. 11.x core/modules/media/tests/modules/media_test_oembed/src/Controller/ResourceController.php \Drupal\media_test_oembed\Controller\ResourceController::setResource404()

Maps an asset URL to a 404 response.

Parameters

string $asset_url: The asset URL.

2 calls to ResourceController::setResource404()
WidgetOEmbedTest::testWidgetOEmbed in core/modules/media_library/tests/src/FunctionalJavascript/WidgetOEmbedTest.php
Tests that oEmbed media can be added in the Media library's widget.
WidgetOEmbedTest::testWidgetOEmbedAdvancedUi in core/modules/media_library/tests/src/FunctionalJavascript/WidgetOEmbedTest.php
Tests that oEmbed media can be added in the widget's advanced UI.

File

core/modules/media/tests/modules/media_test_oembed/src/Controller/ResourceController.php, line 72

Class

ResourceController
Test controller returning oEmbed resources from Media's test fixtures.

Namespace

Drupal\media_test_oembed\Controller

Code

public static function setResource404($asset_url) {
    $resources = \Drupal::state()->get(static::class, []);
    $resources[$asset_url] = 404;
    \Drupal::state()->set(static::class, $resources);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.