Download the PHP package getolympus/olympus-upload-field without Composer
On this page you can find all versions of the php package getolympus/olympus-upload-field. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package olympus-upload-field
Dionysos Upload Field
This component is a part of the Olympus Dionysos fields for WordPress.
It uses the defaultwpMedia
WordPress javascript bundle to manage field.
Field initialization
Use the following lines to add a upload field
in your WordPress admin pages or custom post type meta fields:
Variables definition
Variable | Type | Default value if not set | Accepted values |
---|---|---|---|
title |
String | 'Upload' |
empty |
can_upload |
Boolean | false |
true or false |
default |
Array | empty | empty |
description |
String | empty | empty |
multiple |
Boolean | false |
true or false |
type |
String | 'image' |
default file mime types |
size |
String | 'thumbnail' |
image sizes from add_image_size() WordPress function |
Notes:
can_upload
value is defined thanks tocurrent_user_can('upload_files')
(see WordPress reference)- Set
multiple
totrue
to enable the "Add medias" button
Texts definition
Code | Default value | Definition |
---|---|---|
t_addblock_description |
Click on the "+" button to add a media. | Main helper to add a single item box |
t_addblocks_description |
Click on the "+" button to add medias. | Main helper to add multiple items boxes |
t_cannot_upload |
It seems you are not able to upload files. | Error displayed if user cannot upload files |
t_name_label |
Edit the legend | Name item's placeholder |
t_addblock_label |
Add | Used as an Add button area title |
t_editblock_label |
Edit | Used as an Edit button area title |
t_removeblock_label |
Remove | Used as a Remove button area title |
Retrive data
Retrieve your value from Database with a simple get_option('my_upload_field_id', [])
(see WordPress reference).
Below, a json_encode()
example to understand how data are stored in Database:
And below, a simple example to show how to iterate on the data array in PHP
:
Release History
0.0.16
- Remove useless admin scripts
0.0.15
- Display now compatible with new Zeus-Core version
0.0.14
- New Olympus components compatibility
- Change repository to be a part of Dionysos fields
Contributing
- Fork it (https://github.com/GetOlympus/olympus-dionysos-field-upload/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.