Questions tagged as ['uri']

A "Uniform Resource Idendifier" identifies a resource on a network.
Score: 0
Steve Siddu avatar
How to add contextual filter?
br flag

I am working with books in drupal 8. I want to display a specific page("table of contenets") on the sidebar whenever any page of that book is accessed. "table of contents" is a book page. every page of book has two id's.

  • page_id
  • book_id

Page_id is unique for every page but book id is same for all pages. I believe contextual filter based on book_id might solve my issue. but I don't know how to add c ...

Score: 1
frank.schram avatar
Filter GeoJSON feed on a value in the path
ca flag

I have GeoJSON feed, created with a view in Drupal 7, that I want to filter on a path value in the url of the loaded page (/path/%). The feed is loaded as an Openlayers map on a page. The feed seem to work with its own feed-url and is not aware of the site url. Contextual filters in the view don't work either. I can use hook_views_query_alter or hook_views_pre_view. But I don't know how to bring the val ...

Score: 0
Sudheesh S Babu avatar
How to get the base URL of a site in Queue API?
co flag

I am trying to get the base url of the drupal 8 website in a queue process but I am getting http://default as the base url. What am I missing here?

  public function testUrl() {
    global $base_url;
    $host = \Drupal::request()->getSchemeAndHttpHost();
    var_dump($host); // output - http://default
    $host2 = \Drupal::request()->getHost();
    var_dump($host2);  ...
Score: 0
Kevin avatar
Gracefully handle URL/URI/Link exceptions when using Link field formatter?
in flag

Occasionally I am encountering an error along these lines:

The website encountered an unexpected error. Please try again later.InvalidArgumentException: The URI 'XYZ' is invalid. You must use a valid URI scheme. in Drupal\Core\Url::fromUri() (line 290 of core/lib/Drupal/Core/Url.php).

We are migrating data frequently and one thing that can happen is link field URIs can come in like that. The core Link ...

Score: 1
iamfredrik avatar
How to get product variation media file url using jsonapi?
us flag

I'm using the following jsonapi GET request to retrieve product variations for a product:


However, the response does not include the file url for the media:

"type": "media--image",
"id": "6af50149-ae35-4a3b-802d-b21c5d863235",
"links": {
"self": {
"href": "http://myurl/en/jsonapi/media/image/6 ...
Score: -5
Why does a query string return a 404 error?
mx flag

I recently upgraded from Drupal 8 to Drupal 9 and noticed a problem that occurs when the URL has a query string. For example for the following URL Drupal throws a 404 page not found.

Score: 0
Dimetry avatar
How can I disable these URLs?
cn flag

In Drupal 7, the following URLs show the same node.

This doesn't happen in Drupal 8.

How can those URLs be disabled?