Questions tagged [uri]

A "Uniform Resource Idendifier" identifies a resource on a network.

Filter by
Sorted by
Tagged with
0
votes
1answer
25 views

Alter a path alias depending on a node property

I use the Pathauto module and I'm trying to get, for the same content type, two different path aliases depending on a Boolean field that content type has. I would like to have a path alias like ...
0
votes
0answers
17 views

How to get an Url object with correct interface language?

I'm trying to get an Url object with correct interface language. use Drupal\Core\Url; $language_manager = \Drupal::service('language_manager'); $url = Url::fromRoute( "entity.node....
3
votes
1answer
73 views

When should I use the Url::fromRoute method instead of “new Url”

I'm finding that these two PHP snippets yield the same result: $arr['query']['confirm'] = 'y'; $text = t('Click here.'); $url = new Url('my_route.import', [], $arr); // Three arguments. $link = Link::...
-5
votes
1answer
40 views

How to link to a file in twig template

I'm trying to link to a file in a view. I have a field in the view that outputs the link if I use it like this: <div class="product-cta-view-pdf"> {{ fields.field_notice.content }} </div&...
0
votes
0answers
19 views

How to change base url in Drupal 8 in reverse proxy?

Drupal is configured with reverse proxy server and sometimes user gets redirected to internal host instead of the configured domain.
0
votes
0answers
31 views

How do I use URL redirect with token?

I am using url_redirect. I want to redirect users to /prize_page when they click on my account link /user/[current-user:uid]. It seems the [current-user:uid] token doesn't work. Is there any way ...
1
vote
1answer
39 views

Render media url in node--page.html.twig

I have an Entity reference field field_video. It's a core Media field with a Reference type of Remote video. Because I use this field_video in my Hero section I need some additional markup here. ...
0
votes
1answer
43 views

Get argument from current URL in twig to generate a link with that argument

I'm trying to get an argument from search page URL so that I can pass that argument to a link. For example I have this URL for a search results page: http://domain.com/site-search?search_api_fulltext=...
0
votes
1answer
20 views

How to create programmatically multiple URL alias of same taxonomy term?

I have category cars and I want to create its URL alias according to the region like if the user location is Australia than URL will mysite/australia/cars similar if the user location is USA than URL ...
0
votes
0answers
36 views

Ckeditor pasted url links become hyperlinks

We have disabled 'Convert URLs into links'. When you copy a url link from a browser url field like: drupal.org. Your clipboard contains the FQDN: https://www.drupal.org/. When you past this into ...
1
vote
1answer
202 views

Notice: Trying to get property 'nid' of non-object

In Drupal\rsvplist\Form\RSVPForm->buildForm(), I wrote this to get the current nid: $node = \Drupal::routeMatch()->getParameter('node'); $nid = $node->nid->value; I get this error: ...
0
votes
0answers
46 views

Redirect user to a specific page

I'm new to drupal. And I have a project that has a search block on the home page that redirects the user to a page based on the user search terms. Everything works fine but I have a FAQ page that ...
0
votes
0answers
46 views

Get relative path to node by title in a Twig

Using Drupal 8: I would like to get the relative path to a node using the Title field. Is this possible? All the Twig documentation I've found uses the node ID, for example: <a href="{{ path('...
0
votes
0answers
30 views

CKEditor/Media Gallery Using Absolute URL for images, how to update?

After entering 100's of hours worth of content we noticed that the images entered through the media gallery plugin contain absolute paths, not relative. This means they breaking when we switch domains....
0
votes
0answers
25 views

how to change the keyword for URL search with new search

I have a problem with the search API function. The first time I enter the keyword into the search field which will show the results and the URL like this for example: www.avc.com/avs/search/search-...
0
votes
1answer
28 views

Generate automatic URL alias removing words

I'm trying to create a topic page for "internet of things", but each time I create the page I notice the URL slug removes the word "of" in it. By default Generate automatic URL alias is checked. The ...
0
votes
0answers
40 views

How do I make comment URLs include the node URL on which they are displayed?

