atk14/range-field
Composer 安装命令:
composer require atk14/range-field
包简介
RangeField is a form field for entering numeric range from and to in ATK14 applications
README 文档
README
RangeField is a field for entering two numeric values within specified minimum and maximum.
In eshops, this is an useful field, for example, for setting the price range for product selection.
Usage
<?php
// file: app/forms/products/index_form.php
class IndexForm extends ApplicatonForm {
function set_up(){
$this->add_field("search", new CharField([
"label" => "Search",
"required" => false,
]));
$this->add_field("price", new RangeField([
"label" => "Price range",
"min_value" => 1,
"max_value" => 100000,
"required" => false,
]));
}
}
<?php
// file: app/controllers/products_controller.php
class ProductsController extends ApplicationController {
function index(){
$d = $this->form->validate($this->params);
$min = $d["price"]["min"];
$max = $d["price"]["max"];
// ..
}
}
Installation
Just use the Composer:
cd path/to/your/atk14/project/
composer require atk14/range-field
Optionally you can symlink RangeField files into your project:
ln -s ../../vendor/atk14/range-field/src/app/fields/range_field.php app/fields/range_field.php
ln -s ../../vendor/atk14/range-field/src/app/widgets/range_input.php app/widgets/range_input.php
Testing
composer update --dev
cd test
../vendor/bin/run_unit_tests
License
RangeField is free software distributed under the terms of the MIT license
统计信息
- 总下载量: 15.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-27