scottboms/events-field
Composer 安装命令:
composer require scottboms/events-field
包简介
Events Field plugin for Kirby
README 文档
README
Adds a customizable Event Field Type for Kirby.
Installation
Kirby CLI
kirby plugin:install scottboms/kirby-events-field
Git submodule
git submodule add https://github.com/scottboms/kirby-events-field.git site/plugins/kirby-events
Copy and Paste
- Download the contents of this repository as Zip file.
- Rename the extracted folder to
kirby-eventsand copy it into thesite/plugins/directory in your Kirby project.
Usage
Blueprint Configuration
In a Page blueprint, add a new field with the type event. Standard field attributes such as label, required, help, etc. can also be used to override defaults. Use empty to change the text displayed when the field is in an empty state.
Field Properties
| Name | Type | Default | Description |
|---|---|---|---|
| empty | string | null |
The placeholder text if no information has been added |
| preview | array | [ ] |
Optional array of field names to display in the preview |
| eventName | boolean | true |
If true, the field is available in the form |
| endDate | boolean | true |
If true, the field is available in the form |
| timeStart | boolean | true |
If true, the field is available in the form |
| timeEnd | boolean | true |
If true, the field is available in the form |
| city | boolean | true |
If true, the field is available in the form |
| state | boolean | true |
If true, the field is available in the form |
| country | boolean | true |
If true, the field is available in the form |
| venue | boolean | true |
If true, the field is available in the form |
| url | boolean | true |
If true, the field is available in the form |
| details | boolean | true |
If true, the field is available in the form |
event: # standard properties from Kirby label: Example Event required: false width: 1/3 # field properties type: event empty: 'Add an event' # optional field properties eventName: true endDate: true timeStart: true timeEnd: true venue: true city: true state: true country: true url: true details: true # preview table display # list of available field names preview: - eventName - startDate - endDate - timeStart - timeEnd - eventDates # summary of startDate, endDate - eventTime # summary of timeStart, timeEnd - city - state - country - location # summary of city, state, country - venue - url - details
Templates and Snippets
To access an event field in your templates, you can use the toEvent() method.
<?php if ($event = $page->event()->toEvent()): ?> <h1><a href="<?= $event->url() ?>"><?= $event->eventName() ?></a></h1> <div class="dates"> <span class="start"><?= $event->startDate()->toDate('M d, Y') ?></span> – <span class="end"><?= $event->endDate()->toDate('M d, Y') ?></span>, daily from <span class="start"><?= $event->timeStart()->toDate('g:i a') ?></span> – <span class="end"><?= $event->timeEnd()->toDate('g:i a') ?></span> </div> <div class="location"> <div class="venue"><?= $event->venue() ?></div> <span class="city"><?= $event->city() ?></span>, <span class="state"><?= $event->state() ?></span> <span class="country"><?= $event->country() ?></span> </div> <div class="details"><?= $event->details() ?></div> <?php endif ?>
Field Methods
Special Field Methods have been included to provide additional utility when utilizing the field. These include a toEvent() wrapper which behaves similarly to Kirby's native toStructure() method. Additionally, a daysUntil() method allows you to provide a simple countdown based on the field's startDate value.
<?php if ($days = $page->sxsw()->daysUntil()): ?> <?php if ($days > 0): ?> <p>Event starts in <?= $days ?> days</p> <?php elseif ($days === 0): ?> <p>Event starts today!</p> <?php else: ?> <p>Started <?= abs($days) ?> days ago</p> <?php endif ?> <?php endif ?>
Compatibility
- Kirby 4.x
- Kirby 5.x
Disclaimer
This plugin is provided "as is" with no guarantee. Use it at your own risk and always test before using it in a production environment. If you identify an issue, typo, etc, please create a new issue so I can investigate.
License
scottboms/events-field 适用场景与选型建议
scottboms/events-field 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 08 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「events」 「fields」 「kirby」 「kirby-plugin」 「kirby-cms」 「kirby4」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 scottboms/events-field 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 scottboms/events-field 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 scottboms/events-field 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Библиотека для реализаций паттерна Pub/Sub
Wireless Cross-Component Communication
A powerful event calendar Tool for Laravel's Nova 5.
Zero-dependency global `kirbylog()` helper for any content
Courier offers a convenient and painless solution for creating emails tailored for your Kirby website.
Register advanced custom fields with object oriented PHP
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-31