Default URL for comments is comment/1#comment-1. I would like it to be [node URL]#comment-1 where [node URL] is the URL of the node on which the comment is displayed. I have tried to use the pathauto ...
0
votes
1answer
36 views

How to print the URL of a title field?

I'm trying to print out the url path from the title in my twig template however I haven't been successful so far. Printing out the title containing the link works fine using: {{content.title}} ...
0
votes
1answer
235 views

Custom Page routing

I created a custom page type called 'Angular page' and a custom twig template for it which loads my angular scripts and prints the <app-root> tag. I set the page URL to /angularpage and the ...
0
votes
1answer
295 views

Programmatically auto-submit a Webform after visiting its URL

I am wondering whether it's possible to programmatically auto-submit a Webform after visiting its URL and to save the user from a 'submit' button click. The below webform can be accessed via /form/my-...
0
votes
0answers
63 views

How to redirect to the previous page after submission of a form in a block

I have a view of nodes of type task. I created a block with an inline task create form (using form block module) The block is next to the view on the same page. Question: After creating a new task by ...
0
votes
1answer
281 views

Get Absolute url using hook_preprocess_node

We are attempting to change the $variables['url'] from a relative to absolute URL within the mymodule_preprocess_node() hook. The $variables['url'] is displayed as a <a> element within our node--...
0
votes
1answer
62 views

Get 404 for url specified in module.routing.yml

I am new to Drupal and I got stuck with the problem that I don't know how to debug even: I have made a simple module 'final', its structure: Applications/MAMP/htdocs/drupal_dir_1/modules/final > ...
2
votes
1answer
1k views

Get raw and relative path of a file uri

I have a file with an uri and I want to get its raw and relative path. Uri: public://videos/Test Video.mp4 Path: /sites/default/files/videos/Test Video.mp4 I found already a way to do this: $...
0
votes
1answer
410 views

Pass parameter to node twig template via url

The url to display node 100 is <site>/node/100. I want to pass a parameter to this node via the url. For example: <site>/node/100/3. Question: What must I do to get Drupal 8 to see /node/...
0
votes
1answer
319 views

How to output multiple files url entities on twig?

I have a file entity field that I can upload multiple files and I'm trying to render or display it inside my node twig template. The code below is what I'm trying to make it display. Tried clearing my ...
0
votes
1answer
27 views

Can I change an upload URL to match the original upload?

I uploaded a PDF in Dupal and used the URL created. Somehow, that document wasn’t saved or was deleted, so now that URL (which is being promoted widely) leads to a page not found. I uploaded a new ...
0
votes
2answers
102 views

How do I remove the term ID from the view URL?

