定制 korcontrol/craft-classy 二次开发

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

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

korcontrol/craft-classy

最新稳定版本:3.0.0-rc1

Composer 安装命令:

composer require korcontrol/craft-classy

包简介

Twig helpers inspired by https://github.com/JedWatson/classnames

关键字:

README 文档

README

Twig helpers inspired by https://github.com/JedWatson/classnames

Usage

Filter

{% apply class( "add-this-initially", { "add-this": true, "remove-this": false, "neither-add-nor-remove": null, "add-or-remove": ifthis and ifthat, "add-but-dont-remove": condition ? true : null, "remove-but-dont-add": not condition ? false : null, }, "add-this-regardless-of-above", ) %} <mytag class="existing classes"> ... </mytag> {% endapply %}

Function

<mytag class="{{ class("yup yes", { "maybe": ifthis and ifthat }) }}">

Which depending on the conditions ifthis and ifthat will give

<mytag class="yup yes maybe"> or <mytag class="yup yes">

Each argument can be either a string or a map.

A string argument will be treated as a class name (or multiple space-separated class names) to add.

An array argument is a map of class names to statuses.

Its keys are single class names or groups of space-seprated classes. The corresponding values can be

  • strictly true to add the class or classes
  • strictly false to remove the class or classes
  • null or anything else to leave them alone

Any existing classes which aren't mentioned in any of these arguments are left alone.

Arguments are processed in order.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固