ACF_Admin_Tool_Import::html
html
This function will output the metabox HTML
Метод класса: ACF_Admin_Tool_Import{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$ACF_Admin_Tool_Import = new ACF_Admin_Tool_Import(); $ACF_Admin_Tool_Import->html();
Список изменений
| С версии 5.6.3 | Введена. |
Код ACF_Admin_Tool_Import::html() ACF Admin Tool Import::html ACF 6.4.2
<?php
function html() {
?>
<div class="acf-postbox-header">
<h2 class="acf-postbox-title"><?php esc_html_e( 'Import', 'acf' ); ?></h2>
<div class="acf-tip"><i tabindex="0" class="acf-icon acf-icon-help acf-js-tooltip" title="<?php esc_attr_e( 'Select the Advanced Custom Fields JSON file you would like to import. When you click the import button below, ACF will import the items in that file.', 'acf' ); ?>">?</i></div>
</div>
<div class="acf-postbox-inner">
<div class="acf-fields">
<?php
acf_render_field_wrap(
array(
'label' => __( 'Select File', 'acf' ),
'type' => 'file',
'name' => 'acf_import_file',
'value' => false,
'uploader' => 'basic',
)
);
?>
</div>
<p class="acf-submit">
<button type="submit" class="acf-btn" name="import_type" value="json">
<?php esc_html_e( 'Import JSON', 'acf' ); ?>
</button>
</p>
<?php
if ( is_plugin_active( 'custom-post-type-ui/custom-post-type-ui.php' ) && acf_get_setting( 'enable_post_types' ) ) {
$cptui_post_types = get_option( 'cptui_post_types' );
$cptui_taxonomies = get_option( 'cptui_taxonomies' );
$choices = array();
$overwrite_warning = false;
if ( $cptui_post_types ) {
$choices['post_types'] = __( 'Post Types', 'acf' );
$existing_post_types = acf_get_acf_post_types();
foreach ( $existing_post_types as $existing_post_type ) {
if ( isset( $cptui_post_types[ $existing_post_type['post_type'] ] ) ) {
$overwrite_warning = true;
}
}
}
if ( $cptui_taxonomies ) {
$choices['taxonomies'] = __( 'Taxonomies', 'acf' );
if ( ! $overwrite_warning ) {
$existing_taxonomies = acf_get_acf_taxonomies();
foreach ( $existing_taxonomies as $existing_taxonomy ) {
if ( isset( $cptui_taxonomies[ $existing_taxonomy['taxonomy'] ] ) ) {
$overwrite_warning = true;
}
}
}
}
if ( ! empty( $choices ) ) :
?>
<div class="acf-fields import-cptui">
<?php
acf_render_field_wrap(
array(
'label' => __( 'Import from Custom Post Type UI', 'acf' ),
'type' => 'checkbox',
'name' => 'acf_import_cptui',
'choices' => $choices,
'toggle' => true,
)
);
?>
</div>
<?php
if ( $overwrite_warning ) {
echo '<p class="acf-inline-notice notice notice-info">' . esc_html__( 'Importing a Post Type or Taxonomy with the same key as one that already exists will overwrite the settings for the existing Post Type or Taxonomy with those of the import.', 'acf' ) . '</p>';
}
?>
<p class="acf-submit">
<button type="submit" class="acf-btn" name="import_type" value="cptui">
<?php esc_html_e( 'Import from Custom Post Type UI', 'acf' ); ?>
</button>
</p>
<?php
endif;
}
?>
</div>
<?php
}