cambis/silverstripe-classnames
最新稳定版本:v0.1.1
Composer 安装命令:
composer require cambis/silverstripe-classnames
包简介
Classnames package for Silverstripe.
关键字:
README 文档
README
This package is a Silverstripe port of php-classnames.
Getting started
Install the package via composer.
composer require cambis/silverstripe-classnames
Usage
This package provides the $Cn method for use Silverstripe templates.
Arguments must be parsed as a JSON encoded array.
One way to accomplish this is to create a function that returns the appropriate encoded values,
i.e. getClassnames().
<?php use JsonSerializable; use SilverStripe\ORM\DataObject; class MyObject extends DataObject implements JsonSerializable { public function getClassnames(): string { return json_encode($this); } public function jsonSerialize(): mixed { return [ ['foo' => true], 'bar', ]; } }
Then call the function in your template file.
<!-- MyObject.ss --> <p class="{$Cn($Classnames)}">Classnames</p>
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-16