as-cornell/as_entity_list 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

as-cornell/as_entity_list

Composer 安装命令:

composer require as-cornell/as_entity_list

包简介

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

README 文档

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_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) %}

统计信息

  • 总下载量: 1.21k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2024-10-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固