getolympus / olympus-textarea-field
v0.0.18
2023-12-20 22:17 UTC
Requires (Dev)
- phpunit/phpunit: ~5.3
README
狄俄尼索斯文本区域字段
此组件是针对WordPress的Olympus Dionysos字段的一部分。
在文本区域中添加计数器JS组件。
composer require getolympus/olympus-dionysos-field-textarea
目录
字段初始化 • 变量定义 • 文本定义 • 获取数据 • 发布历史 • 贡献
字段初始化
使用以下行在你的WordPress管理页面或自定义帖子类型元字段中添加textarea字段
return \GetOlympus\Dionysos\Field\Textarea::build('my_textarea_field_id', [ 'title' => 'How do Penguins drink their cola?', 'default' => 'On the rocks.', 'description' => 'A simple question to know if you will be able to survive to the Penguin domination.', 'counter' => true, 'placeholder' => 'Tell us how?', 'readonly' => false, 'rows' => 8, /** * Texts definition * @see the `Texts definition` section below */ 't_length_label' => 'characters.', ]);
变量定义
变量 | 类型 | 默认值 | 接受值 | 描述 |
---|---|---|---|---|
title |
String | 'Textarea' |
empty | |
default |
String | empty | empty | 如果没有找到,则设置默认值 |
description |
String | empty | empty | |
counter |
Boolean | true |
true 或false |
定义是否显示计数器小部件 |
placeholder |
String | empty | empty | 仅适用于default 模式 |
readonly |
Boolean | false |
true 或false |
定义是否允许修改 |
rows |
Integer | 8 |
> 1 |
文本定义
代码 | 默认值 | 定义 |
---|---|---|
t_length_label |
字符。 | 用于显示字符计数器为%d字符。 |
获取数据
使用简单的get_option('my_textarea_field_id', '')
从数据库中获取你的值(参见WordPress参考)
// Get textarea from Database $textarea = get_option('my_textarea_field_id', ''); // Display textarea in HTML tag echo '<pre>'.htmlspecialchars($textarea).'</pre>';
发布历史
版本 | 备注 |
---|---|
0.0.18 | 修复domReady上的jQuery集成 |
0.0.17 | 更改twig模板上的id |
0.0.16 | 从包中删除RTE模式 |
贡献
- 分支它(https://github.com/GetOlympus/olympus-dionysos-field-textarea/fork)
- 创建你的功能分支(
git checkout -b feature/fooBar
) - 提交你的更改(
git commit -am 'Add some fooBar'
) - 推送到分支(
git push origin feature/fooBar
) - 创建一个新的拉取请求
由Achraf Chouk倾情打造♥ ~ 版权所有,历史悠久。