PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / 0.9.2.7
Advanced Custom Fields: Extended v0.9.2.7
0.9.2.7 0.9.2.6 0.9.2.5 0.8.6 0.8.6.1 0.8.6.3 0.8.6.5 0.8.6.6 0.8.6.7 0.8.6.8 0.8.6.9 0.8.7 0.8.7.1 0.8.7.2 0.8.7.3 0.8.7.4 0.8.7.5 0.8.7.6 0.8.8 0.8.8.1 0.8.8.10 0.8.8.11 0.8.8.2 0.8.8.3 0.8.8.4 0.8.8.5 0.8.8.6 0.8.8.7 0.8.8.8 0.8.8.9 0.8.9 0.8.9.1 0.8.9.2 0.8.9.3 0.8.9.4 0.8.9.5 0.9 0.9.0.1 0.9.0.2 0.9.0.3 0.9.0.4 0.9.0.5 0.9.0.6 0.9.0.7 0.9.0.8 0.9.0.9 0.9.1 0.9.1.1 0.9.2 0.9.2.1 0.9.2.2 0.9.2.3 0.9.2.4 trunk 0.5 0.5.1 0.5.2 0.5.2.1 0.5.2.3 0.5.5 0.5.5.1 0.5.8 0.5.8.1 0.6 0.6.0.1 0.6.0.2 0.6.1 0.6.3 0.6.5 0.6.7 0.6.7.2 0.7 0.7.0.3 0.7.5 0.7.5.5 0.7.8 0.7.9 0.7.9.3 0.7.9.4 0.7.9.9.8 0.7.9.9.9 0.8 0.8.1 0.8.2 0.8.3 0.8.3.1 0.8.4 0.8.4.1 0.8.4.5 0.8.4.6 0.8.5 0.8.5.5
acf-extended / includes / fields-settings / instructions.php
acf-extended / includes / fields-settings Last commit date
bidirectional.php 3 months ago choices-label.php 3 months ago data.php 3 months ago instructions.php 3 months ago permissions.php 3 months ago settings.php 3 months ago validation.php 3 months ago
instructions.php
84 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_instructions')):
8
9 class acfe_instructions{
10
11 function __construct(){
12
13 add_action('acfe/pre_render_field_group', array($this, 'pre_render_field_group'), 10, 3);
14 add_filter('acf/field_wrapper_attributes', array($this, 'field_wrapper_attributes'), 10, 2);
15
16 }
17
18
19 /**
20 * pre_render_field_group
21 *
22 * @param $field_group
23 * @param $fields
24 * @param $post_id
25 *
26 * @return void
27 */
28 function pre_render_field_group($field_group, $fields, $post_id){
29
30 // bail early on override (acfe_form)
31 if(acf_is_filter_enabled('acfe/override_instruction')){
32 return;
33 }
34
35 acf_disable_filter('acfe/instruction_tooltip');
36 acf_disable_filter('acfe/instruction_above_field');
37
38 if(acfe_get($field_group, 'instruction_placement') === 'tooltip'){
39
40 acf_enable_filter('acfe/instruction_tooltip');
41
42 }elseif(acfe_get($field_group, 'instruction_placement') === 'above_field'){
43
44 acf_enable_filter('acfe/instruction_above_field');
45
46 }
47
48 }
49
50
51 /**
52 * field_wrapper_attributes
53 *
54 * @param $wrapper
55 * @param $field
56 *
57 * @return mixed
58 */
59 function field_wrapper_attributes($wrapper, $field){
60
61 if(!acfe_get($field, 'label')){
62 $wrapper['class'] .= ' acfe-no-label';
63 }
64
65 if(acfe_get($field, 'instructions')){
66
67 if(acf_is_filter_enabled('acfe/instruction_tooltip')){
68 $wrapper['data-instruction-tooltip'] = acf_esc_html($field['instructions']);
69
70 }elseif(acf_is_filter_enabled('acfe/instruction_above_field')){
71 $wrapper['data-instruction-above-field'] = acf_esc_html($field['instructions']);
72 }
73
74 }
75
76 return $wrapper;
77
78 }
79
80 }
81
82 new acfe_instructions();
83
84 endif;