Linked Questions

1
vote
0answers
855 views

Using replace in my twig returns a blank [duplicate]

I have what I think is a rather simple statement here {{ (content.field_url.0)|replace("http://","") }} but then I get an error Warning: strtr() expects parameter 1 to be string, array given in ...
0
votes
1answer
31 views

Why is drupal spitting out urls like entity:/node-1474 instead of /node-1474 [duplicate]

So for the longest time I was using the following line of code to get urls instead of relying on drupals raw output. The main reason being I need an <a> tag to wrap several elements. {{ item....
0
votes
0answers
26 views

How to get referenced entity fields from another content type in single node template [duplicate]

I have a content type called "Resources", this is referenced from another content type called "Projects". I can get simple text fields in my single node--project.html template for example - {{...
0
votes
1answer
4k views

Get path/url/uri of Entity reference field to content in a Twig template?

I have a Entity reference field which links to internal content/node. I can get the title with {{ node.field_related_project_internal.entity.label }} But how can I get the raw path/url/uri of the ...
1
vote
4answers
11k views

How to get the value / URL of a Link field in a Twig template?

I have a custom block Type with a Link field called "field_link" (for internal links only). Within my block Twig template I want to extract the URL of the link field. How can I do that? I read some ...
0
votes
2answers
2k views

How to add anchor link through Link field?

We have a link field (field_link) on the Basic page content type. We wanted to add the link as an anchor link by putting current-page#section1 into the Link field, but it is not current. What can we ...
0
votes
0answers
252 views

How do I render a node's link field in a page template?

I have a custom page template that's intended to display a couple of fields for a specific content type in an aside, along with the sidebar contents. My searching and reading seems to indicate that ...
2
votes
0answers
98 views

How to get the specific field raw data in node.html.twig

I am using link field in a couple of content types, but when I am trying get url from node.html.twig with content.field_my_link_field and have tried some suggestions like content.field_my_link_field....
0
votes
1answer
75 views

Get Link value in Media entity

We have a Media type called Documents that has a Link field called field_link. We need to obtain the URL (external or internal) from the field so that we can use to wrap block elements inside of a <...
0
votes
1answer
18 views

Date and links formatting in node template

Drupal 8.x I have 2 quick questions. I have the following node template node--briefing--teaser.html.twig <div> <span>{{ date }}</span> <span>{{ label }}</span> &...