Skip to main content
removed tags from the title
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

D8, Hide/remove "jsjs-view-dom-id"id in just one specific view?

added 372 characters in body
Source Link

I found, that the div with the id "js-view-dom-id" comes from views-view.html.twig. As I want to render one view output without any of Drupals HTML markup, I already hunted down the contextual links, which I can turn of for a specific view. Then I set the view format to an unused format, and removed all unwanted HTML markup from this views template as well.

Now I get plain {{ content.field_x.0 }}-output from this view. The only element left I need to get rid of is before mentioned "js-view-dom-id". I could remove this from views-view.html.twig, but then I would remove it from all views.

Is there any way to remove this markup for only one specific view? To be precise, I am using a custom content view mode, if that makes any difference.

Thank you very much in advance!

@edit:

Twig in views-view.html.twig looks like this:

{%
set classes = [
dom_id ? 'js-view-dom-id-' ~ dom_id,
]
%}
<div{{ attributes.addClass(classes) }}></div>

Is there any way to do something like:

{% if view mode is xy %}
// Do nothing
{%  else %}
<div{{ attributes.addClass(classes) }}>
{% endif %}

I found, that the div with the id "js-view-dom-id" comes from views-view.html.twig. As I want to render one view output without any of Drupals HTML markup, I already hunted down the contextual links, which I can turn of for a specific view. Then I set the view format to an unused format, and removed all unwanted HTML markup from this views template as well.

Now I get plain {{ content.field_x.0 }}-output from this view. The only element left I need to get rid of is before mentioned "js-view-dom-id". I could remove this from views-view.html.twig, but then I would remove it from all views.

Is there any way to remove this markup for only one specific view? To be precise, I am using a custom content view mode, if that makes any difference.

Thank you very much in advance!

I found, that the div with the id "js-view-dom-id" comes from views-view.html.twig. As I want to render one view output without any of Drupals HTML markup, I already hunted down the contextual links, which I can turn of for a specific view. Then I set the view format to an unused format, and removed all unwanted HTML markup from this views template as well.

Now I get plain {{ content.field_x.0 }}-output from this view. The only element left I need to get rid of is before mentioned "js-view-dom-id". I could remove this from views-view.html.twig, but then I would remove it from all views.

Is there any way to remove this markup for only one specific view? To be precise, I am using a custom content view mode, if that makes any difference.

Thank you very much in advance!

@edit:

Twig in views-view.html.twig looks like this:

{%
set classes = [
dom_id ? 'js-view-dom-id-' ~ dom_id,
]
%}
<div{{ attributes.addClass(classes) }}></div>

Is there any way to do something like:

{% if view mode is xy %}
// Do nothing
{%  else %}
<div{{ attributes.addClass(classes) }}>
{% endif %}
Source Link

D8, Hide/remove "js-view-dom-id" in just one specific view?

I found, that the div with the id "js-view-dom-id" comes from views-view.html.twig. As I want to render one view output without any of Drupals HTML markup, I already hunted down the contextual links, which I can turn of for a specific view. Then I set the view format to an unused format, and removed all unwanted HTML markup from this views template as well.

Now I get plain {{ content.field_x.0 }}-output from this view. The only element left I need to get rid of is before mentioned "js-view-dom-id". I could remove this from views-view.html.twig, but then I would remove it from all views.

Is there any way to remove this markup for only one specific view? To be precise, I am using a custom content view mode, if that makes any difference.

Thank you very much in advance!