getolympus / olympus-imageselect-control
Radio / Checkbox control with image, this component is a part of the Olympus Zeus Core framework.
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:olympus-control
Requires (Dev)
- phpunit/phpunit: ~5.3
This package is auto-updated.
Last update: 2024-10-20 07:31:48 UTC
README
Image Select Control
This component is a part of the Olympus Zeus Core WordPress framework.
Installation
Using composer
in your PHP project:
composer require getolympus/olympus-imageselect-control
Control initialization
Use the following lines to add a image select control
in your WordPress customizer:
$wp_customize->add_setting('my_imageselect_control_id',[ 'default' => 'dave', 'transport' => 'refresh', 'sanitize_callback' => 'custom_text_sanitization' ]); $wp_customize->add_control(new ImageSelect($wp_customize, 'my_imageselect_control_id', [ 'label' => 'Select a Minion that you may know', 'description' => 'A very important question! Pay attention to it ;)', 'column' => 2, 'multiple' => false, 'section' => 'my_custom_controls_section', 'choices' => [ 'kevin' => [ 'label' => 'Kevin', 'image' => 'https://vignette.wikia.nocookie.net/despicableme/images/1/1d/Kevin_minions.png/revision/latest/scale-to-width-down/350?cb=20170703052012', ], 'mel' => [ 'label' => 'Mel', 'image' => 'https://vignette.wikia.nocookie.net/despicableme/images/2/2e/Mel_Minion_01.png/revision/latest/scale-to-width-down/350?cb=20160717135212', ], 'dave' => [ 'label' => 'Dave', 'image' => 'https://vignette.wikia.nocookie.net/despicableme/images/7/71/Daveholdingcupcake.png/revision/latest/scale-to-width-down/350?cb=20130717145735', ], 'bob' => [ 'label' => 'Bob', 'image' => 'https://vignette.wikia.nocookie.net/despicableme/images/c/ca/Bob-from-the-minions-movie.jpg/revision/latest/scale-to-width-down/350?cb=20151224154354', ], ], ]));
How-to
Variables definition
The variables definition depends on multiple
value:
- set to
false
, a uniq string value is stored in Database - set to
true
, an array of key values is stored in Database
Usages
add_control($id, $args);
Parameters
$args
arguments
The choices
argument is an associative array containing a list of keys.
Each key is associated to an array, composed by:
label
(required). Name of the choiceimage
(required). URL of the image
Release History
- 0.0.2
- ADD: new column and multiple attributes
- 0.0.1
- INITIAL RELEASE
Authors and Copyright
Please, read LICENSE for more information.
https://github.com/crewstyle
https://fr.linkedin.com/in/achrafchouk
Contributing
- Fork it (https://github.com/GetOlympus/olympus-imageselect-control/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request
Built with ♥ by Achraf Chouk ~ (c) since a long time.