-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathadmin-settings.php
73 lines (65 loc) · 2.07 KB
/
admin-settings.php
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
<?php
function plugin_add_settings_link($links)
{
$settings_link = '<a href="options-general.php?page=acf-options-acf-vimeo-pro-data">' . __('Settings') . '</a>';
array_push($links, $settings_link);
return $links;
}
$initSettings = function () {
if (!current_user_can('administrator') || !function_exists('acf_add_options_page') || !function_exists('acf_add_local_field_group')) {
return;
}
add_filter("plugin_action_links_acf-vimeo-pro-data/acf-vimeo-pro-data.php", 'plugin_add_settings_link');
// registers a settings pages under general options
acf_add_options_sub_page(array(
'page_title' => 'Vimeo Pro Settings',
'menu_title' => 'ACF Vimeo Pro Data',
'parent_slug' => 'options-general.php',
));
// creates a field, a group and adds it all
// together to the options page
acf_add_local_field_group(array(
'key' => 'group_5c7edb3088f00',
'title' => 'ACF Vimeo Pro Data',
'fields' => array(
array(
'key' => 'field_5c7edb38313c0',
'label' => 'Vimeo Auth Token',
'name' => 'acf_vimeo_auth_token',
'type' => 'text',
'instructions' => 'Create a new app and generate a client access token to paste here.
More instructions here: https://developer.vimeo.com/api/start',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
),
'location' => array(
array(
array(
'param' => 'options_page',
'operator' => '==',
'value' => 'acf-options-acf-vimeo-pro-data',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'seamless',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
));
};
add_action('acf/init', $initSettings);