getolympus/olympus-dionysos-field-textarea

Textarea field, this component is a part of the Olympus Dionysos fields.

Installs: 200

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:JavaScript

Type:olympus-field

v0.0.18 2023-12-20 22:17 UTC

README

Dionysos Textarea Field

Olympus Component CodeFactor Grade Packagist Version MIT

This component is a part of the Olympus Dionysos fields for WordPress.
Adds a counter JS component on textarea.

composer require getolympus/olympus-dionysos-field-textarea

Table of contents

Field initializationVariables definitionTexts definitionRetrive dataRelease HistoryContributing

Field initialization

Use the following lines to add a textarea field in your WordPress admin pages or custom post type meta fields:

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

Texts definition

Retrive data

Retrieve your value from Database with a simple get_option('my_textarea_field_id', '') (see WordPress reference):

// Get textarea from Database
$textarea = get_option('my_textarea_field_id', '');

// Display textarea in HTML tag
echo '<pre>'.htmlspecialchars($textarea).'</pre>';

Release History

Contributing

  1. Fork it (https://github.com/GetOlympus/olympus-dionysos-field-textarea/fork)
  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 ~ (c) since a long time.