visionbites/usage-reference
Composer 安装命令:
composer require visionbites/usage-reference
包简介
Show references to a page or file on the objects blueprint.
README 文档
README
Infosection to display all references to a page or image in a list.
Install
Download Zip file
Copy plugin folder into site/plugins
Git submodule
git submodule add https://github.com/visionbites/kirby-usage-reference.git site/plugins/usage-reference
Composer
composer require visionbites/usage-reference
Usage
Add a section usageReference to your blueprint to show references to the current page.
Add a template key to define the type of pages you are looking for.
Example
Basic setup:
sections: references: headline: References to this page type: usageReference template: template-name
Setup for files:
sections: file_data: type: fields fields: title: type: text label: Title alt: type: text label: Alternative title caption: type: textarea label: Image caption references: headline: References to this file type: usageReference
Options
there are only two options at the moment:
| Option | Default | Description |
|---|---|---|
expire |
15 |
the cache will expire after n minutes. Minimum is 1 as a indefinite cache makes no sense |
cache |
true |
if set to false will disable the caching of references |
set the options in config.php:
return [ 'visionbites.usage-reference' => [ 'expire' => 15 // in minutes 'cache' => true ], ];
please keep in mind that this might lead to showing out of date data to the editor if there was another reference added.
Usage in plugins, models and other places
you can use the ReferenceService that is provided in other places to access the data that is presented in the panel.
E.g. if you have events attached to a place that are not children of the place itself you can
have a events() method in the PlacePage model:
public function events() { $refService = new ReferenceService(); // pass the uuid of the place and the template that you are looking for $events = $refService->findReferencesForUuid($this->uuid()->toString(), 'event'); // depending on what you want to do with the events you can either return them here or // resolve the pages and return a pages collection $eventsPages = new Pages(); foreach ($events as $event) { $eventPage = $this->kirby()->page($event['uuid']); $eventsPages->append($eventPage); } return $eventsPages; }
todos
- clear cache for a page on update of a referencing page
- make it pick up on text links
License
It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia animal abuse, violence or any other form of hate speech.
visionbites/usage-reference 适用场景与选型建议
visionbites/usage-reference 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.92k 次下载、GitHub Stars 达 26, 最近一次更新时间为 2023 年 07 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「kirby」 「kirby-plugin」 「kirby-cms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 visionbites/usage-reference 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 visionbites/usage-reference 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 visionbites/usage-reference 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Kirby 5 field for hierarchical menus with drag & drop level indentation.
Zero-dependency global `kirbylog()` helper for any content
Courier offers a convenient and painless solution for creating emails tailored for your Kirby website.
Plausible integration for Kirby CMS
Kirby Admin Bar
Kirby panel buttons field to open or trigger URL or a webhook
统计信息
- 总下载量: 7.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 26
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-10
