samsonos/cms_input
Composer 安装命令:
composer require samsonos/cms_input
包简介
SamsonCMS generic input field module
README 文档
README
#SamsonCMS input module
This is base module for all cms input modules.
Usage
There are two main static functions, this module have:
- create()
- createFromMetadata()
Function create($dbObject, $type, $param = null, $className = CLASS) This function create and retrieves SamsonCMS input instance based on given parameters. As you can see first two are required, these are \samson\activerecord\dbRecord instance or it's ancestor and SamsonCMS input field type, this parameter should be int. Here is this list:
| Field name | Field identifier |
|---|---|
| Text | 0 |
| Resource | 1 |
| Date | 2 |
| Select | 3 |
| Table (deprecated) | 4 |
| Material | 5 |
| Number | 6 |
| WYSIWYG | 7 |
| Gallery (separate module) | 8 |
The other parameters are not necessary. For example if you will not pass the $param to this function the ancestor class field will be used, and if it's not defined this class field will be used. The last parameter is for double or more nested classes. This functionality is not implemented yet.
Second function createFromMetadata($entity, $param, $identifier, $className = CLASS) is very similar to create() function except for first and third parameters, they are used to get \samson\activerecord\dbRecord instance.
Here are some examples how this functions can be used:
$input = Field::create($material, 7, 'remains'); ... $input = Field::createFromMetadata($_GET['e'], $_GET['f'], $_GET['i']);
Other methods
There are also value(), save($value) and convert($value) functions. The first one returns SamsonCMS module value field. Function convert() does nothing but can be overridden to convert value before save. Function save() inserts value in \samson\activerecord\dbRecord object field and writes this object to database.
Be care not to be confused with __save() controller.
As this class is module it has __save() controller which can be called, for example, by URL '...samson_cms_input/save'. As you know each SamsonCMS module has it's id and 'samson_cms_input' can be replaced by it to perform ancestor controller.
This class implements \samson\core\iModuleViewable interface and should implement toView() function. Default there is default implementation in this module but it can be overridden in ancestor classes.
samsonos/cms_input 适用场景与选型建议
samsonos/cms_input 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.66k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2014 年 10 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 samsonos/cms_input 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 samsonos/cms_input 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 14
- 依赖项目数: 17
- 推荐数: 0
其他信息
- 授权协议: Open
- 更新时间: 2014-10-27