Questions tagged [views]

The Views module allows creating lists of content with a flexible query builder.

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

Add a conditional CSS class to the label of the view exposed form

I try to add a CSS class sr-only to the label of my Views exposed form. In form-element-label.html.twig I added: {% if title is not empty or required -%} <label{{ attributes.addClass(classes) }}...
1
vote
2answers
53 views

Roster Views with User data plus office content type

I'm creating a site that is an intranet portal for a company. All the users will be employees that work in different offices. I am adding several fields to the users to be used within the roster ...
1
vote
1answer
35 views

Getting literal ampersands from summary field in a view of fields

I have a view where we are using the Body Summary field. I got a bug report that an HTML entity, &amp;, displaying, where they wanted a literal ampersand. When I updated our existing view, ...
2
votes
1answer
46 views

How to override ViewsExposedFilterBlock with my own class?

I want to add an additional form element in the configuration form for core/modules/views/src/Plugin/Block/ViewsExposedFilterBlock.php by adding public function buildConfigurationForm(array $form, ...
0
votes
0answers
14 views

Alter Entity Reference data before view is rendered

I am attempting to work around a bug where an Entity Reference Field on User Account is saving duplicate references. I originally tried to remove any duplicates on the field by implementing ...
1
vote
2answers
23 views

Executing view twice with different filters returns same results

Here's my simple scenario : Execute view with exposed filter (min & max dates) If there are no results, execute again with min date = 0 to get all results Unfortunately, the query static cache ...
1
vote
3answers
93 views

Body Summary field showing literal ampersand character code in view

I have a Drupal 8 site where we've created a view, and decided to use the summary field instead of the trimmed body field, so that we could have more control over it. However, I got a bug report ...
-1
votes
1answer
50 views

AJAX not working in views for anonymous users [closed]

I have a view in Drupal 8 with an exposed form with AJAX enabled. It works fine for admin user, but it doesn't for anonymous users. I have included in my theme libraries file: dependencies: - core/...
0
votes
1answer
35 views

hook_form_alter() on a view exposed filter form

I am trying to add a disable attribute in a field using the hook_form_id_alter function. I created a module and built the function function disableIncentiveform_form_views_exposed_form_alter(&$...
-3
votes
1answer
21 views

Today is in list of dates

Trying to check if variable 'today' is in a list of dates in Views Conditional Field. Both values print out nicely. Today (var php): 24/06/2019 List of dates (var field_dates): 24/06/2019, 25/06/...
0
votes
0answers
20 views

View to display content type and media type

Say I have 1 content type and 2 media types users can create Content type: Post Media Type: Picture Media type: Movie How can I create a view that pulls all 3? As far as I can see you can only create ...
0
votes
2answers
54 views

After save empty cache of referenced node

I have two content types. For clearer question I will work with the content types event and location. From my location content type I can reference to and event. Then on the event page I show the ...
0
votes
0answers
31 views

Geolocation and view proximity filter - Can you default proximity to zero?

I'm trying to see if there is a way to default the views proximity filter to input zero for proximity values when the filter is empty, so we can sort the data using a different field by default. What ...
0
votes
1answer
20 views

Filter a view with contextual authored date

I have a Drupal 8 view where I want to sort nodes by authored year using contextual filters. So www.mysite.com/2017 will list all nodes from 2017. I set up the filter using 'Content: Created Year' ...
0
votes
1answer
24 views

Show Content Type Fields from a entity reference

I have a content type which i have linked to another content type. For e.g. Companies (Content Type) Employees (Content Type) When creating a new employee i have to say which company it works for so ...
0
votes
0answers
15 views

Custom facet processor not displaying on facet setting

We have a custom module,mymodule, where we create a custom facet processor for a facet we created (myfacet). When we enable the module and cleared the cache we are not seeing the new processor display....
0
votes
1answer
27 views

Contextual filter in path for block view display, alongside pathauto aliases in Drupal 8

On our Drupal 8 site, we are using the article content type for press releases. We have the pathauto module generating automatic aliases for these nodes, so the article node entitled "Cool Things are ...
0
votes
0answers
13 views

Invert facet setting for single option on search

What would be a good approach to invert a single facet option? Is this even possible by the system? This is what I have in mind: Let's say we have got a bunch of facet elements to select from on a ...
0
votes
2answers
24 views

Customize the title field

I want to display updated content's field with views block on the front page. 2019/06/20 newly posted content1-title 2019/06/19 updated content2-title The words updated and newly posted before the ...
0
votes
0answers
12 views

How do I programmatically sort table fields using hook_views_default_views()?

I have created all of the view configurations and exported the views_default.inc. After I re-imported my custom module the sorting table fields isn't working and needed to be configured manually again....
1
vote
1answer
27 views

How can I display custom data from the database in a View?

I'm working to create a new website in Drupal 8 and cannot figure out how to reference custom table data within a View. Specifically, I have a script that is taking data from an external DB and ...
1
vote
1answer
31 views

Upgrade breaks Rest Export View in Calendar [closed]

We have a website that uses Views with a serializer rest export to display events on a monthly calendar. When we upgraded from 8.6.16 to 8.7.3 the calendar display is blank. All the json information ...
0
votes
1answer
13 views

no search_api_solr results when search term ends with number

I have search_api_solr with views (I use as external Solr server https://hostedapachesolr.com. ) There is this strange issue: 1/ When I search for 951, there are correct results 2/ When I search ...
0
votes
0answers
26 views

Apply generateOptions() to Custom query() in Views Filter Handler

I am trying to understand how I get the options from generateOptions() to apply to my query() function in a ManyToOne Class. class MyClass extends ManyToOne { public function init(ViewExecutable $...
0
votes
1answer
13 views

Views, how to construct multiple joins

I have a node activity with fields referencing the node location and a node sport_type. As in, for each activity I need to add a location and a sport type. On the other hand I also have a node admin ...
0
votes
1answer
13 views

how to get valid URL in combination of text and field content in VIEWS

Field HOSTNAME returns IP Adress. I have to overwrite the field output . Is there a way to modify this with an given URL like this: 'www.ip-tracker.org/locator/ip-lookup.php?ip=' and adding the field ...
-1
votes
1answer
62 views

Create the FooTable functionality by using only views

I noticed by using FooTable display on one of my view on a Drupal 8 site, it is increasing the load time of the view by more than 2000 ms. The main idea i am using Footable is because of the ability ...
0
votes
0answers
22 views

viewsreference child view Sample Code

Is there any example code for creating a new paragraph object with a viewsreference field and setting a view on the viewsreference field with its "type" and other display options set? Can't really ...
0
votes
0answers
32 views

View escapes node's text field HTML

I've looked at other posts but been unable to resolve the issue. I have a Text field (formatted, long) in a content type, when the node is viewed the HTML in the field displays correctly, when I view ...
-2
votes
1answer
27 views

I want to make a Drupal 8 view with contextual filter

I want to make an intelligent view and want to pass contextual filter. If the contextual filter value is passed in the url so only display the article having the id like http://example.com/article/2. ...
0
votes
0answers
13 views

View of XML feed: The exposed filter is case sensitive

I have a Drupal 8 view that uses XML as a data source. I have exposed filters set on the XML Text of the XML elements <first_name> and <last_name>. The exposed filters work, but they ...
1
vote
1answer
55 views

How to filter a node view on a paragraph field

I have a content type "Lunch" containing a paragraph type field named "Ingredients". This is a multiple values field which store a prapgraph type named "Ingedients" => Taxonomy term + Quantity LUNCH ...
0
votes
3answers
55 views

Menu tree from taxonomy terms and nodes which belong to them

i need to create a collapsible menu tree from taxonomy terms and nodes which belong to them (not nested terms, but content pages) i'm totally stuck about it i've found solutions for nested taxonomy ...
0
votes
0answers
16 views

How to use Views to calculate final balance based on custom content entity?

In a custom module (SEL), I have a custom Content Entity (Transaction) with these fields: $fields['dateoftransaction'] = BaseFieldDefinition::create('datetime') $fields['transaction'] = ...
0
votes
0answers
6 views

Produce array of results from view that has a pager

I am trying to get an array of all the view results in a views_hook_pre_render function. The problem I am running into is that the view has a pager (and needs a pager because it has thousands of ...
0
votes
0answers
10 views

Missing is empty operator on custom entity views integration

I have a custom entity called measurement. There is a baseFieldDefinition field called completed. When I am creating a view for this custom entity, I want to add a filter to the view so that only ...
0
votes
0answers
19 views

Prefilter facet using URL

We have added facet_categories to our Articles page which is a view page with the path url of /articles. Facet_categories is setup to be the Articles->Category field (which is a taxonomy term). ...
0
votes
0answers
8 views

Contextual raw value spiit

I need to take a first text before dash from an address bar to list related content. So for example, from www.aaa.com/US-NY-New-York, I would like to take US with contextual filter. I tried the Raw ...
1
vote
1answer
45 views

How to filter Views records by day-of-week, including multiples

I have a need to filter many records by the day of the week derived from a date-only field in those records (i.e. not today's dow). I would like a solution that works with views filters, as the wider ...
0
votes
0answers
40 views

How to display number of comments of a node as part of a “content” view with fields

I created a content view in D8, which shows me fields of a content type. Basically it works. Now I would like to have the total number of comments per listed node displayed as a view field ...
1
vote
2answers
66 views

Fetch view results from mymodule_preprocess_page hook

We have a View page that is coming from myview. Using the header setting in the view we have added @total results already, which displays in the views-view--myview--page-1.html.twig using the {{ ...
-2
votes
1answer
37 views

How to trim title for mobile devices?

I am working with Drupal 8 website, on my view I have a list of contents. Some titles are pretty long, what is fine for teh desktop view, but for mobile version I need to trim the tite up to 30 ...
0
votes
1answer
14 views

How can one Rewrite results of a view using a Group By

I have created a view and then added a group by a certain field. Normally one would just add a new field then rewrite the results with custom html using replacement patterns. How would I go about ...
0
votes
1answer
19 views

How to use CiviCRM contact data latitude and longitude in drupal gmap formatted view

Environment Drupal 7.67 civicrm 7.x-5.13.4 GMap Module 7.x-2.11 Location 7.x-3.7 Views 7.x-3.23 What is working I have CiviCRM contact data for organisations which has been successfully geocoded ...
0
votes
0answers
23 views

How to “link” Views exposed filter (fulltext search) with Facet API block (on a specific field)?

Using Drupal 7.67, Search API, Search API Database Search, Views and Facet API. I have built a search engine page with Views and Search API (with a server linked to the Drupal database tables). Two ...
-3
votes
1answer
30 views

How to remove arrows from views Select list field [closed]

I have a content type which has a select list field. I created a view where select list field was added under "filter criteria". How can I remove the arrows and slider?
0
votes
1answer
10 views

Creating 'index' content views for L1-LX within a taxonomy

Note: This is a follow-on question from Creating a displayable 'index' of content nodes within a path Ok, starting to find my feet again within Drupal, and still getting up to speed with views. What ...
0
votes
0answers
32 views

How can I display a block to public?

I created a view block and placed it in the content region. There is no role restriction. That means all users can view the block. However, only authenticated users can view the block. I am not sure ...
0
votes
1answer
9 views

How do you get Product Variation Type fields and display modes to show up when displaying Products in a View?

I've created a Product Variation Type for all my products, all of which have the following custom fields: Display Title, Subtitle, and Top Rated Product? (boolean checkbox): When setting up a View to ...
0
votes
0answers
20 views

How to alter rendered and aggregated views values?

I would like to do math on counts of two aggregated fields. In views post render the final results are located under $view->style_plugin->rendered_fields[0] and they are generated by views aggregator ...