I have a content view with an exposed filter based on a vocabulary. In the URL (for example, mysite/myview?tid=taxonomy+term+(3)), and incidentally in my page title (I use argument.tid to display a ...
-1
votes
1answer
48 views

Getting redirect to phantom page /user/register/thankyou

In Drupal 8, I created a page with the path alias /user/register/thankyou to redirect users to after registration. Later, I changed the url of this page to simply be /register/user/thankyou. I have ...
1
vote
1answer
175 views

Convert node URL to absolute

We are using Drupal Core v8.6.2 and we have a url variable in our node--page.html.twig template. While using ksm() and {{ kint() }} we are finding that if we use hook_preproces_node($variables) that ...
1
vote
1answer
826 views

How to create URL alias for node edit page

Pathauto can create URL alias for node view page, for example, URL from node/nid to project/nid (project is a name of content type), but the link to the edit page is not /project/nid/edit, but /node/...
0
votes
1answer
324 views

Multiple URLs for same node

anyone know how to create a URL alias and not redirect the user? I have a node with its alias set to /sign-up, but I also want it accessible via /caregiver/sign-up. I created a URL alias, but it seems ...
0
votes
1answer
36 views

How to display the user's url in a template?

I created a template user-comment.html.twig to customize the rendering of the comments author. I can not display the user account url: user.url does not work. How to display the user's url in a ...
3
votes
1answer
548 views

How to change the title of a modal window?

I have a link that displays a modal window. The link redirects to a page view. When I click on it, it is marked in the title of the modal window Array. How to customize the title ? <?php ...
1
vote
1answer
82 views

How to display the path without alias?

With Drupal 8 and Commerce 2.10 I created a php code to display the link of my store. When I go to the link, it displays: https://www.domaine.com/shop/name I want to display without alias: https:/...
0
votes
1answer
344 views

Views Link Display Settings Is Not Accepting External URL

I want to add an external URL to the Views More Link Display Settings. It is also mentioned in the guide lines as well ("A Drupal path or external URL the more link will point to. Note that this will ...
2
votes
1answer
282 views

how rewrite pagination URL views for SEO?

i am trying to rewrite the views url pagination : /mypath/cat?page=1 to /mypath/cat/1 or > /mypath/cat/page/1 or /mypath/cat-1 cat is a taxonomy term. I have tried to rewrite url with Drupal\...
0
votes
1answer
47 views

Can't clean URL from custom query parameters

I have a client whose company has different branches. The data are retrieved from a DB (not the Drupal one). For example, the url mydrupalsite.com/branch?branchID=1 should lead to mydrupalsite.com/...
1
vote
1answer
143 views

How can I correctly include a (non-fragment) # in a URL?

I need to build an external URL that looks like this: https://searchapp.foo.gov/search-org/#/collection-name?q=search%20terms%20here First thought is that /#/ is entirely invalid according to RFC ...
3
votes
0answers
45 views

Register an object with the Service Container and give it a setRequest() (get base url)

I'm looking for a way to get the hostname of a multisite, and I've found several answers about it. One of the solutions was to use: Answer link $host= \Drupal::request()->getHost();   or \...
0
votes
2answers
154 views

Not getting complete URL parameters

My url is node/3?filter-value=67&filter-value=80 and when i try to do this code: $param = \Drupal::request()->query->all();` $param['filter-value'] It shows the value 80 only. I want to ...
1
vote
2answers
766 views

How to pass dynamic parameters through a local action button?

I created a local action button with the following in my_module.links.action.yml: my_module.content.action: route_name: node.add_page title: 'My action' deriver: 'Drupal\my_module\Plugin\...
1
vote
2answers
109 views

How to get the current path, keeping the langcode?

For my button I need to specify the destination path, as my site is multilingual it is imporatnt for me to keep the langcode in the path. So how can I get from drupal-site/fr/page_1 to drupal-...
1
vote
1answer
37 views

How can I avoid the installation directory appears in the site URLs?

I installed Drupal 7 through the hosting service tools, which installed Drupal inside the drupal1 folder. All the site URLs contain the folder name. How can I avoid the URLs contain that folder name? ...
2
votes
2answers
1k views

Finding the host node of a paragraph

I'm trying to find all the absolute URLs in a site (in wysiwyg content, url fields, config) to convert them into relative URLs later via manual administration. All the URLs in question are within the ...
0
votes
1answer
208 views

How do I get link the files in libraries.yml with absolute url path

In my libraries.yml files the css files are linked with the relative url paths. Eg : /css/mycss.html So when in the page source the linked url shows as relative. How do I link those files with ...
0
votes
1answer
20 views

How are contextual arguments specified explicitly in the URL?

The examples in contextual arguments simply call for specifying them with slashes without specifying the name of the filter, but if you wish to apply the second or third filter in the contextual link, ...
1
vote
0answers
324 views

Get image url with https instead of http

When I use file_create_url it return url with http instead of https. Code Snippet: $desimg = file_create_url($node->field_image->entity->getFileUri()); Due to which i m getting warning ...
1
vote
2answers
3k views

How can I programmatically create a link/URL with querystrings set from parameters?

In Drupal 8 I customize the filter in the block in the sidebar menu. When the user clicks on the option in the block, I need to pass his choice to the URL. $this->args = \Drupal::request()->...
0
votes
1answer
96 views

How to make Dynamic Term Link based on content type?

My web site has three content types ( Event, Course, Video) and 2 taxonomies(city and schools) All of them have same taxonomy referenced field. Eg:New York City events or New York City courses will be ...

1
2 3 4 5
23