How do I override the template file of a view so that it no longer displays links in my view, but only the plain text?
I user for this "views-view-unformatted.html.twig":
{% if title %}
<h3>{{ title }}</h3>
{% endif %}
{% for row in rows %}
{%
set row_classes = [
default_row_class ? 'views-row',
]
%}
<div{{ row.attributes.addClass(row_classes) }}>
{{- row.content -}}
</div>
{% endfor %}
This is a body field where the titles of the refenced entities are displayed as links. I would like to disable this for this view. But how can I override this part in the code so that no links are displayed anymore?
{{- row.content -}}
And when I try something like this
{{row.content|striptags('<a>')}}
I get the following error:
The website encountered an unexpected error. Please try again later. TypeError: strip_tags(): Argument #1 ($string) must be of type string, array given in strip_tags() (line 1120 of /home/bavramor/data/Webdesign/Webseiten/landwehrcie-backup-drupal9-160522/vendor/twig/twig/src/Extension/CoreExtension.php).
Would appreciate any tips.
Greetz Bavra
Comments
Comment #2
bavramor commentedComment #3
niral098Hi
Could you please try this -
Comment #4
anjali rathodIf you are using fields to display in the view, you can try the override output option in the field settings.