field-advanced-link.php
6 years ago
field-button.php
6 years ago
field-clone.php
6 years ago
field-column.php
6 years ago
field-dynamic-message.php
6 years ago
field-file.php
6 years ago
field-flexible-content.php
6 years ago
field-forms.php
6 years ago
field-group.php
6 years ago
field-hidden.php
6 years ago
field-image.php
6 years ago
field-post-statuses.php
6 years ago
field-post-types.php
6 years ago
field-recaptcha.php
6 years ago
field-repeater.php
6 years ago
field-select.php
6 years ago
field-slug.php
6 years ago
field-taxonomies.php
6 years ago
field-taxonomy-terms.php
6 years ago
field-textarea.php
6 years ago
field-user-roles.php
6 years ago
field-file.php
52 lines
| 1 | <?php |
| 2 | |
| 3 | if(!defined('ABSPATH')) |
| 4 | exit; |
| 5 | |
| 6 | add_filter('gettext', 'acfe_field_file_text', 99, 3); |
| 7 | function acfe_field_file_text($translated_text, $text, $domain){ |
| 8 | |
| 9 | if($domain !== 'acf') |
| 10 | return $translated_text; |
| 11 | |
| 12 | if($text === 'No file selected') |
| 13 | return ''; |
| 14 | |
| 15 | return $translated_text; |
| 16 | |
| 17 | } |
| 18 | |
| 19 | add_action('acf/render_field_settings/type=file', 'acfe_field_file_settings', 0); |
| 20 | function acfe_field_file_settings($field){ |
| 21 | |
| 22 | acf_render_field_setting($field, array( |
| 23 | 'label' => __('Uploader type'), |
| 24 | 'name' => 'acfe_uploader', |
| 25 | 'key' => 'acfe_uploader', |
| 26 | 'instructions' => __('Choose the uploader type'), |
| 27 | 'type' => 'radio', |
| 28 | 'choices' => array( |
| 29 | 'wp' => 'Media', |
| 30 | 'basic' => 'Basic', |
| 31 | ), |
| 32 | 'allow_null' => 0, |
| 33 | 'other_choice' => 0, |
| 34 | 'default_value' => '', |
| 35 | 'layout' => 'horizontal', |
| 36 | 'return_format' => 'value', |
| 37 | 'save_other_choice' => 0, |
| 38 | )); |
| 39 | |
| 40 | } |
| 41 | |
| 42 | add_filter('acf/prepare_field/type=file', 'acfe_field_file_uploader_type'); |
| 43 | function acfe_field_file_uploader_type($field){ |
| 44 | |
| 45 | if(!isset($field['acfe_uploader']) || empty($field['acfe_uploader'])) |
| 46 | return $field; |
| 47 | |
| 48 | acf_update_setting('uploader', $field['acfe_uploader']); |
| 49 | |
| 50 | return $field; |
| 51 | |
| 52 | } |