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-repeater.php
65 lines
| 1 | <?php |
| 2 | |
| 3 | if(!defined('ABSPATH')) |
| 4 | exit; |
| 5 | |
| 6 | /** |
| 7 | * Add Settings |
| 8 | */ |
| 9 | add_action('acf/render_field_settings/type=repeater', 'acfe_repeater_settings', 0); |
| 10 | function acfe_repeater_settings($field){ |
| 11 | |
| 12 | // Stylised button |
| 13 | acf_render_field_setting($field, array( |
| 14 | 'label' => __('Stylised Button'), |
| 15 | 'name' => 'acfe_repeater_stylised_button', |
| 16 | 'key' => 'acfe_repeater_stylised_button', |
| 17 | 'instructions' => __('Better row button integration'), |
| 18 | 'type' => 'true_false', |
| 19 | 'message' => '', |
| 20 | 'default_value' => false, |
| 21 | 'ui' => true, |
| 22 | )); |
| 23 | |
| 24 | } |
| 25 | |
| 26 | add_filter('acf/field_wrapper_attributes', 'acfe_repeater_wrapper', 10, 2); |
| 27 | function acfe_repeater_wrapper($wrapper, $field){ |
| 28 | |
| 29 | if($field['type'] !== 'repeater') |
| 30 | return $wrapper; |
| 31 | |
| 32 | // Stylised button |
| 33 | if(isset($field['acfe_repeater_stylised_button']) && !empty($field['acfe_repeater_stylised_button'])){ |
| 34 | |
| 35 | $wrapper['data-acfe-repeater-stylised-button'] = 1; |
| 36 | |
| 37 | } |
| 38 | |
| 39 | // Lock sortable |
| 40 | $acfe_repeater_lock_sortable = false; |
| 41 | $acfe_repeater_lock_sortable = apply_filters('acfe/repeater/lock', $acfe_repeater_lock_sortable, $field); |
| 42 | $acfe_repeater_lock_sortable = apply_filters('acfe/repeater/lock/name=' . $field['_name'], $acfe_repeater_lock_sortable, $field); |
| 43 | $acfe_repeater_lock_sortable = apply_filters('acfe/repeater/lock/key=' . $field['key'], $acfe_repeater_lock_sortable, $field); |
| 44 | |
| 45 | if($acfe_repeater_lock_sortable){ |
| 46 | |
| 47 | $wrapper['data-acfe-repeater-lock'] = 1; |
| 48 | |
| 49 | } |
| 50 | |
| 51 | // Remove actions |
| 52 | $acfe_repeater_remove_actions = false; |
| 53 | $acfe_repeater_remove_actions = apply_filters('acfe/repeater/remove_actions', $acfe_repeater_remove_actions, $field); |
| 54 | $acfe_repeater_remove_actions = apply_filters('acfe/repeater/remove_actions/name=' . $field['_name'], $acfe_repeater_remove_actions, $field); |
| 55 | $acfe_repeater_remove_actions = apply_filters('acfe/repeater/remove_actions/key=' . $field['key'], $acfe_repeater_remove_actions, $field); |
| 56 | |
| 57 | if($acfe_repeater_remove_actions){ |
| 58 | |
| 59 | $wrapper['data-acfe-repeater-remove-actions'] = 1; |
| 60 | |
| 61 | } |
| 62 | |
| 63 | return $wrapper; |
| 64 | |
| 65 | } |