plugin install
This commit is contained in:
@@ -26,18 +26,46 @@ foreach ( acf_get_combined_options_page_settings_tabs() as $tab_key => $tab_labe
|
||||
$acf_dashicon_link
|
||||
);
|
||||
|
||||
// Set the default value for the icon field.
|
||||
$acf_default_icon_value = array(
|
||||
'type' => 'dashicons',
|
||||
'value' => 'dashicons-admin-generic',
|
||||
);
|
||||
|
||||
$acf_icon_value = $acf_default_icon_value;
|
||||
|
||||
// Override the value for backwards compatibility, if it was saved with the key 'icon_url' as a string.
|
||||
if ( ! empty( $acf_ui_options_page['icon_url'] ) ) {
|
||||
if ( strpos( $acf_ui_options_page['icon_url'], 'dashicons-' ) === 0 ) {
|
||||
$acf_icon_value = array(
|
||||
'type' => 'dashicons',
|
||||
'value' => $acf_ui_options_page['icon_url'],
|
||||
);
|
||||
} else {
|
||||
$acf_icon_value = array(
|
||||
'type' => 'url',
|
||||
'value' => $acf_ui_options_page['icon_url'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Override the above value if a 'menu_icon' key exists, and is not empty, which is the new key for storing the icon.
|
||||
if ( ! empty( $acf_ui_options_page['menu_icon'] ) ) {
|
||||
$acf_icon_value = $acf_ui_options_page['menu_icon'];
|
||||
}
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Menu Icon', 'acf' ),
|
||||
'type' => 'text',
|
||||
'name' => 'icon_url',
|
||||
'key' => 'icon_url',
|
||||
'class' => 'acf-options-page-menu_icon',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'value' => $acf_ui_options_page['icon_url'],
|
||||
'instructions' => $acf_menu_icon_instructions,
|
||||
'placeholder' => 'dashicons-admin-generic',
|
||||
'conditions' => array(
|
||||
'label' => __( 'Menu Icon', 'acf' ),
|
||||
'type' => 'icon_picker',
|
||||
'name' => 'menu_icon',
|
||||
'key' => 'menu_icon',
|
||||
'class' => 'acf-options-page-menu_icon',
|
||||
'prefix' => 'acf_ui_options_page',
|
||||
'required' => false,
|
||||
'value' => $acf_icon_value,
|
||||
'default_value' => $acf_default_icon_value,
|
||||
'conditions' => array(
|
||||
'field' => 'parent_slug',
|
||||
'operator' => '==',
|
||||
'value' => 'none',
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
<?php
|
||||
global $acf_ui_options_page, $acf_parent_page_options;
|
||||
|
||||
$acf_duplicate_options_page = acf_get_ui_options_page_from_request_args( 'acfduplicate' );
|
||||
|
||||
if ( acf_is_ui_options_page( $acf_duplicate_options_page ) ) {
|
||||
// Reset vars that likely have to be changed.
|
||||
$acf_duplicate_options_page['key'] = uniqid( 'ui_options_page_' );
|
||||
$acf_duplicate_options_page['title'] = '';
|
||||
$acf_duplicate_options_page['page_title'] = '';
|
||||
$acf_duplicate_options_page['menu_title'] = '';
|
||||
$acf_duplicate_options_page['menu_slug'] = '';
|
||||
|
||||
// Rest of the vars can be reused.
|
||||
$acf_ui_options_page = $acf_duplicate_options_page;
|
||||
}
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Page Title', 'acf' ),
|
||||
|
||||
Reference in New Issue
Block a user