定制 hananils/kirby-checkbox-field 二次开发

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

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

hananils/kirby-checkbox-field

最新稳定版本:1.0.0

Composer 安装命令:

composer require hananils/kirby-checkbox-field

包简介

Checkbox is a simple field that is a companion of the core toggle field. It offers a single checkbox with label and info text and can be used wherever a single option is required and the "on" and "off" metaphor of a toggle does not suit well.

README 文档

README

Kirby Checkbox Field

Checkbox is a simple field for Kirby that is a companion of the core toggle field. It offers a single checkbox with label and info text and can be used wherever a single option is required and the "on" and "off" metaphor of a toggle does not suit well.

Note

Please check out the online documentation at kirby.hananils.de/plugins/checkbox-field for further information.

Introduction

Toggles – like the core field – and checkboxes have a lot in common as they both allow users to change the state of a setting. The mental models behind both concepts are different though. While a toggle usually conveys an immediate action, switching a setting "on" or "off" like a lightbulb, ticking a checkbox does not imply an action but communicates consent or disconsent. "Do you agree to the terms of service?" Yes or no.

For all use cases where you don't want to toggle a switch but what to represent a content choice, this field is for you.

Tip

Do you think this should be a core field, too? Go and tell the Kirby team!

Example

The field setup is minimal:

checkbox:
  type: checkbox
  label: I like ticking boxes
  info: You can untick the box again later if you changed your mind.

Please note that the label for this field is not displayed above the field but beside the checkbox itself. The label thus represents the option the editor checks or unchecks.

Templating

Just like with the toggle field, a checkbox value can be converted to a proper boolean:

$bool = $page->checkbox()->toBool();

And the field methods isTrue and isFalse can be used to validate a setting and:

if ($page->checkbox()->isTrue()) {
  // do something
}

Installation

Download

Download and copy this repository to /site/plugins/checkbox-field.

Git submodule

git submodule add https://github.com/hananils/kirby-checkbox-field.git site/plugins/checkbox-field

Composer

composer require hananils/kirby-checkbox-field

License

This plugin is provided freely under the MIT license by hana+nils · Büro für Gestaltung.
We create visual designs for digital and analog media.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-25