flsouto/httextar
Composer 安装命令:
composer require flsouto/httextar
包简介
Creates textarea fields
README 文档
README
Produces Textareas. This is an extension of the HtTextin class.
Installation
Run composer:
composer require flsouto/httextar
Usage
By default, the textar widget is rendered in writable mode. See example:
<?php use FlSouto\HtTextar; require_once('vendor/autoload.php'); $field = new HtTextar('description'); $field->context(['description'=>'This is a very long description']); echo $field;
Outputs:
<div class="widget 589f96dbdf794" style="display:block"> <textarea name="description" cols="40" rows="4">This is a very long description</textarea> <div style="color:yellow;background:red" class="error"> </div> </div>
Switch to Readonly
Use the readonly method to switch to readonly mode:
use FlSouto\HtTextar; require_once('vendor/autoload.php'); $field = new HtTextar('description'); $field->readonly(); $field->context(['description'=>'This is a very long description']); echo $field;
Outputs:
<div class="widget 589f96dbe11ec" style="display:block"> <textarea name="description" cols="40" rows="4" readonly="readonly">This is a very long description</textarea> <div style="color:yellow;background:red" class="error"> </div> </div>
Setting dimensions of textarea
You can set the cols and rows attributes by using the respective methods:
use FlSouto\HtTextar; $field = new HtTextar('description'); $field->cols(80)->rows(10); echo $field;
Outputs:
<div class="widget 589f96dbe171b" style="display:block"> <textarea name="description" cols="80" rows="10"></textarea> <div style="color:yellow;background:red" class="error"> </div> </div>
Notice: this is only a shortcut to calling $field->attrs(['cols'=>80,'rows'=>10])
Alternative syntax for setting dimensions
You can use the size method passing a string in the format "COLSxROWS" to set both dimensions in one go:
$field = new HtTextar('description'); $field->size('80x10'); echo $field;
Output:
<div class="widget 589f96dbe1c28" style="display:block"> <textarea name="description" cols="80" rows="10"></textarea> <div style="color:yellow;background:red" class="error"> </div> </div>
To learn more about everything you can do with this widget, please refer to the following documentations:
统计信息
- 总下载量: 57
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2017-02-11