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 / data.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
data.php
106 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_field_data')):
8
9 class acfe_field_data{
10
11 function __construct(){
12
13 add_action('acf/render_field_settings', array($this, 'render_field_settings'), 992);
14 add_filter('acf/render_field/name=acfe_field_data', array($this, 'render_field'));
15
16 }
17
18
19 /**
20 * render_field_settings
21 *
22 * @param $field
23 *
24 * @return void
25 */
26 function render_field_settings($field){
27
28 // get field ID
29 $id = acfe_get($field, 'ID');
30
31 // validate
32 if(!$id || $id === 'acfcloneindex'){
33 return;
34 }
35
36 // render data button
37 acf_render_field_setting($field, array(
38 'label' => false,
39 'instructions' => '',
40 'type' => 'acfe_dynamic_render',
41 'required' => false,
42 'name' => 'acfe_field_data',
43 'key' => 'acfe_field_data',
44 'value' => $id,
45 ), true);
46
47 }
48
49
50 /**
51 * render_field
52 *
53 * @param $field
54 *
55 * @return void
56 */
57 function render_field($field){
58
59 // get field id
60 $id = $field['value'];
61
62 // validate
63 if(!$id){
64 return;
65 }
66
67 // Field
68 $field = acf_get_field($id);
69 $field = @map_deep($field, 'esc_html');
70
71 $field_debug = $field ? '<pre>' . print_r($field, true) . '</pre>' : '<pre>' . __('Field data unavailable', 'acfe') . '</pre>';
72
73 // Post
74 $post = get_post($id, ARRAY_A);
75 $post = @map_deep($post, 'esc_html');
76
77 $post_debug = $post ? '<pre style="margin-top:15px;">' . print_r($post, true) . '</pre>' : '<pre>' . __('Post object unavailable', 'acfe') . '</pre>';
78
79 // title
80 $title = __('Field Data', 'acf');
81
82 // field label
83 if($field){
84
85 $label = acfe_get($field, 'label');
86 $name = acfe_get($field, 'name');
87
88 $title = $label ? $label : $name;
89
90 }
91
92 ?>
93 <a href="#" class="button acfe-data-button" data-modal="<?php echo $id; ?>" style="margin-left:5px;"><?php _e('Data', 'acf'); ?></a>
94 <div class="acfe-modal" data-modal="<?php echo $id; ?>" data-title="<?php echo $title; ?>" data-footer="<?php _e('Close', 'acfe'); ?>">
95 <div class="acfe-modal-spacer">
96 <?php echo $field_debug . $post_debug; ?>
97 </div>
98 </div>
99 <?php
100 }
101
102 }
103
104 new acfe_field_data();
105
106 endif;