query->get('url'); $resources = \Drupal::state()->get(static::class, []); $content = file_get_contents($resources[$asset_url]); $response = new Response($content); $response->headers->set('Content-Type', 'application/json'); return $response; } /** * Maps an asset URL to a local fixture representing its oEmbed resource. * * @param string $asset_url * The asset URL. * @param string $resource_path * The path of the oEmbed resource representing the asset. */ public static function setResourceUrl($asset_url, $resource_path) { $resources = \Drupal::state()->get(static::class, []); $resources[$asset_url] = $resource_path; \Drupal::state()->set(static::class, $resources); } }