as-cornell/as_entity_list

Lists of people, articles or taxonomy term with selectors for number of items, tag filter, view mode.

Maintainers

Package info

github.com/as-cornell/as_entity_list

Homepage

Type:drupal-custom-module

pkg:composer/as-cornell/as_entity_list

Statistics

Installs: 1 005

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v2.0.2 2026-03-11 18:09 UTC

This package is auto-updated.

Last update: 2026-03-11 18:17:52 UTC


README

Latest Stable Version

AS ENTITY LIST (as_entity_list)

INTRODUCTION

Lists of people, articles or taxonomy term with selectors for number of items, tag filter, view mode. Returns entities as a list via a twig filter for inclusion in twig templates using twig tweak.

MAINTAINERS

Current maintainers for Drupal 10:

  • Mark Wilson (markewilson)

ARCHITECTURE

This module uses a service-oriented architecture with three query service classes and a Twig extension for template integration.

Service Classes

All entity query logic is organized into service classes under src/Service/:

ArticleQueryService (as_entity_list.article_query)

  • getArticles($count, $tags) - Get articles filtered by tags
  • getArticlesFiltered($count, $tags) - Advanced filtering with operator, sort options
  • getArticlesFooter($count, $nid) - Get articles excluding current NID (for footer display)
  • getArticlesPerson($count, $nid) - Get articles related to person (field_related_people)
  • getArticlesPersonAs($count, $nid) - Get articles related to person (field_related_people_nodes)
  • getArticlesDepartment($count, $tags) - Get articles filtered by department/program

PersonQueryService (as_entity_list.person_query)

  • getPeople($count, $tags) - Get people sorted alphabetically by last name
  • getPeopleDepartment($count, $tags) - Get people filtered by department with advanced options
  • getPeopleResearch($count, $tags) - Get people filtered by research area

TermQueryService (as_entity_list.term_query)

  • getTerms($type, $count) - Get terms from a vocabulary
  • getTermsFiltered($type, $count, $tags) - Advanced term filtering for DPC/MMG lists

Twig Extension

buildEntityList (as_entity_list.buildEntityList)

Extends Twig with the build_entity_list() function for use in templates:

{{ build_entity_list(type, count, tags, nid) }}

Supported Types:

  • article - Articles filtered by tags
  • article_as - Articles with advanced filtering
  • article_footer - Articles for footer (excludes current)
  • article_person - Articles by person (field_related_people)
  • article_person_as - Articles by person (field_related_people_nodes)
  • article_department - Articles by department/program
  • person - People alphabetically
  • person_department - People by department
  • person_research - People by research area
  • dpc_as - Department/Program/Center terms filtered
  • mmg_as - Major/Minor/Gradfield terms filtered
  • academic_interests - Academic interest terms
  • research_areas - Research area terms

Usage Example

{# Get 5 latest articles #}
{% set articles = build_entity_list('article', 5, null, null) %}

{# Get 10 people from a specific department #}
{% set department_tags = [{'termvariables': [...], 'operator': 'and', 'sort': 'alphabetical'}] %}
{% set people = build_entity_list('person_department', 10, department_tags, null) %}

{# Get related articles for footer (exclude current article) #}
{% set related = build_entity_list('article_footer', 3, null, node.id) %}