Module 2.6 – Views

Views is one of the most heavily tested Site Building tools in the Acquia Drupal Developer exam.

Acquia uses Views questions to test:

  • Configuration vs custom code decision making
  • Understanding of Drupal data relationships
  • Ability to build listings without writing PHP

If Views can solve a requirement, writing custom code is usually the wrong answer.


What Views is in Drupal (simple definition)

Views is a query builder and display system.

In simple terms:

Views answers questions like:

  • Show a list of content
  • Filter content by some condition
  • Sort content
  • Display content in different formats

Views does this without writing SQL or PHP.


Mental model for recall (very important)

Think of Views as:

"Select data → filter it → sort it → display it"

This mental pipeline helps you decode most Views questions in the exam.


Where Views live in the UI (mental anchors)

  • Views list:
    /admin/structure/views
  • Create new View:
    /admin/structure/views/add

These are anchors only, not memorization targets.


Core parts of a View (plain language)

Every View has these parts:

  • Base table: what you are querying (for example Content)
  • Fields: what data is shown
  • Filters: which items are included
  • Sort criteria: order of results
  • Displays: how results are presented

If you understand these five things, you understand Views.


Displays (Page, Block, Feed, etc.)

A View can have multiple displays.

Common displays:

  • Page display (URL-based list)
  • Block display (reusable listing)
  • Feed display (RSS)

Same View, different outputs.


Filters (simple explanation)

Filters decide which items appear.

Examples:

  • Published content only
  • Content type = Article
  • Taxonomy term = Safety Topic

Filters narrow the dataset.


Exposed filters (what this really means)

An exposed filter is a filter that the user can control.

Example:

  • Filter by State
  • User selects State from dropdown

Simple meaning:
"Let the user filter the list"


Sort criteria

Sort criteria decide order.

Examples:

  • Newest first
  • Alphabetical order

Sorting happens after filtering.


Relationships (advanced but important)

Relationships allow Views to join related data.

Simple explanation:
"Look at related content"

Example:

  • Event references Organization
  • View of Events wants Organization name

Relationship connects Event to Organization.


Contextual filters (very common exam confusion)

Contextual filters filter content based on context, not user input.

Simple explanation:
"Filter based on where you are"

Examples:

  • Show articles by author when viewing author page
  • Show events for the current organization

Difference from exposed filters:

  • Exposed filter: user chooses
  • Contextual filter: page provides value

Arguments vs contextual filters (exam language)

Older Drupal terminology uses "arguments".

Modern Drupal uses:

  • Contextual filters

Acquia may use either term.


Fields vs rendered entity

Two common display styles:

  • Fields: select individual fields
  • Rendered entity: use view modes

Best practice:

  • Use rendered entity when possible
  • Reuse view modes

View modes inside Views

Views can render content using a view mode.

Example:

  • Teaser view mode
  • Card view mode

This avoids duplicating display logic.


Site Builder perspective

Site builders:

  • Build listings without code
  • Configure filters and displays
  • Empower editors

Views is a primary site building tool.


Frontend developer perspective

Frontend developers:

  • Theme Views output
  • Style fields or view modes
  • Avoid logic in Twig

Views integrates cleanly with theming.


Backend developer perspective

Backend developers:

  • Avoid custom queries when Views works
  • Extend Views only when necessary
  • Respect Views caching

Custom SQL is rarely correct in exam scenarios.


Architect perspective

Architects evaluate:

  • Performance
  • Reuse across displays
  • Caching behavior

One well-designed View can power many features.


Performance and caching (exam signals)

Views integrates with Drupal caching.

Performance improves when:

  • Filters are specific
  • Relationships are limited
  • Caching is enabled

Exam signal:
If performance is mentioned, prefer Views over custom queries.


Common exam traps in Module 2.6

  • Writing custom SQL instead of Views
  • Using exposed filters when contextual filters are needed
  • Duplicating Views for minor differences
  • Ignoring view modes

Correct answers favor reuse and configuration.


Real scenario walkthrough

Scenario:
A page shows Events for the current Organization page.

Correct solution:

  • View of Events
  • Contextual filter: Organization reference

Incorrect solution:

  • Custom controller query

Key exam takeaways

  • Views replace most custom queries
  • Filters limit results
  • Contextual filters use page context
  • Exposed filters use user input
  • View modes reduce duplication

Practice check

  • Listing content without code: Views
  • User-controlled filter: exposed filter
  • Page-based filter: contextual filter
  • Joining related data: relationship