Using Exposed Form to filter by referenced entity on Drupal 8 Views

First, I'd like to start with my content structure:

Classrooms: Title Students_Attending [entity reference field with multiple values]  Students: Name Gender Country Classes Avatar 

Ok now, let's say I have a View that essentially lists Students. It has exposed fields for gender, country, and classes. You can use these to narrow down the subset of students listed by the view.

I want to add another exposed filter to this view. This filter will be a select box with a list of Classrooms, and you are able to select multiple classrooms. What this does in practice is that it limits the resulting subset list of Students to those that are referenced by the "Students_Attending" entity reference field of the "Classroom(s)" that was/were selected. So if I select "Classroom 1" on the exposed filter, the View will only list students who are referenced by the "Students_Attending" field of "Classroom 1."

How do I achieve this with Views on Drupal 8? Is it even possible with Views alone?

Replay

Category: views Time: 2016-07-28 Views: 0
Tags: views entities

Related post

  • How do I use a referenced entity in a Views contextual filter? 2015-09-23

    I'm building a media server for my university. I have an "artist" content type for each performer, and then a 'track' content type for individual track (there are no 'albums', BTW). For each track, you can select the artist in edit mode, using a

  • Use a form to filter table data in a module 2012-06-09

    I have made a module in Drupal 6 that builds a page that shows some data taken from an external database. I want to add a form that let the user filter the data (for example, limit the data output to a specific city instead all the cities). How can I

  • Displaying image from referenced entity in a view 2015-07-23

    I am trying to create an image albums with the biblio content. These are the steps I have taken: On the Biblio content type, I added a new field called Image of type Image Created a new content called Album. Added one field of type Entity reference;

  • Use a form instead of content type in maestro drupal module 2015-04-01

    I am working on maestro module of Drupal 7, the module uses content type to add the form fields ,but instead of content type i want to use simple form which i have created using php , can anyone please help me , it is very urgent. Thanks a lot in adv

  • Unable to Search Table Containing Webform Submissions Using Exposed Combined Fields Filter 2015-01-16

    I'm trying to add a Combined Fields Filter that users can come to my site and use to search through a Table View that is populated by user-created Webform submissions. Unfortunately, when I create said filter, it never returns any results. Below are

  • Using Symfony forms without a database entity 2016-07-23

    I've been developing an application based on Symfony 3, and part of that application involves an import process where a user can upload csv files. One thing that I've never been too sure about with symfony is using the forms component without a datab

  • How to theme the views exposed form? 2011-04-29

    I've created a view with a number of exposed filters, but it is pretty ugly looking. I'd like to improve the theming, including wrapping the whole thing in a fieldset as well as grouping some of the other elements (like pairing the published and upda

  • Getting the exposed form to show up 2013-09-26

    I'm trying to get the exposed form to show up for one of my views, but it doesn't seem to be working. I've got filters exposed in the "Filter Criteria" section, the "Exposed Form In Block" section is set to "Yes", and the blo

  • Expose table in Drupal View 2012-03-05

    How can I expose a table with out primary key in Drupal view 3 I have table st as uid, gid, percentage. attendance_views_data() { $data['attendance_percentage']['table']['group'] = t('Attendance'); $data['attendance_percentage']['percentage'] = array

  • Referenced Entity as an Exposed Filter 2013-08-01

    I have 2 Content Types : Activity and Event For each of Event node, there will be an Entity Reference field which References Activity Node. Example: Event: Title:Hiking in Utah Activity: Hiking (Entity reference field referencing Activity node hiking

  • How can I print Views Exposed Filter widgets individually using views-exposed-form--mypage.tpl.php? 2012-04-04

    I have five exposed filter widgets that appear on this page. I would like to group three of them together and add a title above that group of three so that my layout goes from: views default A B C D E what I want A TITLE B C D E Since this customizat

  • How to use Exposed Filter criteria form for Advanced forum 2014-07-21

    I'm trying to modify my Advanced forum topic list Master view to have an exposed filter so that my users can search for topics. However, after even a clean install with simplytest.me gives me the same problem: while entering a search query into the e

  • Using a taxonomy select field as a contextual filter for an Entity Reference View powered select box 2012-08-30

    I've got a parent child relationship between two content types: Properties and Parks. They are organized into a taxonomy we'll call Market. When creating a Park you select the Market it belongs to. Then creating a Property (which is child to a Park)

  • Views Exposed Filter Sort on Entity based on Term Reference Field from Entity Reference Relationship 2014-07-11

    I've been playing around with Views exposed filters on an entity. I have so far been able to create a relationship to another entity through an Entity Reference, and exposed the fields belonging to that entity. What I needed to sort my entity by was

  • How to change the view for a "Views: Filter by an entity reference view"-mode entity reference field on the node/add or edit form? 2016-07-12

    I have 2 content types: registration (R) and class (C). R has an entity reference field which is referencing to C using the "Views: Filter by an entity reference view" mode. The entity reference field must use the select list widget. User accoun

  • How to override the widget of an exposed form filter? 2013-02-13

    I have a view with a single filter criteria (let's call it category) exposed to the user. The user can also select multiple categories in for this view (standard view stuff). The category selection filter is rendered to the user in a big <select> fo

  • Override Views Contextual Filter in View Exposed Form Validation 2013-03-20

    I'm using the Content:Nid contextual filter in my view (with exposed filters) and would like to dynamically set the value of this contextual filter from the exposed form validation callback. Is this possible? --------------Solutions------------- Cont

  • How to embed "Exposed form in block" into top bar? Using foundation theme 2013-12-12

    I have a product search view. I use the "exposed form in block" in order to have only the filters show on all pages and the results show on a separate page. I want to put my filters in the top bar. How would I embed the "exposed form in blo

  • Exposed form for contextual filters when using non-taxonomy filters? 2014-09-28

    I have a View with some contextual filters which works great. I also need to provide my users with some way to change the filters once they're on the page. I've tried using exposed filters but I'd rather use path arguments over query string parameter

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 1.629 (s). 13 q(s)