https://github.com/getolympus/olympus-dionysos-field-textarea
Διώνυσος — Textarea / RTE field, this component is a part of the Olympus Dionysos fields for WordPress.
https://github.com/getolympus/olympus-dionysos-field-textarea
counter custom field framework jquery olympus-zeus php rte textarea textarea-field twig wordpress
Last synced: 23 days ago
JSON representation
Διώνυσος — Textarea / RTE field, this component is a part of the Olympus Dionysos fields for WordPress.
- Host: GitHub
- URL: https://github.com/getolympus/olympus-dionysos-field-textarea
- Owner: GetOlympus
- License: mit
- Created: 2016-04-29T15:33:38.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-12-20T22:19:42.000Z (over 1 year ago)
- Last Synced: 2025-02-15T02:22:01.531Z (3 months ago)
- Topics: counter, custom, field, framework, jquery, olympus-zeus, php, rte, textarea, textarea-field, twig, wordpress
- Language: JavaScript
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dionysos Textarea Field
[![Olympus Component][olympus-image]][olympus-url]
[![CodeFactor Grade][codefactor-image]][codefactor-url]
[![Packagist Version][packagist-image]][packagist-url]
[![MIT][license-image]][license-blob]> This component is a part of the **Olympus Dionysos fields** for **WordPress**.
> Adds a counter JS component on textarea.```sh
composer require getolympus/olympus-dionysos-field-textarea
```---
## Table of contents
[Field initialization](#field-initialization) • [Variables definition](#variables-definition) • [Texts definition](#texts-definition) • [Retrive data](#retrive-data) • [Release History](#release-history) • [Contributing](#contributing)
---
## Field initialization
Use the following lines to add a `textarea field` in your **WordPress** admin pages or custom post type meta fields:
```php
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.',
]);
```## Variables definitions
| Variable | Type | Default value | Accepted value | Description |
| :------------ | :------ | :------------ | :------------- | :---------- |
| `title` | String | `'Textarea'` | *empty* | |
| `default` | String | *empty* | *empty* | Sets default value if none found |
| `description` | String | *empty* | *empty* | |
| `counter` | Boolean | `true` | `true` or `false` | Defines whether or not to display the counter widget |
| `placeholder` | String | *empty* | *empty* | For `default` mode only |
| `readonly` | Boolean | `false` | `true` or `false` | Defines whether or not to allow modification |
| `rows` | Integer | `8` | `> 1` | |## Texts definition
| Code | Default value | Definition |
| :--- | :------------ | :--------- |
| `t_length_label` | characters. | Used to display characters counter as `%d characters.` |## Retrive data
Retrieve your value from Database with a simple `get_option('my_textarea_field_id', '')` (see [WordPress reference][getoption-url]):
```php
// Get textarea from Database
$textarea = get_option('my_textarea_field_id', '');// Display textarea in HTML tag
echo ''.htmlspecialchars($textarea).'';
```## Release History
| Version | Note |
| :------ | :--- |
| 0.0.18 | Fix jQuery integration on domReady |
| 0.0.17 | Change id on twig template |
| 0.0.16 | Remove RTE mode from package |## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b feature/fooBar`)
3. Commit your changes (`git commit -am 'Add some fooBar'`)
4. Push to the branch (`git push origin feature/fooBar`)
5. Create a new Pull Request---
**Built with ♥ by [Achraf Chouk](https://github.com/crewstyle "Achraf Chouk") ~ (c) since a long time.**
[olympus-image]: https://img.shields.io/badge/for-Olympus-44cc11.svg?style=flat-square
[olympus-url]: https://github.com/GetOlympus
[codefactor-image]: https://www.codefactor.io/repository/github/GetOlympus/olympus-dionysos-field-textarea/badge?style=flat-square
[codefactor-url]: https://www.codefactor.io/repository/github/getolympus/olympus-dionysos-field-textarea
[getoption-url]: https://developer.wordpress.org/reference/functions/get_option/
[license-blob]: https://github.com/GetOlympus/olympus-dionysos-field-textarea/blob/master/LICENSE
[license-image]: https://img.shields.io/badge/license-MIT_License-blue.svg?style=flat-square
[packagist-image]: https://img.shields.io/packagist/v/getolympus/olympus-dionysos-field-textarea.svg?style=flat-square
[packagist-url]: https://packagist.org/packages/getolympus/olympus-dionysos-field-textarea