bogdancondorachi/kirby-table-field
Composer 安装命令:
composer require bogdancondorachi/kirby-table-field
包简介
Table field plugin for Kirby CMS
README 文档
README
Note
This flexible yet powerful panel field is designed to effortlessly manage and display large datasets. It enables users to dynamically add, edit, and organize data in rows and columns, offering intuitive controls for adding, removing, duplicating, and rearranging entries. Ideal for handling complex data structures while ensuring a clean and user-friendly interface.
Installation
Composer
composer require bogdancondorachi/kirby-table-field
Git Submodule
git submodule add https://github.com/bogdancondorachi/kirby-table-field.git site/plugins/table-field
Manual
Download and extract the folder to /site/plugins/table-field
Field Usage
Add the field to your blueprint:
fields: table: label: Table type: table # optional (see field properties)
Field Properties:
| Name | Type | Default | Description |
|---|---|---|---|
| align | string |
- |
Set the text alignment of the table |
| disabled | bool |
- |
If true, the field is no longer editable and will not be saved |
| duplicate | bool |
true |
Toggles duplicating columns and rows in the table |
| empty | string |
- |
The placeholder text if no rows exists |
| help | string |
- |
Optional help text below the field |
| index | int, bool |
1 |
Specifies the starting index. If set to false, it removes the index column; in this case, sortable would be disabled as well |
| label | string |
- |
Set the label above the field |
| marks | bool, array |
true |
Set the allowed HTML formats. Activate/deactivate them all by passing true/false |
| maxColumns | int |
8 |
Set the maximum allowed columns in the table |
| minColumns | int |
2 |
Set the minimum required columns in the table |
| sortable | bool |
true |
Toggles drag & drop sorting |
| translate | bool |
true |
If false, the field will be disabled in non-default languages and cannot be translated. This is only relevant in multi-language setups. |
Use the field in your template:
<?php $table = $page->table()->toTable(); if (!empty($table['headers']) && !empty($table['rows'])): ?> <table> <thead> <tr> <?php foreach ($table['headers'] as $header): ?> <th><?= $header ?></th> <?php endforeach ?> </tr> </thead> <tbody> <?php foreach ($table['rows'] as $row): ?> <tr> <?php foreach ($row as $cell): ?> <td><?= $cell ?></td> <?php endforeach ?> </tr> <?php endforeach ?> </tbody> </table> <?php endif ?>
Blocks Usage
Add the block to your blueprint:
fields: text: type: blocks fieldsets: - table
Overwrite default blueprint:
name: Table icon: table preview: dataTable fields: table: type: table caption: type: writer icon: text inline: true
To overwrite the default blueprint, place your custom file in /site/blueprints/blocks/table.yml
Snippet:
<?php $table = $block->table()->toTable(); if (!empty($table['headers']) && !empty($table['rows'])): ?> <table> <thead> <tr> <?php foreach ($table['headers'] as $header): ?> <th><?= $header ?></th> <?php endforeach ?> </tr> </thead> <tbody> <?php foreach ($table['rows'] as $row): ?> <tr> <?php foreach ($row as $cell): ?> <td><?= $cell ?></td> <?php endforeach ?> </tr> <?php endforeach ?> </tbody> </table> <?php endif ?>
To overwrite this default snippet, place your custom file in /site/snippets/blocks/table.php
Buy me a coffee ☕
Note
This plugin is provided free of charge & published under the permissive MIT License. If you're using it for a commercial project or just want to help keep it alive, please consider donating. Your support fuels future development!
License
MIT License Copyright © 2024 Bogdan Condorachi
bogdancondorachi/kirby-table-field 适用场景与选型建议
bogdancondorachi/kirby-table-field 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 21.48k 次下载、GitHub Stars 达 53, 最近一次更新时间为 2024 年 01 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bogdancondorachi/kirby-table-field 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bogdancondorachi/kirby-table-field 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 21.48k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 53
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-03
