first commit
This commit is contained in:
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
// vars
|
||||
$disabled = false;
|
||||
|
||||
// empty
|
||||
if ( empty( $field['conditional_logic'] ) ) {
|
||||
$disabled = true;
|
||||
$field['conditional_logic'] = array(
|
||||
|
||||
// group 0
|
||||
array(
|
||||
|
||||
// rule 0
|
||||
array(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="acf-field acf-field-true-false acf-field-setting-conditional_logic" data-type="true_false" data-name="conditional_logic">
|
||||
<div class="acf-conditional-toggle">
|
||||
<div class="acf-label">
|
||||
<?php $acf_label_for = acf_idify( $field['prefix'] . '[conditional_logic]' ); ?>
|
||||
<label for="<?php echo esc_attr( $acf_label_for ); ?>"><?php _e( 'Conditional Logic', 'acf' ); ?></label>
|
||||
</div>
|
||||
<div class="acf-input">
|
||||
<?php
|
||||
|
||||
acf_render_field(
|
||||
array(
|
||||
'type' => 'true_false',
|
||||
'name' => 'conditional_logic',
|
||||
'prefix' => $field['prefix'],
|
||||
'value' => $disabled ? 0 : 1,
|
||||
'ui' => 1,
|
||||
'class' => 'conditions-toggle',
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="rule-groups"
|
||||
<?php
|
||||
if ( $disabled ) {
|
||||
echo ' style="display:none"';
|
||||
}
|
||||
?>
|
||||
>
|
||||
<?php
|
||||
foreach ( $field['conditional_logic'] as $group_id => $group ) :
|
||||
|
||||
// validate
|
||||
if ( empty( $group ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// vars
|
||||
// $group_id must be completely different to $rule_id to avoid JS issues
|
||||
$group_id = "group_{$group_id}";
|
||||
$h4 = ( $group_id == 'group_0' ) ? __( 'Show this field if', 'acf' ) : __( 'or', 'acf' );
|
||||
|
||||
?>
|
||||
<div class="rule-group" data-id="<?php echo $group_id; ?>">
|
||||
|
||||
<h4><?php echo $h4; ?></h4>
|
||||
|
||||
<table class="acf-table -clear">
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ( $group as $rule_id => $rule ) :
|
||||
|
||||
// valid rule
|
||||
$rule = wp_parse_args(
|
||||
$rule,
|
||||
array(
|
||||
'field' => '',
|
||||
'operator' => '',
|
||||
'value' => '',
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// vars
|
||||
// $group_id must be completely different to $rule_id to avoid JS issues
|
||||
$rule_id = "rule_{$rule_id}";
|
||||
$prefix = "{$field['prefix']}[conditional_logic][{$group_id}][{$rule_id}]";
|
||||
|
||||
// data attributes
|
||||
$attributes = array(
|
||||
'data-id' => $rule_id,
|
||||
'data-field' => $rule['field'],
|
||||
'data-operator' => $rule['operator'],
|
||||
'data-value' => $rule['value'],
|
||||
);
|
||||
|
||||
?>
|
||||
<tr class="rule" <?php echo acf_esc_attrs( $attributes ); ?>>
|
||||
<td class="param">
|
||||
<?php
|
||||
|
||||
acf_render_field(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'prefix' => $prefix,
|
||||
'name' => 'field',
|
||||
'class' => 'condition-rule-field',
|
||||
'disabled' => $disabled,
|
||||
'value' => $rule['field'],
|
||||
'choices' => array(
|
||||
$rule['field'] => $rule['field'],
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td class="operator">
|
||||
<?php
|
||||
|
||||
acf_render_field(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'prefix' => $prefix,
|
||||
'name' => 'operator',
|
||||
'class' => 'condition-rule-operator',
|
||||
'disabled' => $disabled,
|
||||
'value' => $rule['operator'],
|
||||
'choices' => array(
|
||||
$rule['operator'] => $rule['operator'],
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td class="value">
|
||||
<?php
|
||||
|
||||
// create field
|
||||
acf_render_field(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'prefix' => $prefix,
|
||||
'name' => 'value',
|
||||
'class' => 'condition-rule-value',
|
||||
'disabled' => $disabled,
|
||||
'value' => $rule['value'],
|
||||
'choices' => array(
|
||||
$rule['value'] => $rule['value'],
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td class="add">
|
||||
<a href="#" class="button add-conditional-rule"><?php _e( 'and', 'acf' ); ?></a>
|
||||
</td>
|
||||
<td class="remove">
|
||||
<a href="#" class="acf-icon -minus remove-conditional-rule"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<h4><?php _e( 'or', 'acf' ); ?></h4>
|
||||
|
||||
<a href="#" class="button add-conditional-group"><?php _e( 'Add rule group', 'acf' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,316 @@
|
||||
<?php
|
||||
//phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- included template file.
|
||||
|
||||
// Define input name prefix using unique identifier.
|
||||
$input_prefix = 'acf_fields[' . $field['ID'] . ']';
|
||||
$input_id = acf_idify( $input_prefix );
|
||||
|
||||
// Update field props.
|
||||
$field['prefix'] = $input_prefix;
|
||||
|
||||
// Elements.
|
||||
$div_attrs = array(
|
||||
'class' => 'acf-field-object acf-field-object-' . acf_slugify( $field['type'] ),
|
||||
'data-id' => $field['ID'],
|
||||
'data-key' => $field['key'],
|
||||
'data-type' => $field['type'],
|
||||
);
|
||||
|
||||
// Add additional class if the field is an endpoint.
|
||||
if ( isset( $field['endpoint'] ) && $field['endpoint'] ) {
|
||||
$div_attrs['class'] .= ' acf-field-is-endpoint';
|
||||
}
|
||||
|
||||
|
||||
// Misc template vars.
|
||||
$field_label = acf_get_field_label( $field, 'admin' );
|
||||
$field_type_label = acf_get_field_type_label( $field['type'] );
|
||||
$field_type_supports = acf_get_field_type_prop( $field['type'], 'supports' );
|
||||
|
||||
if ( acf_is_pro() && acf_get_field_type_prop( $field['type'], 'pro' ) && ! acf_pro_is_license_active() ) {
|
||||
$field_type_label .= '<span class="acf-pro-label acf-pro-label-field-type">PRO</span>';
|
||||
}
|
||||
|
||||
if ( ! isset( $num_field_groups ) ) {
|
||||
$num_field_groups = 0;
|
||||
}
|
||||
|
||||
$conditional_logic_class = $conditional_logic_text = '';
|
||||
if ( isset( $field['conditional_logic'] ) && is_array( $field['conditional_logic'] ) && count( $field['conditional_logic'] ) > 0 ) {
|
||||
$conditional_logic_class = ' is-enabled';
|
||||
$conditional_logic_text = __( 'Active', 'acf' );
|
||||
}
|
||||
|
||||
?>
|
||||
<div <?php echo acf_esc_attrs( $div_attrs ); ?>>
|
||||
|
||||
<div class="meta">
|
||||
<?php
|
||||
$meta_inputs = array(
|
||||
'ID' => $field['ID'],
|
||||
'key' => $field['key'],
|
||||
'parent' => $field['parent'],
|
||||
'menu_order' => $i,
|
||||
'save' => '',
|
||||
);
|
||||
foreach ( $meta_inputs as $k => $v ) :
|
||||
acf_hidden_input(
|
||||
array(
|
||||
'name' => $input_prefix . '[' . $k . ']',
|
||||
'value' => $v,
|
||||
'id' => $input_id . '-' . $k,
|
||||
)
|
||||
);
|
||||
endforeach;
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="handle">
|
||||
<ul class="acf-hl acf-tbody">
|
||||
<li class="li-field-order">
|
||||
<span class="acf-icon acf-sortable-handle" title="<?php _e( 'Drag to reorder', 'acf' ); ?>"><?php echo ( $i + 1 ); ?></span>
|
||||
</li>
|
||||
<li class="li-field-label">
|
||||
<strong>
|
||||
<a class="edit-field" title="<?php _e( 'Edit field', 'acf' ); ?>" href="#"><?php echo acf_esc_html( $field_label ); ?></a>
|
||||
</strong>
|
||||
<div class="row-options">
|
||||
<a class="edit-field" title="<?php _e( 'Edit field', 'acf' ); ?>" href="#"><?php _e( 'Edit', 'acf' ); ?></a>
|
||||
<a class="duplicate-field" title="<?php _e( 'Duplicate field', 'acf' ); ?>" href="#"><?php _e( 'Duplicate', 'acf' ); ?></a>
|
||||
<?php if ( $num_field_groups > 1 ) : ?>
|
||||
<a class="move-field" title="<?php _e( 'Move field to another group', 'acf' ); ?>" href="#"><?php _e( 'Move', 'acf' ); ?></a>
|
||||
<?php endif; ?>
|
||||
<a class="delete-field" title="<?php _e( 'Delete field', 'acf' ); ?>" href="#"><?php _e( 'Delete', 'acf' ); ?></a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="li-field-name"><span class="copyable"><?php echo esc_html( $field['name'] ); ?></span></li>
|
||||
<li class="li-field-key"><span class="copyable"><?php echo esc_html( $field['key'] ); ?></span></li>
|
||||
<li class="li-field-type">
|
||||
<i class="field-type-icon field-type-icon-<?php echo acf_slugify( $field['type'] ); ?>"></i>
|
||||
<span class="field-type-label">
|
||||
<?php echo acf_esc_html( $field_type_label ); ?>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="settings">
|
||||
<div class="acf-field-editor">
|
||||
<div class="acf-field-settings acf-fields">
|
||||
|
||||
<?php
|
||||
foreach ( acf_get_combined_field_type_settings_tabs() as $tab_key => $tab_label ) {
|
||||
$field_to_render = array(
|
||||
'type' => 'tab',
|
||||
'label' => $tab_label,
|
||||
'key' => 'acf_field_settings_tabs',
|
||||
'settings-type' => $tab_key,
|
||||
);
|
||||
|
||||
if ( $tab_key === 'conditional_logic' ) {
|
||||
$field_to_render['label'] = __( 'Conditional Logic', 'acf' ) . '<i class="conditional-logic-badge' . $conditional_logic_class . '">' . $conditional_logic_text . '</i>';
|
||||
}
|
||||
|
||||
acf_render_field_wrap( $field_to_render );
|
||||
?>
|
||||
<?php
|
||||
$wrapper_class = str_replace( '_', '-', $tab_key );
|
||||
?>
|
||||
<div class="acf-field-settings-main acf-field-settings-main-<?php echo esc_attr( $wrapper_class ); ?>">
|
||||
<?php
|
||||
switch ( $tab_key ) {
|
||||
case 'general':
|
||||
$field_type_select_class = 'field-type';
|
||||
if ( ! apply_filters( 'acf/field_group/enable_field_type_select2', true ) ) {
|
||||
$field_type_select_class .= ' disable-select2';
|
||||
}
|
||||
// type
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
array(
|
||||
'label' => __( 'Field Type', 'acf' ),
|
||||
'instructions' => '',
|
||||
'type' => 'select',
|
||||
'name' => 'type',
|
||||
'choices' => acf_get_grouped_field_types(),
|
||||
'class' => $field_type_select_class,
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
if ( apply_filters( 'acf/field_group/enable_field_browser', true ) ) {
|
||||
?>
|
||||
<div class="acf-field acf-field-setting-browse-fields" data-append="type">
|
||||
<div class="acf-input">
|
||||
<button class="acf-btn browse-fields">
|
||||
<i class="acf-icon acf-icon-dots-grid"></i>
|
||||
<?php _e( 'Browse Fields', 'acf' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
// label
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
array(
|
||||
'label' => __( 'Field Label', 'acf' ),
|
||||
'instructions' => __( 'This is the name which will appear on the EDIT page', 'acf' ),
|
||||
'name' => 'label',
|
||||
'type' => 'text',
|
||||
'class' => 'field-label',
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
// name
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
array(
|
||||
'label' => __( 'Field Name', 'acf' ),
|
||||
'instructions' => __( 'Single word, no spaces. Underscores and dashes allowed', 'acf' ),
|
||||
'name' => 'name',
|
||||
'type' => 'text',
|
||||
'class' => 'field-name',
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
// 3rd party settings
|
||||
do_action( 'acf/render_field_settings', $field );
|
||||
do_action( "acf/field_group/render_field_settings_tab/{$tab_key}", $field );
|
||||
?>
|
||||
<div class="acf-field-type-settings" data-parent-tab="<?php echo esc_attr( $tab_key ); ?>">
|
||||
<?php
|
||||
do_action( "acf/render_field_settings/type={$field['type']}", $field );
|
||||
do_action( "acf/field_group/render_field_settings_tab/{$tab_key}/type={$field['type']}", $field );
|
||||
do_action( "acf/render_field_{$tab_key}_settings/type={$field['type']}", $field );
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 'validation':
|
||||
do_action( "acf/field_group/render_field_settings_tab/{$tab_key}", $field );
|
||||
?>
|
||||
<div class="acf-field-type-settings" data-parent-tab="<?php echo esc_attr( $tab_key ); ?>">
|
||||
<?php
|
||||
do_action( "acf/field_group/render_field_settings_tab/{$tab_key}/type={$field['type']}", $field );
|
||||
do_action( "acf/render_field_{$tab_key}_settings/type={$field['type']}", $field );
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 'presentation':
|
||||
acf_render_field_setting(
|
||||
$field,
|
||||
array(
|
||||
'label' => __( 'Instructions', 'acf' ),
|
||||
'instructions' => __( 'Instructions for authors. Shown when submitting data', 'acf' ),
|
||||
'type' => 'textarea',
|
||||
'name' => 'instructions',
|
||||
'rows' => 5,
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => '',
|
||||
'instructions' => '',
|
||||
'type' => 'text',
|
||||
'name' => 'class',
|
||||
'prefix' => $field['prefix'] . '[wrapper]',
|
||||
'value' => $field['wrapper']['class'],
|
||||
'prepend' => __( 'class', 'acf' ),
|
||||
'wrapper' => array(
|
||||
'data-append' => 'wrapper',
|
||||
),
|
||||
),
|
||||
'div'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => '',
|
||||
'instructions' => '',
|
||||
'type' => 'text',
|
||||
'name' => 'id',
|
||||
'prefix' => $field['prefix'] . '[wrapper]',
|
||||
'value' => $field['wrapper']['id'],
|
||||
'prepend' => __( 'id', 'acf' ),
|
||||
'wrapper' => array(
|
||||
'data-append' => 'wrapper',
|
||||
),
|
||||
),
|
||||
'div'
|
||||
);
|
||||
|
||||
do_action( "acf/field_group/render_field_settings_tab/{$tab_key}", $field );
|
||||
?>
|
||||
<div class="acf-field-type-settings" data-parent-tab="<?php echo esc_attr( $tab_key ); ?>">
|
||||
<?php
|
||||
do_action( "acf/field_group/render_field_settings_tab/{$tab_key}/type={$field['type']}", $field );
|
||||
do_action( "acf/render_field_{$tab_key}_settings/type={$field['type']}", $field );
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Wrapper Attributes', 'acf' ),
|
||||
'instructions' => '',
|
||||
'type' => 'number',
|
||||
'name' => 'width',
|
||||
'prefix' => $field['prefix'] . '[wrapper]',
|
||||
'value' => $field['wrapper']['width'],
|
||||
'prepend' => __( 'width', 'acf' ),
|
||||
'append' => '%',
|
||||
'wrapper' => array(
|
||||
'data-name' => 'wrapper',
|
||||
'class' => 'acf-field-setting-wrapper',
|
||||
),
|
||||
),
|
||||
'div'
|
||||
);
|
||||
break;
|
||||
case 'conditional_logic':
|
||||
acf_get_view( 'acf-field-group/conditional-logic', array( 'field' => $field ) );
|
||||
|
||||
do_action( "acf/field_group/render_field_settings_tab/{$tab_key}", $field );
|
||||
?>
|
||||
<div class="acf-field-type-settings" data-parent-tab="<?php echo esc_attr( $tab_key ); ?>">
|
||||
<?php
|
||||
do_action( "acf/field_group/render_field_settings_tab/{$tab_key}/type={$field['type']}", $field );
|
||||
do_action( "acf/render_field_{$tab_key}_settings/type={$field['type']}", $field );
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
default:
|
||||
// Global action hook for custom tabs.
|
||||
do_action( "acf/field_group/render_field_settings_tab/{$tab_key}", $field );
|
||||
?>
|
||||
<div class="acf-field-type-settings" data-parent-tab="<?php echo esc_attr( $tab_key ); ?>">
|
||||
<?php
|
||||
// Type-specific action hook for custom tabs.
|
||||
do_action( "acf/field_group/render_field_settings_tab/{$tab_key}/type={$field['type']}", $field );
|
||||
do_action( "acf/render_field_{$tab_key}_settings/type={$field['type']}", $field );
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="acf-field-settings-footer">
|
||||
<a class="button close-field edit-field" title="<?php _e( 'Close Field', 'acf' ); ?>" href="#"><?php _e( 'Close Field', 'acf' ); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
//phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- template include file
|
||||
$field_groups = acf_get_field_groups();
|
||||
$num_field_groups = 0;
|
||||
if ( is_array( $field_groups ) ) {
|
||||
$num_field_groups = count( $field_groups );
|
||||
}
|
||||
$is_subfield = ! empty( $is_subfield );
|
||||
$wrapper_class = '';
|
||||
if ( $is_subfield ) {
|
||||
$wrapper_class = ' acf-is-subfields';
|
||||
if ( ! $fields ) {
|
||||
$wrapper_class .= ' -empty';
|
||||
}
|
||||
} elseif ( ! $fields && ! $parent ) {
|
||||
/**
|
||||
* Filter for determining if a new field group should render with a text field automatically
|
||||
*
|
||||
* @since 6.2
|
||||
*
|
||||
* @param bool $bool If an empty field group should render with a new field auto appended.
|
||||
*/
|
||||
if ( apply_filters( 'acf/field_group/auto_add_first_field', true ) ) {
|
||||
$wrapper_class = ' acf-auto-add-field';
|
||||
} else {
|
||||
$wrapper_class = ' -empty';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php if ( $parent || $is_subfield ) { ?>
|
||||
<div class="acf-sub-field-list-header">
|
||||
<h3 class="acf-sub-field-list-title"><?php _e( 'Fields', 'acf' ); ?></h3>
|
||||
<a href="#" class="acf-btn acf-btn-secondary add-field"><i class="acf-icon acf-icon-plus"></i><?php _e( 'Add Field', 'acf' ); ?></a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed string output ?>
|
||||
<div class="acf-field-list-wrap<?php echo $wrapper_class; ?>">
|
||||
|
||||
<ul class="acf-hl acf-thead">
|
||||
<li class="li-field-order">
|
||||
<?php
|
||||
/* translators: A symbol (or text, if not available in your locale) meaning "Order Number", in terms of positional placement. */
|
||||
_e( '#', 'acf' );
|
||||
?>
|
||||
<span class="acf-hidden">
|
||||
<?php
|
||||
/* translators: Hidden accessibility text for the positional order number of the field. */
|
||||
_e( 'Order', 'acf' );
|
||||
?>
|
||||
</span>
|
||||
</li>
|
||||
<li class="li-field-label"><?php _e( 'Label', 'acf' ); ?></li>
|
||||
<li class="li-field-name"><?php _e( 'Name', 'acf' ); ?></li>
|
||||
<li class="li-field-key"><?php _e( 'Key', 'acf' ); ?></li>
|
||||
<li class="li-field-type"><?php _e( 'Type', 'acf' ); ?></li>
|
||||
</ul>
|
||||
|
||||
<?php //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed string output ?>
|
||||
<div class="acf-field-list<?php echo $wrapper_class; ?>">
|
||||
|
||||
<div class="no-fields-message">
|
||||
<div class="no-fields-message-inner">
|
||||
<img src="<?php echo acf_get_url( 'assets/images/empty-group.svg' ); ?>" />
|
||||
<h2><?php _e( 'Add Your First Field', 'acf' ); ?></h2>
|
||||
<p><?php _e( 'Get started creating new custom fields for your posts, pages, custom post types and other WordPress content.', 'acf' ); ?></p>
|
||||
<a href="#" class="acf-btn acf-btn-primary add-field add-first-field
|
||||
"><i class="acf-icon acf-icon-plus"></i> <?php _e( 'Add Field', 'acf' ); ?></a>
|
||||
<p class="acf-small">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s url to field types list */
|
||||
__( 'Choose from over 30 field types. <a href="%s" target="_blank">Learn more</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/', 'docs', 'empty-field-group', 'field-types' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ( $fields ) :
|
||||
foreach ( $fields as $i => $field ) :
|
||||
acf_get_view(
|
||||
'acf-field-group/field',
|
||||
array(
|
||||
'field' => $field,
|
||||
'i' => $i,
|
||||
'num_field_groups' => $num_field_groups,
|
||||
)
|
||||
);
|
||||
endforeach;
|
||||
endif;
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
<ul class="acf-hl acf-tfoot">
|
||||
<li class="acf-fr">
|
||||
<a href="#" class="acf-btn acf-btn-secondary add-field"><i class="acf-icon acf-icon-plus"></i><?php _e( 'Add Field', 'acf' ); ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<?php
|
||||
if ( ! $parent ) :
|
||||
|
||||
// get clone
|
||||
$clone = acf_get_valid_field(
|
||||
array(
|
||||
'ID' => 'acfcloneindex',
|
||||
'key' => 'acfcloneindex',
|
||||
'label' => __( 'New Field', 'acf' ),
|
||||
'name' => 'new_field',
|
||||
'type' => 'text',
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
<script type="text/html" id="tmpl-acf-field">
|
||||
<?php
|
||||
acf_get_view(
|
||||
'acf-field-group/field',
|
||||
array(
|
||||
'field' => $clone,
|
||||
'i' => 0,
|
||||
'num_field_groups' => $num_field_groups,
|
||||
)
|
||||
);
|
||||
?>
|
||||
</script>
|
||||
<script type="text/html" id="tmpl-acf-browse-fields-modal">
|
||||
<?php acf_get_view( 'browse-fields-modal' ); ?>
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,26 @@
|
||||
<script>document.body.classList.add('acf-no-field-groups');</script>
|
||||
<div class="acf-no-field-groups-wrapper">
|
||||
<div class="acf-no-field-groups-inner">
|
||||
<img src="<?php echo acf_get_url( 'assets/images/empty-group.svg' ); ?>" />
|
||||
<h2><?php _e( 'Add Your First Field Group', 'acf' ); ?></h2>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s url to creating a field group page */
|
||||
__( 'ACF uses <a href="%s" target="_blank">field groups</a> to group custom fields together, and then attach those fields to edit screens.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/creating-a-field-group/', 'docs', 'no-field-groups' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<a href="<?php echo admin_url( 'post-new.php?post_type=acf-field-group' ); ?>" class="acf-btn"><i class="acf-icon acf-icon-plus"></i> <?php _e( 'Add Field Group', 'acf' ); ?></a>
|
||||
<p class="acf-small">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s url to getting started guide */
|
||||
__( 'New to ACF? Take a look at our <a href="%s" target="_blank">getting started guide</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-field-groups' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
<div class="rule-group" data-id="<?php echo $group_id; ?>">
|
||||
|
||||
<h4><?php echo ( $group_id == 'group_0' ) ? __( 'Show this field group if', 'acf' ) : __( 'or', 'acf' ); ?></h4>
|
||||
|
||||
<table class="acf-table -clear">
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ( $group as $i => $rule ) :
|
||||
|
||||
// validate rule
|
||||
$rule = acf_validate_location_rule( $rule );
|
||||
|
||||
// append id and group
|
||||
$rule['id'] = "rule_{$i}";
|
||||
$rule['group'] = $group_id;
|
||||
|
||||
// view
|
||||
acf_get_view(
|
||||
'acf-field-group/location-rule',
|
||||
array(
|
||||
'rule' => $rule,
|
||||
)
|
||||
);
|
||||
endforeach;
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
// vars
|
||||
$prefix = 'acf_field_group[location][' . $rule['group'] . '][' . $rule['id'] . ']';
|
||||
|
||||
?>
|
||||
<tr data-id="<?php echo $rule['id']; ?>">
|
||||
<td class="param">
|
||||
<?php
|
||||
|
||||
// vars
|
||||
$choices = acf_get_location_rule_types();
|
||||
|
||||
// array
|
||||
if ( is_array( $choices ) ) {
|
||||
acf_render_field(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'param',
|
||||
'prefix' => $prefix,
|
||||
'value' => $rule['param'],
|
||||
'choices' => $choices,
|
||||
'class' => 'refresh-location-rule',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td class="operator">
|
||||
<?php
|
||||
|
||||
// vars
|
||||
$choices = acf_get_location_rule_operators( $rule );
|
||||
|
||||
|
||||
// array
|
||||
if ( is_array( $choices ) ) {
|
||||
acf_render_field(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'operator',
|
||||
'prefix' => $prefix,
|
||||
'value' => $rule['operator'],
|
||||
'choices' => $choices,
|
||||
)
|
||||
);
|
||||
|
||||
// custom
|
||||
} else {
|
||||
echo $choices;
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td class="value">
|
||||
<?php
|
||||
|
||||
// vars
|
||||
$choices = acf_get_location_rule_values( $rule );
|
||||
|
||||
|
||||
// array
|
||||
if ( is_array( $choices ) ) {
|
||||
acf_render_field(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'value',
|
||||
'class' => 'location-rule-value',
|
||||
'prefix' => $prefix,
|
||||
'value' => $rule['value'],
|
||||
'choices' => $choices,
|
||||
)
|
||||
);
|
||||
|
||||
// custom
|
||||
} else {
|
||||
echo $choices;
|
||||
}
|
||||
|
||||
?>
|
||||
</td>
|
||||
<td class="add">
|
||||
<a href="#" class="button add-location-rule"><?php _e( 'and', 'acf' ); ?></a>
|
||||
</td>
|
||||
<td class="remove">
|
||||
<a href="#" class="acf-icon -minus remove-location-rule"></a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
// global
|
||||
global $field_group;
|
||||
|
||||
?>
|
||||
<div class="acf-field">
|
||||
<div class="acf-label">
|
||||
<label><?php _e( 'Rules', 'acf' ); ?></label>
|
||||
<i tabindex="0" class="acf-icon acf-icon-help acf-js-tooltip" title="<?php esc_attr_e( 'Create a set of rules to determine which edit screens will use these advanced custom fields', 'acf' ); ?>">?</i>
|
||||
</div>
|
||||
<div class="acf-input">
|
||||
<div class="rule-groups">
|
||||
|
||||
<?php
|
||||
foreach ( $field_group['location'] as $i => $group ) :
|
||||
|
||||
// bail early if no group
|
||||
if ( empty( $group ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// view
|
||||
acf_get_view(
|
||||
'acf-field-group/location-group',
|
||||
array(
|
||||
'group' => $group,
|
||||
'group_id' => "group_{$i}",
|
||||
)
|
||||
);
|
||||
endforeach;
|
||||
?>
|
||||
|
||||
<h4><?php _e( 'or', 'acf' ); ?></h4>
|
||||
|
||||
<a href="#" class="button add-location-group"><?php _e( 'Add rule group', 'acf' ); ?></a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
if( typeof acf !== 'undefined' ) {
|
||||
|
||||
acf.newPostbox({
|
||||
'id': 'acf-field-group-locations',
|
||||
'label': 'left'
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,297 @@
|
||||
<?php
|
||||
|
||||
// global
|
||||
global $field_group;
|
||||
|
||||
// UI needs at lease 1 location rule
|
||||
if ( empty( $field_group['location'] ) ) {
|
||||
$field_group['location'] = array(
|
||||
// Group 0.
|
||||
array(
|
||||
// Rule 0.
|
||||
array(
|
||||
'param' => 'post_type',
|
||||
'operator' => '==',
|
||||
'value' => 'post',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$acf_use_post_type = acf_get_post_type_from_request_args( 'add-fields' );
|
||||
$acf_use_taxonomy = acf_get_taxonomy_from_request_args( 'add-fields' );
|
||||
$acf_use_options_page = acf_get_ui_options_page_from_request_args( 'add-fields' );
|
||||
|
||||
if ( $acf_use_post_type && ! empty( $acf_use_post_type['post_type'] ) ) {
|
||||
$field_group['location'] = array(
|
||||
array(
|
||||
array(
|
||||
'param' => 'post_type',
|
||||
'operator' => '==',
|
||||
'value' => $acf_use_post_type['post_type'],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if ( $acf_use_taxonomy && ! empty( $acf_use_taxonomy['taxonomy'] ) ) {
|
||||
$field_group['location'] = array(
|
||||
array(
|
||||
array(
|
||||
'param' => 'taxonomy',
|
||||
'operator' => '==',
|
||||
'value' => $acf_use_taxonomy['taxonomy'],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if ( $acf_use_options_page && ! empty( $acf_use_options_page['menu_slug'] ) ) {
|
||||
$field_group['location'] = array(
|
||||
array(
|
||||
array(
|
||||
'param' => 'options_page',
|
||||
'operator' => '==',
|
||||
'value' => $acf_use_options_page['menu_slug'],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( acf_get_combined_field_group_settings_tabs() as $tab_key => $tab_label ) {
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'type' => 'tab',
|
||||
'label' => $tab_label,
|
||||
'key' => 'acf_field_group_settings_tabs',
|
||||
'settings-type' => $tab_key,
|
||||
)
|
||||
);
|
||||
|
||||
switch ( $tab_key ) {
|
||||
case 'location_rules':
|
||||
echo '<div class="field-group-locations field-group-settings-tab">';
|
||||
acf_get_view( 'acf-field-group/locations' );
|
||||
echo '</div>';
|
||||
break;
|
||||
case 'presentation':
|
||||
echo '<div class="field-group-setting-split-container field-group-settings-tab">';
|
||||
echo '<div class="field-group-setting-split">';
|
||||
|
||||
// style
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Style', 'acf' ),
|
||||
'instructions' => '',
|
||||
'type' => 'button_group',
|
||||
'name' => 'style',
|
||||
'prefix' => 'acf_field_group',
|
||||
'value' => $field_group['style'],
|
||||
'choices' => array(
|
||||
'default' => __( 'Standard (WP metabox)', 'acf' ),
|
||||
'seamless' => __( 'Seamless (no metabox)', 'acf' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// position
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Position', 'acf' ),
|
||||
'instructions' => __( "'High' position not supported in the Block Editor", 'acf' ),
|
||||
'type' => 'button_group',
|
||||
'name' => 'position',
|
||||
'prefix' => 'acf_field_group',
|
||||
'value' => $field_group['position'],
|
||||
'choices' => array(
|
||||
'acf_after_title' => __( 'High (after title)', 'acf' ),
|
||||
'normal' => __( 'Normal (after content)', 'acf' ),
|
||||
'side' => __( 'Side', 'acf' ),
|
||||
),
|
||||
'default_value' => 'normal',
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
|
||||
// label_placement
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Label Placement', 'acf' ),
|
||||
'instructions' => '',
|
||||
'type' => 'button_group',
|
||||
'name' => 'label_placement',
|
||||
'prefix' => 'acf_field_group',
|
||||
'value' => $field_group['label_placement'],
|
||||
'choices' => array(
|
||||
'top' => __( 'Top aligned', 'acf' ),
|
||||
'left' => __( 'Left aligned', 'acf' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// instruction_placement
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Instruction Placement', 'acf' ),
|
||||
'instructions' => '',
|
||||
'type' => 'button_group',
|
||||
'name' => 'instruction_placement',
|
||||
'prefix' => 'acf_field_group',
|
||||
'value' => $field_group['instruction_placement'],
|
||||
'choices' => array(
|
||||
'label' => __( 'Below labels', 'acf' ),
|
||||
'field' => __( 'Below fields', 'acf' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// menu_order
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Order No.', 'acf' ),
|
||||
'instructions' => __( 'Field groups with a lower order will appear first', 'acf' ),
|
||||
'type' => 'number',
|
||||
'name' => 'menu_order',
|
||||
'prefix' => 'acf_field_group',
|
||||
'value' => $field_group['menu_order'],
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
echo '</div>';
|
||||
echo '<div class="field-group-setting-split">';
|
||||
|
||||
// hide on screen
|
||||
$choices = array(
|
||||
'permalink' => __( 'Permalink', 'acf' ),
|
||||
'the_content' => __( 'Content Editor', 'acf' ),
|
||||
'excerpt' => __( 'Excerpt', 'acf' ),
|
||||
'custom_fields' => __( 'Custom Fields', 'acf' ),
|
||||
'discussion' => __( 'Discussion', 'acf' ),
|
||||
'comments' => __( 'Comments', 'acf' ),
|
||||
'revisions' => __( 'Revisions', 'acf' ),
|
||||
'slug' => __( 'Slug', 'acf' ),
|
||||
'author' => __( 'Author', 'acf' ),
|
||||
'format' => __( 'Format', 'acf' ),
|
||||
'page_attributes' => __( 'Page Attributes', 'acf' ),
|
||||
'featured_image' => __( 'Featured Image', 'acf' ),
|
||||
'categories' => __( 'Categories', 'acf' ),
|
||||
'tags' => __( 'Tags', 'acf' ),
|
||||
'send-trackbacks' => __( 'Send Trackbacks', 'acf' ),
|
||||
);
|
||||
if ( acf_get_setting( 'remove_wp_meta_box' ) ) {
|
||||
unset( $choices['custom_fields'] );
|
||||
}
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Hide on screen', 'acf' ),
|
||||
'instructions' => __( '<b>Select</b> items to <b>hide</b> them from the edit screen.', 'acf' ) . '<br /><br />' . __( "If multiple field groups appear on an edit screen, the first field group's options will be used (the one with the lowest order number)", 'acf' ),
|
||||
'type' => 'checkbox',
|
||||
'name' => 'hide_on_screen',
|
||||
'prefix' => 'acf_field_group',
|
||||
'value' => $field_group['hide_on_screen'],
|
||||
'toggle' => true,
|
||||
'choices' => $choices,
|
||||
),
|
||||
'div',
|
||||
'label',
|
||||
true
|
||||
);
|
||||
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
break;
|
||||
case 'group_settings':
|
||||
echo '<div class="field-group-settings field-group-settings-tab">';
|
||||
|
||||
// active
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Active', 'acf' ),
|
||||
'instructions' => '',
|
||||
'type' => 'true_false',
|
||||
'name' => 'active',
|
||||
'prefix' => 'acf_field_group',
|
||||
'value' => $field_group['active'],
|
||||
'ui' => 1,
|
||||
// 'ui_on_text' => __('Active', 'acf'),
|
||||
// 'ui_off_text' => __('Inactive', 'acf'),
|
||||
)
|
||||
);
|
||||
|
||||
// Show fields in REST API.
|
||||
if ( acf_get_setting( 'rest_api_enabled' ) ) {
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Show in REST API', 'acf' ),
|
||||
'instructions' => '',
|
||||
'type' => 'true_false',
|
||||
'name' => 'show_in_rest',
|
||||
'prefix' => 'acf_field_group',
|
||||
'value' => $field_group['show_in_rest'],
|
||||
'ui' => 1,
|
||||
// 'ui_on_text' => __('Active', 'acf'),
|
||||
// 'ui_off_text' => __('Inactive', 'acf'),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// description
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Description', 'acf' ),
|
||||
'instructions' => __( 'Shown in field group list', 'acf' ),
|
||||
'type' => 'text',
|
||||
'name' => 'description',
|
||||
'prefix' => 'acf_field_group',
|
||||
'value' => $field_group['description'],
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
/* translators: 1: Post creation date 2: Post creation time */
|
||||
$acf_created_on = sprintf( __( 'Created on %1$s at %2$s', 'acf' ), get_the_date(), get_the_time() );
|
||||
?>
|
||||
<div class="acf-field-group-settings-footer">
|
||||
<span class="acf-created-on"><?php echo esc_html( $acf_created_on ); ?></span>
|
||||
<a href="<?php echo get_delete_post_link(); ?>" class="acf-btn acf-btn-tertiary acf-delete-field-group">
|
||||
<i class="acf-icon acf-icon-trash"></i>
|
||||
<?php esc_html_e( 'Delete Field Group', 'acf' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
echo '</div>';
|
||||
break;
|
||||
default:
|
||||
echo '<div class="field-group-' . esc_attr( $tab_key ) . ' field-group-settings-tab">';
|
||||
do_action( 'acf/field_group/render_group_settings_tab/' . $tab_key, $field_group );
|
||||
echo '</div>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 3rd party settings
|
||||
do_action( 'acf/render_field_group_settings', $field_group );
|
||||
?>
|
||||
|
||||
<div class="acf-hidden">
|
||||
<input type="hidden" name="acf_field_group[key]" value="<?php echo $field_group['key']; ?>" />
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
if( typeof acf !== 'undefined' ) {
|
||||
|
||||
acf.newPostbox({
|
||||
'id': 'acf-field-group-options',
|
||||
'label': 'top'
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
$acf_field_group_pro_features_title = __( 'Unlock Advanced Features and Build Even More with ACF PRO', 'acf' );
|
||||
$acf_learn_more_text = __( 'Learn More', 'acf' );
|
||||
$acf_learn_more_link = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'ACF upgrade', 'metabox' );
|
||||
$acf_learn_more_target = '_blank';
|
||||
$acf_pricing_text = __( 'View Pricing & Upgrade', 'acf' );
|
||||
$acf_pricing_link = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'ACF upgrade', 'metabox_pricing', 'pricing-table' );
|
||||
$acf_more_tools_link = acf_add_url_utm_tags( 'https://wpengine.com/developer/', 'bx_prod_referral', 'acf_free_plugin_cta_panel_logo', false, 'acf_plugin', 'referral' );
|
||||
$acf_wpengine_logo_link = acf_add_url_utm_tags( 'https://wpengine.com/', 'bx_prod_referral', 'acf_free_plugin_cta_panel_logo', false, 'acf_plugin', 'referral' );
|
||||
|
||||
if ( acf_is_pro() ) {
|
||||
if ( ! acf_pro_get_license_key() && acf_is_updates_page_visible() ) {
|
||||
$acf_learn_more_target = '';
|
||||
$acf_learn_more_text = __( 'Manage License', 'acf' );
|
||||
$acf_learn_more_link = esc_url( admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates#acf_pro_license' ) );
|
||||
} elseif ( acf_pro_is_license_expired() ) {
|
||||
$acf_pricing_text = __( 'Renew License', 'acf' );
|
||||
$acf_pricing_link = acf_add_url_utm_tags( acf_pro_get_manage_license_url(), 'ACF renewal', 'metabox' );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<div id="tmpl-acf-field-group-pro-features">
|
||||
<div class="acf-field-group-pro-features-wrapper">
|
||||
<h1 class="acf-field-group-pro-features-title-sm"><?php echo esc_html( $acf_field_group_pro_features_title ); ?> <div class="acf-pro-label">PRO</div></h1>
|
||||
<div class="acf-field-group-pro-features-content">
|
||||
<h1 class="acf-field-group-pro-features-title"><?php echo esc_html( $acf_field_group_pro_features_title ); ?> <div class="acf-pro-label">PRO</div></h1>
|
||||
<p class="acf-field-group-pro-features-desc"><?php esc_html_e( 'Speed up your workflow and develop better websites with features like ACF Blocks and Options Pages, and sophisticated field types like Repeater, Flexible Content, Clone, and Gallery.', 'acf' ); ?></p>
|
||||
<div class="acf-field-group-pro-features-actions">
|
||||
<a target="<?php echo $acf_learn_more_target; ?>" href="<?php echo $acf_learn_more_link; ?>" class="acf-btn acf-btn-muted acf-pro-features-learn-more"><?php echo esc_html( $acf_learn_more_text ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i></a>
|
||||
<a target="_blank" href="<?php echo $acf_pricing_link; ?>" class="acf-btn acf-pro-features-upgrade"><?php echo esc_html( $acf_pricing_text ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="acf-field-group-pro-features-grid">
|
||||
<div class="acf-field-group-pro-feature">
|
||||
<i class="field-type-icon field-type-icon-flexible-content"></i>
|
||||
<span class="field-type-label"><?php esc_html_e( 'Flexible Content Field', 'acf' ); ?></span>
|
||||
</div>
|
||||
<div class="acf-field-group-pro-feature">
|
||||
<i class="field-type-icon field-type-icon-repeater"></i>
|
||||
<span class="field-type-label"><?php esc_html_e( 'Repeater Field', 'acf' ); ?></span>
|
||||
</div>
|
||||
<div class="acf-field-group-pro-feature">
|
||||
<i class="field-type-icon field-type-icon-clone"></i>
|
||||
<span class="field-type-label"><?php esc_html_e( 'Clone Field', 'acf' ); ?></span>
|
||||
</div>
|
||||
<div class="acf-field-group-pro-feature">
|
||||
<i class="field-type-icon pro-feature-blocks"></i>
|
||||
<span class="field-type-label"><?php esc_html_e( 'ACF Blocks', 'acf' ); ?></span>
|
||||
</div>
|
||||
<div class="acf-field-group-pro-feature">
|
||||
<i class="field-type-icon pro-feature-options-pages"></i>
|
||||
<span class="field-type-label"><?php esc_html_e( 'Options Pages', 'acf' ); ?></span>
|
||||
</div>
|
||||
<div class="acf-field-group-pro-feature">
|
||||
<i class="field-type-icon field-type-icon-gallery"></i>
|
||||
<span class="field-type-label"><?php esc_html_e( 'Gallery Field', 'acf' ); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="acf-field-group-pro-features-footer-wrap">
|
||||
<div class="acf-field-group-pro-features-footer">
|
||||
<div class="acf-for-the-builders">
|
||||
<?php
|
||||
$acf_wpengine_logo = acf_get_url( 'assets/images/wp-engine-horizontal-white.svg' );
|
||||
$acf_wpengine_logo = sprintf( '<a href="%s" target="_blank"><img class="acf-field-group-pro-features-wpengine-logo" src="%s" alt="WP Engine" /></a>', $acf_wpengine_logo_link, $acf_wpengine_logo );
|
||||
/* translators: %s - WP Engine logo */
|
||||
$acf_made_for_text = sprintf( __( 'Built for those that build with WordPress, by the team at %s', 'acf' ), $acf_wpengine_logo );
|
||||
echo acf_esc_html( $acf_made_for_text );
|
||||
?>
|
||||
</div>
|
||||
<div class="acf-more-tools-from-wpengine">
|
||||
<a href="<?php echo $acf_more_tools_link; ?>" target="_blank"><?php esc_html_e( 'More Tools from WP Engine', 'acf' ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
( function ( $, undefined ) {
|
||||
$( document ).ready( function() {
|
||||
if ( 'field_group' === acf.get( 'screen' ) ) {
|
||||
$( '#acf-field-group-options' ).after( $( '#tmpl-acf-field-group-pro-features' ).css( 'display', 'block' ) );
|
||||
} else {
|
||||
$( '#tmpl-acf-field-group-pro-features' ).appendTo( '#wpbody-content .wrap' ).css( 'display', 'block' );
|
||||
}
|
||||
} );
|
||||
} )( jQuery );
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
global $acf_post_type;
|
||||
|
||||
$acf_duplicate_post_type = acf_get_post_type_from_request_args( 'acfduplicate' );
|
||||
|
||||
if ( acf_is_post_type( $acf_duplicate_post_type ) ) {
|
||||
// Reset vars that likely have to be changed.
|
||||
$acf_duplicate_post_type['key'] = uniqid( 'post_type_' );
|
||||
$acf_duplicate_post_type['title'] = '';
|
||||
$acf_duplicate_post_type['labels'] = array_map( '__return_empty_string', $acf_duplicate_post_type['labels'] );
|
||||
$acf_duplicate_post_type['post_type'] = '';
|
||||
$acf_duplicate_post_type['rest_base'] = '';
|
||||
$acf_duplicate_post_type['query_var_name'] = '';
|
||||
$acf_duplicate_post_type['rewrite']['slug'] = '';
|
||||
|
||||
// Rest of the vars can be reused.
|
||||
$acf_post_type = $acf_duplicate_post_type;
|
||||
}
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Plural Label', 'acf' ),
|
||||
/* translators: example post type */
|
||||
'placeholder' => __( 'Movies', 'acf' ),
|
||||
'type' => 'text',
|
||||
'name' => 'name',
|
||||
'key' => 'name',
|
||||
'class' => 'acf_plural_label',
|
||||
'prefix' => 'acf_post_type[labels]',
|
||||
'value' => $acf_post_type['labels']['name'],
|
||||
'required' => true,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Singular Label', 'acf' ),
|
||||
/* translators: example post type */
|
||||
'placeholder' => __( 'Movie', 'acf' ),
|
||||
'type' => 'text',
|
||||
'name' => 'singular_name',
|
||||
'key' => 'singular_name',
|
||||
'class' => 'acf_slugify_to_key acf_singular_label',
|
||||
'prefix' => 'acf_post_type[labels]',
|
||||
'value' => $acf_post_type['labels']['singular_name'],
|
||||
'required' => true,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Post Type Key', 'acf' ),
|
||||
'instructions' => __( 'Lower case letters, underscores and dashes only, Max 20 characters.', 'acf' ),
|
||||
/* translators: example post type */
|
||||
'placeholder' => __( 'movie', 'acf' ),
|
||||
'type' => 'text',
|
||||
'name' => 'post_type',
|
||||
'key' => 'post_type',
|
||||
'maxlength' => 20,
|
||||
'class' => 'acf_slugified_key',
|
||||
'prefix' => 'acf_post_type',
|
||||
'value' => $acf_post_type['post_type'],
|
||||
'required' => true,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
// Allow preselecting the linked taxonomies based on previously created taxonomy.
|
||||
$acf_use_taxonomy = acf_get_taxonomy_from_request_args( 'create-post-type' );
|
||||
if ( $acf_use_taxonomy && ! empty( $acf_use_taxonomy['taxonomy'] ) ) {
|
||||
$acf_post_type['taxonomies'] = array( $acf_use_taxonomy['taxonomy'] );
|
||||
}
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'taxonomies',
|
||||
'key' => 'taxonomies',
|
||||
'prefix' => 'acf_post_type',
|
||||
'value' => $acf_post_type['taxonomies'],
|
||||
'label' => __( 'Taxonomies', 'acf' ),
|
||||
'instructions' => __( 'Select existing taxonomies to classify items of the post type.', 'acf' ),
|
||||
'choices' => acf_get_taxonomy_labels(),
|
||||
'ui' => true,
|
||||
'allow_null' => true,
|
||||
'multiple' => true,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap( array( 'type' => 'seperator' ) );
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'type' => 'true_false',
|
||||
'name' => 'public',
|
||||
'key' => 'public',
|
||||
'prefix' => 'acf_post_type',
|
||||
'value' => $acf_post_type['public'],
|
||||
'label' => __( 'Public', 'acf' ),
|
||||
'instructions' => __( 'Visible on the frontend and in the admin dashboard.', 'acf' ),
|
||||
'ui' => true,
|
||||
'default' => 1,
|
||||
),
|
||||
'div'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'type' => 'true_false',
|
||||
'name' => 'hierarchical',
|
||||
'key' => 'hierarchical',
|
||||
'class' => 'acf_hierarchical_switch',
|
||||
'prefix' => 'acf_post_type',
|
||||
'value' => $acf_post_type['hierarchical'],
|
||||
'label' => __( 'Hierarchical', 'acf' ),
|
||||
'instructions' => __( 'Hierarchical post types can have descendants (like pages).', 'acf' ),
|
||||
'ui' => true,
|
||||
),
|
||||
'div'
|
||||
);
|
||||
|
||||
do_action( 'acf/post_type/basic_settings', $acf_post_type );
|
||||
|
||||
acf_render_field_wrap( array( 'type' => 'seperator' ) );
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Advanced Configuration', 'acf' ),
|
||||
'instructions' => __( 'I know what I\'m doing, show me all the options.', 'acf' ),
|
||||
'type' => 'true_false',
|
||||
'name' => 'advanced_configuration',
|
||||
'key' => 'advanced_configuration',
|
||||
'prefix' => 'acf_post_type',
|
||||
'value' => $acf_post_type['advanced_configuration'],
|
||||
'ui' => 1,
|
||||
'class' => 'acf-advanced-settings-toggle',
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="acf-hidden">
|
||||
<input type="hidden" name="acf_post_type[key]" value="<?php echo esc_attr( $acf_post_type['key'] ); ?>" />
|
||||
<input type="hidden" name="acf_post_type[import_source]" value="<?php echo esc_attr( $acf_post_type['import_source'] ); ?>" />
|
||||
<input type="hidden" name="acf_post_type[import_date]" value="<?php echo esc_attr( $acf_post_type['import_date'] ); ?>" />
|
||||
</div>
|
||||
<?php
|
||||
@@ -0,0 +1,18 @@
|
||||
<script>document.body.classList.add('acf-no-post-types');</script>
|
||||
<div class="acf-no-post-types-wrapper">
|
||||
<div class="acf-no-post-types-inner">
|
||||
<img src="<?php echo esc_url( acf_get_url( 'assets/images/empty-post-types.svg' ) ); ?>" />
|
||||
<h2><?php esc_html_e( 'Add Your First Post Type', 'acf' ); ?></h2>
|
||||
<p><?php esc_html_e( 'Expand the functionality of WordPress beyond standard posts and pages with custom post types.', 'acf' ); ?></p>
|
||||
<a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=acf-post-type' ) ); ?>" class="acf-btn"><i class="acf-icon acf-icon-plus"></i> <?php esc_html_e( 'Add Post Type', 'acf' ); ?></a>
|
||||
<p class="acf-small">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s url to getting started guide */
|
||||
__( 'New to ACF? Take a look at our <a href="%s" target="_blank">getting started guide</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-post-types' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
global $acf_taxonomy;
|
||||
|
||||
$acf_duplicate_taxonomy = acf_get_taxonomy_from_request_args( 'acfduplicate' );
|
||||
|
||||
if ( acf_is_taxonomy( $acf_duplicate_taxonomy ) ) {
|
||||
// Reset vars that likely have to be changed.
|
||||
$acf_duplicate_taxonomy['key'] = uniqid( 'taxonomy_' );
|
||||
$acf_duplicate_taxonomy['title'] = '';
|
||||
$acf_duplicate_taxonomy['labels'] = array_map( '__return_empty_string', $acf_duplicate_taxonomy['labels'] );
|
||||
$acf_duplicate_taxonomy['taxonomy'] = '';
|
||||
$acf_duplicate_taxonomy['rewrite']['slug'] = '';
|
||||
$acf_duplicate_taxonomy['query_var_name'] = '';
|
||||
$acf_duplicate_taxonomy['rest_base'] = '';
|
||||
|
||||
// Rest of the vars can be reused.
|
||||
$acf_taxonomy = $acf_duplicate_taxonomy;
|
||||
}
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Plural Label', 'acf' ),
|
||||
/* translators: example taxonomy */
|
||||
'placeholder' => __( 'Genres', 'acf' ),
|
||||
'type' => 'text',
|
||||
'key' => 'name',
|
||||
'name' => 'name',
|
||||
'class' => 'acf_plural_label',
|
||||
'prefix' => 'acf_taxonomy[labels]',
|
||||
'value' => $acf_taxonomy['labels']['name'],
|
||||
'required' => 1,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Singular Label', 'acf' ),
|
||||
/* translators: example taxonomy */
|
||||
'placeholder' => __( 'Genre', 'acf' ),
|
||||
'type' => 'text',
|
||||
'key' => 'singular_name',
|
||||
'name' => 'singular_name',
|
||||
'class' => 'acf_slugify_to_key acf_singular_label',
|
||||
'prefix' => 'acf_taxonomy[labels]',
|
||||
'value' => $acf_taxonomy['labels']['singular_name'],
|
||||
'required' => 1,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Taxonomy Key', 'acf' ),
|
||||
'instructions' => __( 'Lower case letters, underscores and dashes only, Max 32 characters.', 'acf' ),
|
||||
/* translators: example taxonomy */
|
||||
'placeholder' => __( 'genre', 'acf' ),
|
||||
'type' => 'text',
|
||||
'key' => 'taxonomy',
|
||||
'name' => 'taxonomy',
|
||||
'maxlength' => 32,
|
||||
'class' => 'acf_slugified_key',
|
||||
'prefix' => 'acf_taxonomy',
|
||||
'value' => $acf_taxonomy['taxonomy'],
|
||||
'required' => 1,
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
// Allow preselecting the linked post types based on previously created post type.
|
||||
$acf_use_post_type = acf_get_post_type_from_request_args( 'create-taxonomy' );
|
||||
if ( $acf_use_post_type && ! empty( $acf_use_post_type['post_type'] ) ) {
|
||||
$acf_taxonomy['object_type'] = array( $acf_use_post_type['post_type'] );
|
||||
}
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Post Types', 'acf' ),
|
||||
'type' => 'select',
|
||||
'name' => 'object_type',
|
||||
'prefix' => 'acf_taxonomy',
|
||||
'value' => $acf_taxonomy['object_type'],
|
||||
'choices' => acf_get_pretty_post_types(),
|
||||
'multiple' => 1,
|
||||
'ui' => 1,
|
||||
'allow_null' => 1,
|
||||
'instructions' => __( 'One or many post types that can be classified with this taxonomy.', 'acf' ),
|
||||
),
|
||||
'div',
|
||||
'field'
|
||||
);
|
||||
|
||||
acf_render_field_wrap( array( 'type' => 'seperator' ) );
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'type' => 'true_false',
|
||||
'key' => 'public',
|
||||
'name' => 'public',
|
||||
'prefix' => 'acf_taxonomy',
|
||||
'value' => $acf_taxonomy['public'],
|
||||
'label' => __( 'Public', 'acf' ),
|
||||
'instructions' => __( 'Makes a taxonomy visible on the frontend and in the admin dashboard.', 'acf' ),
|
||||
'ui' => true,
|
||||
'default' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'type' => 'true_false',
|
||||
'key' => 'hierarchical',
|
||||
'name' => 'hierarchical',
|
||||
'class' => 'acf_hierarchical_switch',
|
||||
'prefix' => 'acf_taxonomy',
|
||||
'value' => $acf_taxonomy['hierarchical'],
|
||||
'label' => __( 'Hierarchical', 'acf' ),
|
||||
'instructions' => __( 'Hierarchical taxonomies can have descendants (like categories).', 'acf' ),
|
||||
'ui' => true,
|
||||
),
|
||||
'div'
|
||||
);
|
||||
|
||||
do_action( 'acf/taxonomy/basic_settings', $acf_taxonomy );
|
||||
|
||||
acf_render_field_wrap( array( 'type' => 'seperator' ) );
|
||||
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'label' => __( 'Advanced Configuration', 'acf' ),
|
||||
'instructions' => __( 'I know what I\'m doing, show me all the options.', 'acf' ),
|
||||
'type' => 'true_false',
|
||||
'key' => 'advanced_configuration',
|
||||
'name' => 'advanced_configuration',
|
||||
'prefix' => 'acf_taxonomy',
|
||||
'value' => $acf_taxonomy['advanced_configuration'],
|
||||
'ui' => 1,
|
||||
'class' => 'acf-advanced-settings-toggle',
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="acf-hidden">
|
||||
<input type="hidden" name="acf_taxonomy[key]" value="<?php echo esc_attr( $acf_taxonomy['key'] ); ?>" />
|
||||
<input type="hidden" name="acf_taxonomy[import_source]" value="<?php echo esc_attr( $acf_taxonomy['import_source'] ); ?>" />
|
||||
<input type="hidden" name="acf_taxonomy[import_date]" value="<?php echo esc_attr( $acf_taxonomy['import_date'] ); ?>" />
|
||||
</div>
|
||||
<?php
|
||||
@@ -0,0 +1,18 @@
|
||||
<script>document.body.classList.add('acf-no-taxonomies');</script>
|
||||
<div class="acf-no-taxonomies-wrapper">
|
||||
<div class="acf-no-taxonomies-inner">
|
||||
<img src="<?php echo esc_url( acf_get_url( 'assets/images/empty-taxonomies.svg' ) ); ?>" />
|
||||
<h2><?php esc_html_e( 'Add Your First Taxonomy', 'acf' ); ?></h2>
|
||||
<p><?php esc_html_e( 'Create custom taxonomies to classify post type content', 'acf' ); ?></p>
|
||||
<a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=acf-taxonomy' ) ); ?>" class="acf-btn"><i class="acf-icon acf-icon-plus"></i> <?php esc_html_e( 'Add Taxonomy', 'acf' ); ?></a>
|
||||
<p class="acf-small">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s url to getting started guide */
|
||||
__( 'New to ACF? Take a look at our <a href="%s" target="_blank">getting started guide</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-taxonomies' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
//phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- included template file.
|
||||
|
||||
$browse_fields_tabs = array( 'popular' => __( 'Popular', 'acf' ) );
|
||||
$browse_fields_tabs = $browse_fields_tabs + acf_get_field_categories_i18n();
|
||||
?>
|
||||
<div class="acf-browse-fields-modal-wrap">
|
||||
<div class="acf-modal acf-browse-fields-modal">
|
||||
<div class="acf-field-picker">
|
||||
<div class="acf-modal-title">
|
||||
<h1><?php esc_html_e( 'Select Field Type', 'acf' ); ?></h1>
|
||||
<span class="acf-search-field-types-wrap">
|
||||
<input class="acf-search-field-types" type="search" placeholder="<?php esc_attr_e( 'Search fields...', 'acf' ); ?>" />
|
||||
</span>
|
||||
</div>
|
||||
<div class="acf-modal-content">
|
||||
<?php
|
||||
foreach ( $browse_fields_tabs as $name => $label ) {
|
||||
acf_render_field_wrap(
|
||||
array(
|
||||
'type' => 'tab',
|
||||
'label' => $label,
|
||||
'key' => 'acf_browse_fields_tabs',
|
||||
)
|
||||
);
|
||||
|
||||
printf(
|
||||
'<div class="acf-field-types-tab" data-category="%s"></div>',
|
||||
esc_attr( $name )
|
||||
);
|
||||
}
|
||||
?>
|
||||
<div class="acf-field-type-search-results"></div>
|
||||
<div class="acf-field-type-search-no-results">
|
||||
<img src="<?php echo esc_url( acf_get_url( 'assets/images/face-sad.svg' ) ); ?>" />
|
||||
<p class="acf-no-results-text">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: The invalid search term */
|
||||
acf_esc_html( __( "No search results for '%s'", 'acf' ) ),
|
||||
'<span class="acf-invalid-search-term"></span>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
$browse_popular_link = '<a href="#" class="acf-browse-popular-fields">' . esc_html( __( 'Popular fields', 'acf' ) ) . '</a>';
|
||||
printf(
|
||||
/* translators: %s: A link to the popular fields used in ACF */
|
||||
acf_esc_html( __( 'Try a different search term or browse %s', 'acf' ) ),
|
||||
$browse_popular_link //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="acf-modal-toolbar acf-field-picker-toolbar">
|
||||
<div class="acf-field-picker-label">
|
||||
<input class="acf-insert-field-label" type="text" placeholder="<?php esc_attr_e( 'Field Label', 'acf' ); ?>" />
|
||||
</div>
|
||||
<div class="acf-field-picker-actions">
|
||||
<button class="button acf-cancel acf-modal-close"><?php esc_html_e( 'Cancel', 'acf' ); ?></button>
|
||||
<button class="acf-btn acf-select-field"><?php esc_html_e( 'Select Field', 'acf' ); ?></button>
|
||||
<a target="_blank" data-url-base="<?php echo esc_attr( acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'field-type-modal', '' ) ); ?>" class="acf-btn acf-btn-pro">
|
||||
<?php _e( 'Upgrade to PRO', 'acf' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="acf-field-type-preview">
|
||||
<div class="field-type-info">
|
||||
<h2 class="field-type-name"></h2>
|
||||
<a target="_blank" data-url-base="<?php echo esc_attr( acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'field-type-modal', '' ) ); ?>" class="field-type-upgrade-to-unlock">
|
||||
<i class="acf-icon acf-icon-lock"></i>
|
||||
<?php _e( 'Available with ACF PRO', 'acf' ); ?>
|
||||
</a>
|
||||
<p class="field-type-desc"></p>
|
||||
<div class="field-type-preview-container">
|
||||
<img class="field-type-image" />
|
||||
</div>
|
||||
</div>
|
||||
<ul class="acf-hl field-type-links">
|
||||
<li>
|
||||
<a class="field-type-tutorial" href="#" target="_blank">
|
||||
<i class="acf-icon acf-icon-play"></i>
|
||||
<?php esc_html_e( 'Tutorial', 'acf' ); ?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="field-type-doc" href="#" target="_blank">
|
||||
<i class="acf-icon acf-icon-document"></i>
|
||||
<?php esc_html_e( 'Documentation', 'acf' ); ?>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="acf-modal-backdrop acf-modal-close"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
$acf_plugin_name = acf_is_pro() ? 'ACF PRO' : 'ACF';
|
||||
$acf_plugin_name = '<strong>' . $acf_plugin_name . ' —</strong>';
|
||||
$acf_learn_how_to_fix = '<a href="' . acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/escaping-the-field/', 'docs', '6-2-5-security-changes' ) . '" target="_blank">' . __( 'Learn more', 'acf' ) . '</a>';
|
||||
$acf_class = '';
|
||||
$acf_user_can_acf = false;
|
||||
|
||||
if ( current_user_can( acf_get_setting( 'capability' ) ) ) {
|
||||
$acf_user_can_acf = true;
|
||||
$acf_show_details = ' <a class="acf-show-more-details" href="#">' . __( 'Show details', 'acf' ) . '</a>';
|
||||
$acf_class = ' is-dismissible';
|
||||
} else {
|
||||
$acf_show_details = __( 'Please contact your site administrator or developer for more details.', 'acf' );
|
||||
}
|
||||
|
||||
if ( ! empty( $acf_will_escape ) ) {
|
||||
$acf_escaped = $acf_will_escape;
|
||||
$acf_class .= ' notice-warning acf-will-escape';
|
||||
$acf_error_msg = sprintf(
|
||||
/* translators: %1$s - name of the ACF plugin. %2$s - Link to documentation. %3$s - Link to show more details about the error */
|
||||
__( '%1$s ACF will soon escape unsafe HTML that is rendered by <code>the_field()</code>. We\'ve detected the output of some of your fields will be modified by this change, but this may not be a breaking change. %2$s. %3$s.', 'acf' ),
|
||||
$acf_plugin_name,
|
||||
$acf_learn_how_to_fix,
|
||||
$acf_show_details
|
||||
);
|
||||
} else {
|
||||
$acf_class .= ' notice-error';
|
||||
|
||||
if ( apply_filters( 'acf/the_field/escape_html_optin', false ) ) {
|
||||
$acf_error_msg = sprintf(
|
||||
/* translators: %1$s - name of the ACF plugin. %2$s - Link to documentation. %3$s - Link to show more details about the error */
|
||||
__( '%1$s ACF now automatically escapes unsafe HTML when rendered by <code>the_field</code> or the ACF shortcode. We\'ve detected the output of some of your fields has been modified by this change, but this may not be a breaking change. %2$s. %3$s.', 'acf' ),
|
||||
$acf_plugin_name,
|
||||
$acf_learn_how_to_fix,
|
||||
$acf_show_details
|
||||
);
|
||||
} else {
|
||||
$acf_error_msg = sprintf(
|
||||
/* translators: %1$s - name of the ACF plugin. %2$s - Link to documentation. %3$s - Link to show more details about the error */
|
||||
__( '%1$s ACF now automatically escapes unsafe HTML when rendered by the ACF shortcode. We\'ve detected the output of some of your fields has been modified by this change, but this may not be a breaking change. %2$s. %3$s.', 'acf' ),
|
||||
$acf_plugin_name,
|
||||
$acf_learn_how_to_fix,
|
||||
$acf_show_details
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<div class="acf-admin-notice notice acf-escaped-html-notice<?php echo esc_attr( $acf_class ); ?>">
|
||||
<p><?php echo acf_esc_html( $acf_error_msg ); ?></p>
|
||||
<?php if ( $acf_user_can_acf && ! empty( $acf_escaped ) ) : ?>
|
||||
<ul class="acf-error-details" style="display: none; list-style: disc; margin-left: 14px;">
|
||||
<?php
|
||||
foreach ( $acf_escaped as $acf_field_key => $acf_data ) {
|
||||
$acf_error = sprintf(
|
||||
/* translators: %1$s - The selector used %2$s The field name 3%$s The parent function name */
|
||||
__( '%1$s (%2$s) - rendered via %3$s', 'acf' ),
|
||||
$acf_data['selector'],
|
||||
$acf_data['field'],
|
||||
$acf_data['function']
|
||||
);
|
||||
|
||||
echo '<li>' . esc_html( $acf_error ) . '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
global $title, $post_new_file, $post_type_object, $post;
|
||||
$acf_title_placeholder = apply_filters( 'enter_title_here', __( 'Add title' ), $post );
|
||||
$acf_title = $post->post_title;
|
||||
$acf_post_type = is_object( $post_type_object ) ? $post_type_object->name : '';
|
||||
$acf_publish_btn_name = 'save';
|
||||
$acf_duplicated_from = '';
|
||||
|
||||
if ( 'publish' !== $post->post_status ) {
|
||||
$acf_publish_btn_name = 'publish';
|
||||
}
|
||||
|
||||
if ( 'acf-field-group' === $acf_post_type ) {
|
||||
$acf_use_post_type = acf_get_post_type_from_request_args( 'add-fields' );
|
||||
$acf_use_taxonomy = acf_get_taxonomy_from_request_args( 'add-fields' );
|
||||
$acf_use_options_page = acf_get_ui_options_page_from_request_args( 'add-fields' );
|
||||
|
||||
/* translators: %s - singular label of post type/taxonomy, i.e. "Movie"/"Genre" */
|
||||
$acf_prefilled_title = __( '%s fields', 'acf' );
|
||||
|
||||
/**
|
||||
* Sets a default title to be prefilled (e.g. "Movies Fields") for a post type or taxonomy.
|
||||
*
|
||||
* @since 6.1.5
|
||||
*
|
||||
* @param string $acf_prefilled_title A string to define the prefilled title for a post type or taxonomy.
|
||||
*/
|
||||
$acf_prefilled_title = (string) apply_filters( 'acf/field_group/prefill_title', $acf_prefilled_title );
|
||||
|
||||
if ( $acf_use_post_type && ! empty( $acf_use_post_type['labels']['singular_name'] ) ) {
|
||||
$acf_prefilled_title = sprintf( $acf_prefilled_title, $acf_use_post_type['labels']['singular_name'] );
|
||||
} elseif ( $acf_use_taxonomy && ! empty( $acf_use_taxonomy['labels']['singular_name'] ) ) {
|
||||
$acf_prefilled_title = sprintf( $acf_prefilled_title, $acf_use_taxonomy['labels']['singular_name'] );
|
||||
} elseif ( $acf_use_options_page && ! empty( $acf_use_options_page['page_title'] ) ) {
|
||||
$acf_prefilled_title = sprintf( $acf_prefilled_title, $acf_use_options_page['page_title'] );
|
||||
} else {
|
||||
$acf_prefilled_title = false;
|
||||
}
|
||||
|
||||
if ( empty( $acf_title ) && $acf_prefilled_title ) {
|
||||
$acf_title = $acf_prefilled_title;
|
||||
}
|
||||
} elseif ( in_array( $acf_post_type, array( 'acf-post-type', 'acf-taxonomy' ) ) ) {
|
||||
$acf_duplicate_post_type = acf_get_post_type_from_request_args( 'acfduplicate' );
|
||||
$acf_duplicate_taxonomy = acf_get_taxonomy_from_request_args( 'acfduplicate' );
|
||||
$acf_duplicated_from_label = '';
|
||||
|
||||
if ( $acf_duplicate_post_type && ! empty( $acf_duplicate_post_type['labels']['singular_name'] ) ) {
|
||||
$acf_duplicated_from_label = $acf_duplicate_post_type['labels']['singular_name'];
|
||||
} elseif ( $acf_duplicate_taxonomy && ! empty( $acf_duplicate_taxonomy['labels']['singular_name'] ) ) {
|
||||
$acf_duplicated_from_label = $acf_duplicate_taxonomy['labels']['singular_name'];
|
||||
}
|
||||
|
||||
if ( ! empty( $acf_duplicated_from_label ) ) {
|
||||
/* translators: %s - A singular label for a post type or taxonomy. */
|
||||
$acf_duplicated_from = sprintf( __( ' (Duplicated from %s)', 'acf' ), $acf_duplicated_from_label );
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="acf-headerbar acf-headerbar-field-editor">
|
||||
<div class="acf-headerbar-inner">
|
||||
|
||||
<div class="acf-headerbar-content">
|
||||
<h1 class="acf-page-title">
|
||||
<?php
|
||||
echo esc_html( $title );
|
||||
|
||||
if ( ! empty( $acf_duplicated_from ) ) {
|
||||
echo '<span class="acf-duplicated-from">' . esc_html( $acf_duplicated_from ) . '</span>';
|
||||
}
|
||||
?>
|
||||
</h1>
|
||||
<?php if ( 'acf-field-group' === $acf_post_type ) : ?>
|
||||
<div class="acf-title-wrap">
|
||||
<label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo esc_html( $acf_title_placeholder ); ?></label>
|
||||
<input form="post" type="text" name="post_title" size="30" value="<?php echo esc_attr( $acf_title ); ?>" id="title" class="acf-headerbar-title-field" spellcheck="true" autocomplete="off" placeholder="<?php esc_attr_e( 'Field Group Title', 'acf' ); ?>" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="acf-headerbar-actions" id="submitpost">
|
||||
<?php if ( 'acf-field-group' === $acf_post_type ) : ?>
|
||||
<a href="#" class="acf-btn acf-btn-secondary add-field">
|
||||
<i class="acf-icon acf-icon-plus"></i>
|
||||
<?php esc_html_e( 'Add Field', 'acf' ); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<button form="post" class="acf-btn acf-publish" name="<?php echo esc_attr( $acf_publish_btn_name ); ?>" type="submit">
|
||||
<?php esc_html_e( 'Save Changes', 'acf' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
//phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- included template file.
|
||||
|
||||
global $post_type, $post_type_object, $acf_page_title;
|
||||
$post_new_file = sprintf(
|
||||
'post-new.php?post_type=%s',
|
||||
is_string( $post_type ) ? $post_type : 'acf-field-group'
|
||||
);
|
||||
|
||||
$acf_is_options_page_preview = acf_request_arg( 'page' ) === 'acf_options_preview';
|
||||
|
||||
$page_title = false;
|
||||
if ( isset( $acf_page_title ) ) {
|
||||
$page_title = $acf_page_title;
|
||||
} elseif ( is_object( $post_type_object ) ) {
|
||||
$page_title = $post_type_object->labels->name;
|
||||
}
|
||||
if ( $page_title ) {
|
||||
?>
|
||||
<div class="acf-headerbar">
|
||||
|
||||
<h1 class="acf-page-title">
|
||||
<?php
|
||||
echo esc_html( $page_title );
|
||||
?>
|
||||
<?php if ( $acf_is_options_page_preview ) { ?>
|
||||
<div class="acf-pro-label">PRO</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</h1>
|
||||
<?php if ( $acf_is_options_page_preview ) { ?>
|
||||
<a href="#" class="acf-btn acf-btn-sm disabled">
|
||||
<i class="acf-icon acf-icon-plus"></i>
|
||||
<?php esc_html_e( 'Add Options Page', 'acf' ); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php
|
||||
if ( ! empty( $post_type_object ) && current_user_can( $post_type_object->cap->create_posts ) ) {
|
||||
echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="acf-btn acf-btn-sm"><i class="acf-icon acf-icon-plus"></i>' . esc_html( $post_type_object->labels->add_new ) . '</a>';
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
@@ -0,0 +1,256 @@
|
||||
<?php
|
||||
//phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- included template file.
|
||||
/**
|
||||
* The template for displaying admin navigation.
|
||||
*
|
||||
* @date 27/3/20
|
||||
* @since 5.9.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
global $submenu, $submenu_file, $plugin_page, $acf_page_title;
|
||||
|
||||
// Setup default vars and generate array of navigation items.
|
||||
$parent_slug = 'edit.php?post_type=acf-field-group';
|
||||
$core_tabs = array();
|
||||
$acf_more_items = array();
|
||||
$more_items = array();
|
||||
$wpengine_more_items = array();
|
||||
|
||||
// Hardcoded since future ACF post types will likely live in the "More" menu.
|
||||
$core_tabs_classes = array( 'acf-field-group', 'acf-post-type', 'acf-taxonomy' );
|
||||
$acf_more_items_classes = array( 'acf-ui-options-page', 'acf-tools', 'acf-settings-updates' );
|
||||
|
||||
if ( isset( $submenu[ $parent_slug ] ) ) {
|
||||
foreach ( $submenu[ $parent_slug ] as $i => $sub_item ) {
|
||||
|
||||
// Check user can access page.
|
||||
if ( ! current_user_can( $sub_item[1] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Define tab.
|
||||
$menu_item = array(
|
||||
'text' => $sub_item[0],
|
||||
'url' => $sub_item[2],
|
||||
);
|
||||
|
||||
// Convert submenu slug "test" to "$parent_slug&page=test".
|
||||
if ( ! strpos( $sub_item[2], '.php' ) ) {
|
||||
$menu_item['url'] = add_query_arg( array( 'page' => $sub_item[2] ), $parent_slug );
|
||||
$menu_item['class'] = $sub_item[2];
|
||||
} else {
|
||||
// Build class from URL.
|
||||
$menu_item['class'] = str_replace( 'edit.php?post_type=', '', $sub_item[2] );
|
||||
}
|
||||
|
||||
// Detect active state.
|
||||
if ( $submenu_file === $sub_item[2] || $plugin_page === $sub_item[2] ) {
|
||||
$menu_item['is_active'] = true;
|
||||
}
|
||||
|
||||
// Handle "Add New" versions of edit page.
|
||||
if ( str_replace( 'edit', 'post-new', $sub_item[2] ) === $submenu_file ) {
|
||||
$menu_item['is_active'] = true;
|
||||
}
|
||||
|
||||
// Organize the menu items.
|
||||
if ( in_array( $menu_item['class'], $core_tabs_classes, true ) ) {
|
||||
// Main ACF tabs.
|
||||
$core_tabs[] = $menu_item;
|
||||
|
||||
// Add post types & taxonomies to the more menu as well so we can show them there on smaller screens.
|
||||
if ( in_array( $menu_item['class'], array( 'acf-post-type', 'acf-taxonomy' ), true ) ) {
|
||||
$acf_more_items[] = $menu_item;
|
||||
}
|
||||
} elseif ( in_array( $menu_item['class'], $acf_more_items_classes, true ) ) {
|
||||
// ACF tabs moved to the "More" menu.
|
||||
$acf_more_items[] = $menu_item;
|
||||
} else {
|
||||
// Third party tabs placed into the "More" menu.
|
||||
if ( 'acf_options_preview' === $menu_item['class'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$more_items[] = $menu_item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! acf_get_setting( 'pro' ) ) {
|
||||
$acf_more_items[] = array(
|
||||
'url' => 'edit.php?post_type=acf-field-group&page=acf_options_preview',
|
||||
'text' => __( 'Options Pages', 'acf' ) . '<span class="acf-requires-pro">' . __( 'PRO', 'acf' ) . '</span>',
|
||||
'target' => '_self',
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! defined( 'PWP_NAME' ) ) {
|
||||
$acf_wpengine_logo = acf_get_url( 'assets/images/wp-engine-horizontal-black.svg' );
|
||||
$acf_wpengine_logo = sprintf( '<span><img class="acf-wp-engine-pro" src="%s" alt="WP Engine" /></span>', $acf_wpengine_logo );
|
||||
$utm_content = acf_is_pro() ? 'acf_pro_plugin_topbar_dropdown_cta' : 'acf_free_plugin_topbar_dropdown_cta';
|
||||
$wpengine_more_items[] = array(
|
||||
'url' => acf_add_url_utm_tags( 'https://wpengine.com/plans/?coupon=freedomtocreate', 'bx_prod_referral', $utm_content, false, 'acf_plugin', 'referral' ),
|
||||
'text' => $acf_wpengine_logo . '<span class="acf-wp-engine-upsell-pill">' . __( '4 Months Free', 'acf' ) . '</span>',
|
||||
'target' => '_blank',
|
||||
'li_class' => 'acf-wp-engine',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the admin navigation more items.
|
||||
*
|
||||
* @since 5.9.0
|
||||
*
|
||||
* @param array $more_items The array of navigation tabs.
|
||||
*/
|
||||
$more_items = apply_filters( 'acf/admin/toolbar', $more_items );
|
||||
|
||||
// Bail early if set to false.
|
||||
if ( $core_tabs === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$acf_wpengine_logo_link = acf_add_url_utm_tags(
|
||||
'https://wpengine.com/',
|
||||
'bx_prod_referral',
|
||||
acf_is_pro() ? 'acf_pro_plugin_topbar_logo' : 'acf_free_plugin_topbar_logo',
|
||||
false,
|
||||
'acf_plugin',
|
||||
'referral'
|
||||
);
|
||||
|
||||
/**
|
||||
* Helper function for looping over the provided menu items
|
||||
* and echoing out the necessary markup.
|
||||
*
|
||||
* @since 6.2
|
||||
*
|
||||
* @param array $menu_items An array of menu items to print.
|
||||
* @param string $section The section being printed.
|
||||
* @return void
|
||||
*/
|
||||
function acf_print_menu_section( $menu_items, $section = '' ) {
|
||||
// Bail if no menu items.
|
||||
if ( ! is_array( $menu_items ) || empty( $menu_items ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$section_html = '';
|
||||
|
||||
foreach ( $menu_items as $menu_item ) {
|
||||
$class = ! empty( $menu_item['class'] ) ? $menu_item['class'] : $menu_item['text'];
|
||||
$target = ! empty( $menu_item['target'] ) ? ' target="' . esc_attr( $menu_item['target'] ) . '"' : '';
|
||||
$li_class = ! empty( $menu_item['li_class'] ) ? $menu_item['li_class'] : '';
|
||||
|
||||
$html = sprintf(
|
||||
'<a class="acf-tab%s %s" href="%s"%s><i class="acf-icon"></i>%s</a>',
|
||||
! empty( $menu_item['is_active'] ) ? ' is-active' : '',
|
||||
'acf-header-tab-' . acf_slugify( $class ),
|
||||
esc_url( $menu_item['url'] ),
|
||||
$target,
|
||||
acf_esc_html( $menu_item['text'] )
|
||||
);
|
||||
|
||||
if ( 'core' !== $section ) {
|
||||
if ( $li_class === '' ) {
|
||||
$html = '<li>' . $html . '</li>';
|
||||
} else {
|
||||
$html = sprintf( '<li class="%s">', $li_class ) . $html . '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
$section_html .= $html;
|
||||
}
|
||||
|
||||
echo $section_html;
|
||||
}
|
||||
?>
|
||||
<div class="acf-admin-toolbar">
|
||||
<div class="acf-admin-toolbar-inner">
|
||||
<div class="acf-nav-wrap">
|
||||
<a href="<?php echo admin_url( 'edit.php?post_type=acf-field-group' ); ?>" class="acf-logo">
|
||||
<img src="<?php echo acf_get_url( 'assets/images/acf-logo.svg' ); ?>" alt="<?php esc_attr_e( 'Advanced Custom Fields logo', 'acf' ); ?>">
|
||||
<?php if ( acf_is_pro() && acf_pro_is_license_active() ) { ?>
|
||||
<div class="acf-pro-label">PRO</div>
|
||||
<?php } ?>
|
||||
</a>
|
||||
|
||||
<h2><?php echo acf_get_setting( 'name' ); ?></h2>
|
||||
<?php acf_print_menu_section( $core_tabs, 'core' ); ?>
|
||||
<?php if ( $acf_more_items || $more_items ) { ?>
|
||||
<div class="acf-more acf-header-tab-acf-more" tabindex="0">
|
||||
<span class="acf-tab acf-more-tab"><i class="acf-icon acf-icon-more"></i><?php esc_html_e( 'More', 'acf' ); ?> <i class="acf-icon acf-icon-dropdown"></i></span>
|
||||
<ul>
|
||||
<?php
|
||||
if ( $acf_more_items ) {
|
||||
if ( $more_items ) {
|
||||
echo '<li class="acf-more-section-header"><span class="acf-tab acf-tab-header">ACF</span></li>';
|
||||
}
|
||||
acf_print_menu_section( $acf_more_items, 'acf' );
|
||||
}
|
||||
if ( $more_items ) {
|
||||
echo '<li class="acf-more-section-header"><span class="acf-tab acf-tab-header">' . esc_html__( 'Other', 'acf' ) . ' </span></li>';
|
||||
acf_print_menu_section( $more_items );
|
||||
}
|
||||
if ( $wpengine_more_items ) {
|
||||
acf_print_menu_section( $wpengine_more_items );
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="acf-nav-upgrade-wrap">
|
||||
<?php
|
||||
if ( ! acf_is_pro() || ! acf_pro_is_license_active() ) {
|
||||
$unlock_url = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'ACF upgrade', 'header' );
|
||||
$unlock_target = '_blank';
|
||||
$unlock_text = __( 'Unlock Extra Features with ACF PRO', 'acf' );
|
||||
|
||||
if ( acf_is_pro() ) {
|
||||
if ( acf_is_updates_page_visible() ) {
|
||||
$unlock_url = admin_url( 'edit.php?post_type=acf-field-group&page=acf-settings-updates#acf_pro_license' );
|
||||
$unlock_target = '';
|
||||
}
|
||||
|
||||
if ( acf_pro_is_license_expired() ) {
|
||||
$unlock_url = acf_add_url_utm_tags( acf_pro_get_manage_license_url(), 'ACF renewal', 'header' );
|
||||
$unlock_target = '_blank';
|
||||
$unlock_text = __( 'Renew ACF PRO License', 'acf' );
|
||||
}
|
||||
}
|
||||
?>
|
||||
<a target="<?php echo esc_attr( $unlock_target ); ?>" href="<?php echo esc_url( $unlock_url ); ?>" class="btn-upgrade acf-admin-toolbar-upgrade-btn">
|
||||
<i class="acf-icon acf-icon-stars"></i>
|
||||
<p><?php echo esc_html( $unlock_text ); ?></p>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<a href="<?php echo $acf_wpengine_logo_link; ?>" target="_blank" class="acf-nav-wpengine-logo">
|
||||
<img src="<?php echo esc_url( acf_get_url( 'assets/images/wp-engine-horizontal-white.svg' ) ); ?>" alt="<?php esc_html_e( 'WP Engine logo', 'acf' ); ?>" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
global $plugin_page;
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( ! in_array( $screen->id, acf_get_internal_post_types(), true ) ) {
|
||||
if ( $plugin_page == 'acf-tools' ) {
|
||||
$acf_page_title = __( 'Tools', 'acf' );
|
||||
} elseif ( $plugin_page == 'acf-settings-updates' ) {
|
||||
$acf_page_title = __( 'Updates', 'acf' );
|
||||
} elseif ( $plugin_page == 'acf_options_preview' && ! acf_is_pro() ) {
|
||||
$acf_page_title = __( 'Options Pages', 'acf' );
|
||||
}
|
||||
acf_get_view( 'global/header' );
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
$acf_learn_more_link = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'ACF upgrade', 'no-options-pages' );
|
||||
$acf_upgrade_button = acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'ACF upgrade', 'no-options-pages-pricing', 'pricing-table' );
|
||||
|
||||
$acf_options_pages_desc = sprintf(
|
||||
/* translators: %s URL to ACF options pages documentation */
|
||||
__( 'ACF <a href="%s" target="_blank">options pages</a> are custom admin pages for managing global settings via fields. You can create multiple pages and sub-pages.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/options-page/', 'docs', 'no-options-pages' )
|
||||
);
|
||||
|
||||
$acf_getting_started = sprintf(
|
||||
/* translators: %s url to getting started guide */
|
||||
__( 'New to ACF? Take a look at our <a href="%s" target="_blank">getting started guide</a>.', 'acf' ),
|
||||
acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/resources/getting-started-with-acf/', 'docs', 'no-options-pages' )
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="wrap acf_options_preview_wrap">
|
||||
<table class="wp-list-table widefat fixed striped">
|
||||
<tbody id="the-list">
|
||||
<tr class="no-items">
|
||||
<td class="colspanchange" colspan="6">
|
||||
<div class="acf-no-field-groups-wrapper">
|
||||
<div class="acf-no-field-groups-inner acf-field-group-pro-features-content">
|
||||
<img src="<?php echo acf_get_url( 'assets/images/empty-post-types.svg' ); ?>" />
|
||||
<h2><?php echo acf_esc_html( 'Upgrade to ACF PRO to create options pages in just a few clicks', 'acf' ); ?></h2>
|
||||
<p><?php echo acf_esc_html( $acf_options_pages_desc ); ?></p>
|
||||
<div class="acf-field-group-pro-features-actions">
|
||||
<a target="_blank" href="<?php echo $acf_learn_more_link; ?>" class="acf-btn acf-btn-muted"><?php esc_html_e( 'Learn More', 'acf' ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i></a>
|
||||
<a target="_blank" href="<?php echo $acf_upgrade_button; ?>" class="acf-btn acf-options-pages-preview-upgrade-button"> <?php esc_html_e( 'Upgrade to ACF PRO', 'acf' ); ?> <i class="acf-icon acf-icon-arrow-up-right"></i></a>
|
||||
</div>
|
||||
<p class="acf-small"><?php echo acf_esc_html( $acf_getting_started ); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* html-admin-tools
|
||||
*
|
||||
* View to output admin tools for both archive and single
|
||||
*
|
||||
* @date 20/10/17
|
||||
* @since 5.6.3
|
||||
*
|
||||
* @param string $screen_id The screen ID used to display metaboxes
|
||||
* @param string $active The active Tool
|
||||
* @return n/a
|
||||
*/
|
||||
|
||||
$class = $active ? 'single' : 'grid';
|
||||
$tool = $active ? ' tool-' . $active : '';
|
||||
?>
|
||||
<div id="acf-admin-tools" class="wrap<?php echo esc_attr( $tool ); ?>">
|
||||
|
||||
<h1><?php _e( 'Tools', 'acf' ); ?> <?php
|
||||
if ( $active ) :
|
||||
?>
|
||||
<a class="page-title-action" href="<?php echo acf_get_admin_tools_url(); ?>"><?php _e( 'Back to all tools', 'acf' ); ?></a><?php endif; ?></h1>
|
||||
|
||||
<div class="acf-meta-box-wrap -<?php echo $class; ?>">
|
||||
<?php do_meta_boxes( $screen_id, 'normal', '' ); ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ( ! acf_is_pro() ) {
|
||||
acf_get_view( 'acf-field-group/pro-features' );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Network Admin Database Upgrade
|
||||
*
|
||||
* Shows the databse upgrade process.
|
||||
*
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
* @param void
|
||||
*/
|
||||
|
||||
?>
|
||||
<style type="text/css">
|
||||
|
||||
/* hide steps */
|
||||
.show-on-complete {
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div id="acf-upgrade-wrap" class="wrap">
|
||||
|
||||
<h1><?php _e( 'Upgrade Database', 'acf' ); ?></h1>
|
||||
|
||||
<p><?php printf( __( 'The following sites require a DB upgrade. Check the ones you want to update and then click %s.', 'acf' ), '"' . __( 'Upgrade Sites', 'acf' ) . '"' ); ?></p>
|
||||
<p><input type="submit" name="upgrade" value="<?php _e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites"></p>
|
||||
|
||||
<table class="wp-list-table widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="manage-column check-column" scope="col">
|
||||
<input type="checkbox" id="sites-select-all">
|
||||
</td>
|
||||
<th class="manage-column" scope="col" style="width:33%;">
|
||||
<label for="sites-select-all"><?php _e( 'Site', 'acf' ); ?></label>
|
||||
</th>
|
||||
<th><?php _e( 'Description', 'acf' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="manage-column check-column" scope="col">
|
||||
<input type="checkbox" id="sites-select-all-2">
|
||||
</td>
|
||||
<th class="manage-column" scope="col">
|
||||
<label for="sites-select-all-2"><?php _e( 'Site', 'acf' ); ?></label>
|
||||
</th>
|
||||
<th><?php _e( 'Description', 'acf' ); ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody id="the-list">
|
||||
<?php
|
||||
|
||||
$sites = acf_get_sites();
|
||||
if ( $sites ) :
|
||||
foreach ( $sites as $i => $site ) :
|
||||
|
||||
// switch blog
|
||||
switch_to_blog( $site['blog_id'] );
|
||||
|
||||
?>
|
||||
<tr
|
||||
<?php
|
||||
if ( $i % 2 == 0 ) :
|
||||
?>
|
||||
class="alternate"<?php endif; ?>>
|
||||
<th class="check-column" scope="row">
|
||||
<?php if ( acf_has_upgrade() ) : ?>
|
||||
<input type="checkbox" value="<?php echo $site['blog_id']; ?>" name="checked[]">
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<td>
|
||||
<strong><?php echo get_bloginfo( 'name' ); ?></strong><br /><?php echo home_url(); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ( acf_has_upgrade() ) : ?>
|
||||
<span class="response"><?php printf( __( 'Site requires database upgrade from %1$s to %2$s', 'acf' ), acf_get_db_version(), ACF_VERSION ); ?></span>
|
||||
<?php else : ?>
|
||||
<?php _e( 'Site is up to date', 'acf' ); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
// restore
|
||||
restore_current_blog();
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><input type="submit" name="upgrade" value="<?php _e( 'Upgrade Sites', 'acf' ); ?>" class="button" id="upgrade-sites-2"></p>
|
||||
<p class="show-on-complete"><?php printf( __( 'Database Upgrade complete. <a href="%s">Return to network dashboard</a>', 'acf' ), network_admin_url() ); ?></p>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
|
||||
var upgrader = new acf.Model({
|
||||
events: {
|
||||
'click #upgrade-sites': 'onClick',
|
||||
'click #upgrade-sites-2': 'onClick'
|
||||
},
|
||||
$inputs: function(){
|
||||
return $('#the-list input:checked');
|
||||
},
|
||||
onClick: function( e, $el ){
|
||||
|
||||
// prevent default
|
||||
e.preventDefault();
|
||||
|
||||
// bail early if no selection
|
||||
if( !this.$inputs().length ) {
|
||||
return alert('<?php _e( 'Please select at least one site to upgrade.', 'acf' ); ?>');
|
||||
}
|
||||
|
||||
// confirm action
|
||||
if( !confirm("<?php _e( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'acf' ); ?>") ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// upgrade
|
||||
this.upgrade();
|
||||
},
|
||||
upgrade: function(){
|
||||
|
||||
// vars
|
||||
var $inputs = this.$inputs();
|
||||
|
||||
// bail early if no sites selected
|
||||
if( !$inputs.length ) {
|
||||
return this.complete();
|
||||
}
|
||||
|
||||
// disable buttons
|
||||
$('.button').prop('disabled', true);
|
||||
|
||||
// vars
|
||||
var $input = $inputs.first();
|
||||
var $row = $input.closest('tr');
|
||||
var text = '';
|
||||
var success = false;
|
||||
|
||||
// show loading
|
||||
$row.find('.response').html('<i class="acf-loading"></i></span> <?php printf( __( 'Upgrading data to version %s', 'acf' ), ACF_VERSION ); ?>');
|
||||
|
||||
// send ajax request to upgrade DB
|
||||
$.ajax({
|
||||
url: acf.get('ajaxurl'),
|
||||
dataType: 'json',
|
||||
type: 'post',
|
||||
data: acf.prepareForAjax({
|
||||
action: 'acf/ajax/upgrade',
|
||||
blog_id: $input.val()
|
||||
}),
|
||||
success: function( json ){
|
||||
success = true;
|
||||
$input.remove();
|
||||
text = '<?php _e( 'Upgrade complete.', 'acf' ); ?>';
|
||||
},
|
||||
error: function( jqXHR, textStatus, errorThrown ){
|
||||
text = '<?php _e( 'Upgrade failed.', 'acf' ); ?>';
|
||||
if( error = acf.getXhrError(jqXHR) ) {
|
||||
text += ' <code>' + error + '</code>';
|
||||
}
|
||||
},
|
||||
complete: this.proxy(function(){
|
||||
|
||||
// display text
|
||||
$row.find('.response').html( text );
|
||||
|
||||
// if successful upgrade, proceed to next site. Otherwise, skip to complete.
|
||||
if( success ) {
|
||||
this.upgrade();
|
||||
} else {
|
||||
this.complete();
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
complete: function(){
|
||||
|
||||
// enable buttons
|
||||
$('.button').prop('disabled', false);
|
||||
|
||||
// show message
|
||||
$('.show-on-complete').show();
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
</div>
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
// calculate add-ons (non pro only)
|
||||
$plugins = array();
|
||||
|
||||
if ( ! acf_get_setting( 'pro' ) ) {
|
||||
if ( is_plugin_active( 'acf-repeater/acf-repeater.php' ) ) {
|
||||
$plugins[] = __( 'Repeater', 'acf' );
|
||||
}
|
||||
if ( is_plugin_active( 'acf-flexible-content/acf-flexible-content.php' ) ) {
|
||||
$plugins[] = __( 'Flexible Content', 'acf' );
|
||||
}
|
||||
if ( is_plugin_active( 'acf-gallery/acf-gallery.php' ) ) {
|
||||
$plugins[] = __( 'Gallery', 'acf' );
|
||||
}
|
||||
if ( is_plugin_active( 'acf-options-page/acf-options-page.php' ) ) {
|
||||
$plugins[] = __( 'Options Page', 'acf' );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<div id="acf-upgrade-notice" class="notice">
|
||||
<div class="notice-container">
|
||||
<div class="col-content">
|
||||
<img src="<?php echo acf_get_url( 'assets/images/acf-logo.png' ); ?>" />
|
||||
<h2><?php _e( 'Database Upgrade Required', 'acf' ); ?></h2>
|
||||
<p><?php printf( __( 'Thank you for updating to %1$s v%2$s!', 'acf' ), acf_get_setting( 'name' ), acf_get_setting( 'version' ) ); ?><br /><?php _e( 'This version contains improvements to your database and requires an upgrade.', 'acf' ); ?></p>
|
||||
<?php if ( ! empty( $plugins ) ) : ?>
|
||||
<p><?php printf( __( 'Please also check all premium add-ons (%s) are updated to the latest version.', 'acf' ), implode( ', ', $plugins ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col-actions">
|
||||
<a id="acf-upgrade-button" href="<?php echo $button_url; ?>" class="acf-btn"><?php echo $button_text; ?></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( $confirm ) : ?>
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
|
||||
$("#acf-upgrade-button").on("click", function(){
|
||||
return confirm("<?php _e( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'acf' ); ?>");
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Admin Database Upgrade
|
||||
*
|
||||
* Shows the databse upgrade process.
|
||||
*
|
||||
* @date 24/8/18
|
||||
* @since 5.7.4
|
||||
* @param void
|
||||
*/
|
||||
|
||||
?>
|
||||
<style type="text/css">
|
||||
|
||||
/* hide steps */
|
||||
.step-1,
|
||||
.step-2,
|
||||
.step-3 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
<div id="acf-upgrade-wrap" class="wrap">
|
||||
|
||||
<h1><?php _e( 'Upgrade Database', 'acf' ); ?></h1>
|
||||
|
||||
<?php if ( acf_has_upgrade() ) : ?>
|
||||
|
||||
<p><?php _e( 'Reading upgrade tasks...', 'acf' ); ?></p>
|
||||
<p class="step-1"><i class="acf-loading"></i> <?php printf( __( 'Upgrading data to version %s', 'acf' ), ACF_VERSION ); ?></p>
|
||||
<p class="step-2"></p>
|
||||
<p class="step-3"><?php printf( __( 'Database upgrade complete. <a href="%s">See what\'s new</a>', 'acf' ), admin_url( 'edit.php?post_type=acf-field-group' ) ); ?></p>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
|
||||
var upgrader = new acf.Model({
|
||||
initialize: function(){
|
||||
|
||||
// allow user to read message for 1 second
|
||||
this.setTimeout( this.upgrade, 1000 );
|
||||
},
|
||||
upgrade: function(){
|
||||
|
||||
// show step 1
|
||||
$('.step-1').show();
|
||||
|
||||
// vars
|
||||
var response = '';
|
||||
var success = false;
|
||||
|
||||
// send ajax request to upgrade DB
|
||||
$.ajax({
|
||||
url: acf.get('ajaxurl'),
|
||||
dataType: 'json',
|
||||
type: 'post',
|
||||
data: acf.prepareForAjax({
|
||||
action: 'acf/ajax/upgrade'
|
||||
}),
|
||||
success: function( json ){
|
||||
success = true;
|
||||
},
|
||||
error: function( jqXHR, textStatus, errorThrown ){
|
||||
response = '<?php _e( 'Upgrade failed.', 'acf' ); ?>';
|
||||
if( error = acf.getXhrError(jqXHR) ) {
|
||||
response += ' <code>' + error + '</code>';
|
||||
}
|
||||
},
|
||||
complete: this.proxy(function(){
|
||||
|
||||
// remove spinner
|
||||
$('.acf-loading').hide();
|
||||
|
||||
// display response
|
||||
if( response ) {
|
||||
$('.step-2').show().html( response );
|
||||
}
|
||||
|
||||
// display success
|
||||
if( success ) {
|
||||
$('.step-3').show();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<p><?php _e( 'No updates available.', 'acf' ); ?></p>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user