views – Using Twig in global custom text to check for a specific content type

I am filtering for two content types to display in a view: Artwork Page and Cover Page. I want to change the HTML markup for Cover Page.

I have researched and tried many field names for Content Type, but with none of them I get what I am trying to achieve. In this instance, the replacement pattern for Content Type is {{ type }}; using it doesn’t work. I’ve tried both the machine name (cover_page) and the name (Cover Page), but neither of them worked.

{% if type == 'cover_page' %}
{% endif %}

{% if type == 'Cover Page' %}
{% endif %}

MSSQL CDC for views and stored procedures

is it possible to enable CDC for Views or Stored procedures?


8 – Can you rename replacement pattern tokens in views?

If you insert one or more custom text field (e.g. to include some Twig logic), latter fields will see such blocks as {{ nothing }}, {{ nothing_1 }} etc. in the replacement patterns.

Can these be renamed? The label and the admin description make no difference.

theming – Using TWIG in views global custom text to test for a specific content type

I am filtering for two custom content types to display on a page in Drupal 9 Views: “Artwork Page” and “Cover Page”. I want to apply special html tags to “Cover Page”. I have researched and tried many field names for “Content Type” but to no avail. Views’ replacement pattern for content {{ type }} but using this in the TWIG if statement doesn’t work. I’ve tried both the machine name (cover_page) and value (Cover Page).

{% if  field_type == 'Cover Page' %}
{% endif %}

views – Pathauto alias full path for hierarchical taxonomy terms

My client has content tagged by a hierarchical taxonomy of arbitrary depth.

Currently the maximum depth is three, but that could change:

└── ChildTerm
    └── GrandchildTerm

Each Term has a unique TID (of course), but many Terms (especially descendants) share identical strings for Name.

However, the full Taxonomy tree path to each term is guaranteed to be unique (two adjacent Terms will never be identically named.)

All nodes tagged with GrandchildTerm of TID = 42 appear in a View at /taxonomy/term/42.

I would like to use Pathauto to generate aliases for each Term at the full taxonomy tree path, like so:


I was looking for Tokens to accomplish this.

I found instead that the paths are set by the View which generates the list of Nodes tagged with the Term ID.

The View has a contextual filter which accepts {{ arguments.tid }}.

Under Page Settings, the value for Path is /taxonomy/term/%.

Someone on this forum said setting up two contextual filters would help, but that does not apply here. I do not want /taxonomyname/taxonomyterm as the path; I want /ParentTerm/ChildTerm/GrandchildTerm as the path (or, if necessary, /tags/ParentTerm/ChildTerm/GrandchildTerm).

It is possible to set a contextual filter Content: Has taxonomy term ID (with depth) but I haven’t been able to get the path I seek this way.

Also, I would like a ParentTerm taxonomy page to return results for its descendants, but the current View only displays items for the specific TID. (The Views Tree module would help here, but it does not work with Drupal 9 yet.)

If this were not a requirement, I might try flattening the taxonomy and using term names like ParentTerm-ChildTerm-GrandchildTerm to differentiate identically named descendant terms. (This would solve another problem the client has: the ambiguity of selecting the correct term from the “Tags” vocabulary when tagging content.)

backup – MySQL Dump only views, triggers, events and procedures

how are you?

I need to generate a file with all triggers, events, procedures from a server’s databases and tried the two commands below

  • mysqldump -u root -p –all-databases –host= –no-data
    –no-create-db –no-create-info –routines –triggers –skip-comments — skip-opt –default-character-set=utf8 -P3306 > E:db_objects_no_create.sql

    mysqldump -u root -p –all-databases –host= –no-data
    –no-create-db –routines –triggers –skip-comments –skip-opt –default- character-set=utf8 -P3306 > E:db_objects.sql

In the first one, the output of the file does not extract the creation codes correctly, they are commented out.

In the second the codes are done correctly however the information of the table creation code is also exported.

Does anyone know how to do this export without the table creation code being generated in the output file?

theming – Drupal 8 – In views twig template sum grouped views results

I have an aggregated views result grouped by taxonomy terms like this in /reports page


I want my results summed like this


What I have done so far: Try to calculate the results returned from views in views-view-fields–reports.html.twig file with the following codes

{% set total = 0 %}
{% for field in fields -%}
  {% set total = total + 1 %}
{%- endfor %}
{{ total }}

But instead of expected result, I am getting the original result again. Nothing changed.

Best Regards. Thanks in advance

views – Blocks not displaying on the page

I am working on an already built drupal website. I have created a landing page and for an existing view with multiple blocks, I added one more block to it. The content appears on the auto preview of the structural view but doesn’t show up on the actual page what am I doing wrong here. I believe I am missing a small step.

But when I change it to a different vocabulary it appears in that block.

enter image description here

datetime – Rewriting Start and End Dates in Views where Date is stored in single field

using Drupal 7, I have the Profile2 module installed. Within that, I have a field called “Employment Dates” and a user can enter a start and end date on this field. They can also leave the end date field blank.

I then have a view that has this field. It works well when there is a start and end date (for instance it will show Aug 2012 to Aug 2016 if that’s the values entered) but when there is only a start date it shows Aug 2012. I would like to do a re-write to show Aug 2012 to Present when the end date is null/blank. I’ve tried repeating the field and then setting each one to show only start and show only end respectively, but the when only one date is entered the same date displays in both fields. I’ve also tried installing the PHP View field to allow creating a PHP field, but I’ve struggled with the re-write.

Would appreciate some advice.

sharepoint designer – Editing xml of views in SP Online?

I’m needing to move a on-prem SharePoint application that I wrote 5+ years ago to SharePoint Online. When I did the development initially, I used SP Designer 2013 to edit the raw XML behind the views/forms. Since SP Designer has been retired, what is the current method to view and edit the raw XML behind views/forms?

(I’m aware there is push to use the GUI editing tools provided by SP Online, but I want access to the raw XML for the details that the GUI editor doesn’t do.)