otago/tiles
Composer 安装命令:
composer require otago/tiles
包简介
Tile CMS field
README 文档
README
Allows you to create an elemental grid inside SilverStripe. Features include:
- drag & reorder them inside the CMS
- easily create your own tiles
- delete and edit tiles easily
It also comes with some basic tiles out of the box.
Install
Run this in your command line:
composer require otago/tiles
To expose the modules resouces:
composer vendor-expose
The module requires elemental blocks. If you don't have this module, you'll be prompted on install.
Customise your tiles
Put your own templates in your themes/<themename>/templates/Tiles/tilename.ss. For example, to make your own ContentTile in the simple theme, create a file in themes/simple/templates/Tiles/ContentTile.ss
<div class="tile"> <div class="tile__$CSSName tile__size$getSize <% if $Color %>$Color<% end_if %>"> $Content </div> </div>
If you want to support MSIE, you can use the -ms-grid-row and -ms-grid-column CSS values with $Col and $Row to have the grid display correctly.
Build source
You'll need node 6. Boo.
npm run watch
to get env vars on windows:
npm install -g win-node-env
This module uses fancy and modern react for rendering. So you know it's fast and snappy.
Usage
After a composer install you'll have the tile module as an element. So you don't need to do anything (unless you've restricted the elements on each page).
If you want to put tilefield directly on a page, you can do this too. The following example shows you how:
use OP\Fields\TileField; class MyPage extends Page { static $has_many = [ 'Tiles' => Models\Tile::class ]; function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab('Root.Main', TileField::create('Tiles', 'Tiles')); return $fields; } }
Allowing the user to specify how many columns they want
You can provide an DataObject where the Cols val will be written to. so you can have 3,2 or however many cols you want wide:
use OP\Fields\TileField; class MyTilePage extends Page { private static $db = [ 'Cols' => 'Int' ]; private static $has_many = [ 'Tiles' => Tile::class ]; private static $owns = [ 'Tiles' ]; public function getCMSFields() { $fields = parent::getCMSFields(); $tilefield = TileField::create('Tiles', 'Tiles', $this->Tiles(), null, $this // this var requires a db object Cols to remember how many cols it is wide ); $fields->addFieldToTab('Root.Main', $tilefield); return $fields; } }
Specifying types of tiles in field
You can limit the CMS dropdown to a limited number of tiles. This is handy when you've have a page where you only want a certain type of tile. This is done by passing in the $dataList parameter:
$tile = DataObject::create(array('Name'=>'StaffHubResourceTile', 'NiceName' => StaffHubResourceTile::functionGetNiceName())); $fields->addFieldToTab('Root.Main', TileField::create('Tiles', 'Tiles', ArrayList::create(array($tile))));
upgrading
Here's the modulelegacy.yml file to convert your tiles from SS 3 to 4:
--- Name: mymodulelegacy --- SilverStripe\ORM\DatabaseAdmin: classname_value_remapping: GalleryTile: OP\Models\GalleryTile ContentTile: OP\Models\ContentTile LinkTile: OP\Models\LinkTile AnnouncementTile: OP\Models\AnnouncementTile PhotoTile: OP\Models\PhotoTile Slide: OP\Models\Slide
otago/tiles 适用场景与选型建议
otago/tiles 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.17k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2016 年 11 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「silverstripe」 「tiles」 「CMS Field」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 otago/tiles 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 otago/tiles 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 otago/tiles 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
Object-oriented image handling and manipulation library
Analytics chooser extensions for site settings.
统计信息
- 总下载量: 7.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2016-11-21
