Deprecated.php
2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
namespace ACA\ACF\Column;
use AC;
use AC\Type\Url;
use ACA\ACF\Helper;
use ACA\ACF\Settings\Column\HiddenDeprecated;
class Deprecated extends AC\Column {
public function __construct() {
$this
->set_type( 'column-acf_field' )
->set_label( __( 'ACF (Deprecated)', 'codepress-admin-columns' ) )
->set_group( 'acf' );
}
protected function register_settings() {
parent::register_settings();
$hash = $this->get_option( 'field' );
if ( ! $hash ) {
return;
}
$acf_field = acf_get_field( $hash );
$acf_group = ( new Helper() )->get_field_group( $hash );
$edit_group_url = ( new Helper() )->get_field_edit_link( $hash );
$documentation_url = new Url\Documentation( Url\Documentation::ARTICLE_ACF_UPGRADE_V2_TO_V3 );
$message = new AC\Settings\Column\Message( $this );
$message->set_label( __( 'Update Message', 'codepress-admin-columns' ) );
$message->set_message(
sprintf( '<div class="acf-deprecated-message">%s %s<div class="acf-deprecated-message-field">%s<br>%s<br>%s<br>%s<br>%s<br>%s</div></div>',
__( 'This ACF column could not be updated from the v2 to v3 version.', 'codepress-admin-column' ),
sprintf( __( 'Read more about this in %s.' ),
sprintf( '<a href="%s">%s</a>', $documentation_url, __( 'our documentation', 'codepress-admin-column' ) )
),
sprintf( '<strong>%s</strong>', __( 'ACF Field', 'codepress-admin-columns' ) ),
sprintf( __( 'Field Label: %s', 'codepress-admin-column' ), sprintf( '<em>%s</em>', $acf_field['label'] ) ),
sprintf( __( 'Field Name: %s', 'codepress-admin-column' ), sprintf( '<em>%s</em>', $acf_field['name'] ) ),
sprintf( __( 'Field Type: %s', 'codepress-admin-column' ), sprintf( '<em>%s</em>', $acf_field['type'] ) ),
sprintf( __( 'Field Key: %s', 'codepress-admin-column' ), sprintf( '<em>%s</em>', $hash ) ),
sprintf( __( 'Field Group: %s', 'codepress-admin-column' ), sprintf( '<a href="%s">%s</a>', $edit_group_url, sprintf( '<em>%s</em>', $acf_group['title'] ) ) )
)
);
$this->add_setting( $message );
$options = $this->get_options();
foreach ( $this->get_available_acf_settings() as $setting ) {
if ( array_key_exists( $setting, $options ) ) {
$this->add_setting( new HiddenDeprecated( $this, $setting ) );
}
}
}
public function get_available_acf_settings() {
return [
'bulk_edit',
'character_limit',
'date_format',
'display_author_as',
'edit',
'excerpt_length',
'field',
'filter',
'filter_label',
'filter_format',
'flex_display',
'link_label',
'number_format',
'number_of_items',
'password',
'post_property_display',
'post_link_to',
'oembed',
'repeater_display',
'sort',
'sub_field',
'term_property',
'term_link_to',
'user_link_to',
];
}
}