PluginProbe
Advanced Custom Fields: Extended / 0.9.2.6
Advanced Custom Fields: Extended v0.9.2.6
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 All 92 releases
acf-extended / includes / forms / form-post.php
form-post.php
76 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_form_post')):
8
9 class acfe_form_post{
10
11 /**
12 * construct
13 */
14 function __construct(){
15
16 // re-add sidebar submitdiv metabox
17 acfe_replace_action('load-post.php', array('ACF_Form_Post', 'initialize'), array($this, 'initialize'));
18 acfe_replace_action('load-post-new.php', array('ACF_Form_Post', 'initialize'), array($this, 'initialize'));
19
20 }
21
22
23 /**
24 * initialize
25 *
26 * Rewrites ACF_Form_Post->initialize() which remove the submitdiv metabox in ACF Field Group since ACF 6.0+
27 *
28 * advanced-custom-fields-pro/includes/forms/form-post.php:48
29 */
30 function initialize(){
31
32 // globals
33 global $typenow;
34
35 // get restricted post types
36 $internal_post_types = $this->get_internal_posts_types();
37 $restricted = array_merge($internal_post_types, array('acf-taxonomy', 'attachment'));
38
39 // restrict specific post types
40 if(in_array($typenow, $restricted)){
41 return;
42 }
43
44 // enqueue scripts
45 acf_enqueue_scripts(array(
46 'uploader' => true,
47 ));
48
49 // actions
50 add_action('add_meta_boxes', array(acf_get_instance('ACF_Form_Post'), 'add_meta_boxes'), 10, 2);
51
52 }
53
54
55 /**
56 * get_internal_posts_types
57 *
58 * @return array|string[]
59 */
60 function get_internal_posts_types(){
61
62 // function was introduced in acf 6.1+
63 if(function_exists('acf_get_internal_post_types')){
64 return (array) acf_get_internal_post_types();
65 }
66
67 // fallback
68 return array('acf-field-group', 'acf-post-type', 'acf-taxonomy', 'acf-ui-options-page');
69
70 }
71
72 }
73
74 acf_new_instance('acfe_form_post');
75
76 endif;