定制 jorisnoo/craft-sidebar-relations 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jorisnoo/craft-sidebar-relations

Composer 安装命令:

composer require jorisnoo/craft-sidebar-relations

包简介

Adds nested element sources to the Craft CMS sidebar based on entry relations

README 文档

README

A Craft CMS module that adds nested element sources to the control panel sidebar based on entry relations. Filter a section's entries by their related entries from another section, directly from the sidebar navigation.

Features

  • Adds nested sources under any section in the entries sidebar
  • Filter entries by their relations to entries in another section
  • Supports custom query conditions on the relation source
  • Config-based setup with a fluent API

Requirements

  • PHP 8.2+
  • Craft CMS 5

Installation

composer require jorisnoo/craft-sidebar-relations

Then register the module in your config/app.php:

return [
    'modules' => [
        'sidebar-relations' => \Noo\CraftSidebarRelations\SidebarRelations::class,
    ],
    'bootstrap' => ['sidebar-relations'],
];

Configuration

Create a config/sidebar-relations.php file in your Craft project:

use Noo\CraftSidebarRelations\config\SidebarRelationsConfig;

return SidebarRelationsConfig::create()
    ->sources([
        [
            'section' => 'articles',
            'relation' => 'categories',
        ],
        [
            'section' => 'projects',
            'relation' => 'clients',
            'where' => [
                'level' => 1,
            ],
        ],
    ]);

Source Options

Each source in the array accepts the following keys:

  • section — The handle of the section to add nested sources to
  • relation — The handle of the section whose entries will become the nested source items
  • where — (optional) Additional query parameters applied to the relation query (e.g. level, status, orderBy)

In the example above, the "Articles" section in the sidebar would get nested items for each entry in the "Categories" section. Clicking a nested item filters the article list to only show articles related to that category.

License

The MIT License (MIT). Please see LICENSE for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固