'', // Unused. Messages start at index 1. 1 => __( 'Field group updated.', 'acf' ), 2 => __( 'Field group updated.', 'acf' ), 3 => __( 'Field group deleted.', 'acf' ), 4 => __( 'Field group updated.', 'acf' ), 5 => false, // field group does not support revisions. 6 => __( 'Field group published.', 'acf' ), 7 => __( 'Field group saved.', 'acf' ), 8 => __( 'Field group submitted.', 'acf' ), 9 => __( 'Field group scheduled for.', 'acf' ), 10 => __( 'Field group draft updated.', 'acf' ), ); // return. return $messages; } /** * This function is fired when loading the admin page before HTML has been rendered. * * @since 5.0.0 * * @return void */ public function current_screen() { // validate screen. if ( ! acf_is_screen( 'acf-field-group' ) ) { return; } // disable filters to ensure ACF loads raw data from DB. acf_disable_filters(); // enqueue scripts. acf_enqueue_scripts(); // actions. add_action( 'admin_body_class', array( $this, 'admin_body_class' ) ); add_action( 'acf/input/admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); add_action( 'acf/input/admin_head', array( $this, 'admin_head' ) ); add_action( 'acf/input/form_data', array( $this, 'form_data' ) ); add_action( 'acf/input/admin_footer', array( $this, 'admin_footer' ) ); // filters. add_filter( 'acf/input/admin_l10n', array( $this, 'admin_l10n' ) ); } /** * Modifies the admin body class. * * @since 6.0.0 * * @param string $classes Space-separated list of CSS classes. * @return string */ public function admin_body_class( $classes ) { $classes .= ' acf-admin-single-field-group'; return $classes; } /** * This action is run after post query but before any admin script / head actions. * It is a good place to register all actions. * * @since 5.0.0 * * @return void */ public function admin_enqueue_scripts() { // no autosave. wp_dequeue_script( 'autosave' ); // custom scripts. wp_enqueue_style( 'acf-field-group' ); wp_enqueue_script( 'acf-field-group' ); // localize text. acf_localize_text( array( 'The string "field_" may not be used at the start of a field name' => __( 'The string "field_" may not be used at the start of a field name', 'acf' ), 'This field cannot be moved until its changes have been saved' => __( 'This field cannot be moved until its changes have been saved', 'acf' ), 'Field group title is required' => __( 'Field group title is required', 'acf' ), 'Move field group to trash?' => __( 'Move field group to trash?', 'acf' ), 'No toggle fields available' => __( 'No toggle fields available', 'acf' ), 'Move Custom Field' => __( 'Move Custom Field', 'acf' ), 'Close modal' => __( 'Close modal', 'acf' ), 'Field moved to other group' => __( 'Field moved to other group', 'acf' ), 'Checked' => __( 'Checked', 'acf' ), '(no label)' => __( '(no label)', 'acf' ), '(this field)' => __( '(this field)', 'acf' ), 'copy' => __( 'copy', 'acf' ), 'or' => __( 'or', 'acf' ), 'Show this field group if' => __( 'Show this field group if', 'acf' ), 'Null' => __( 'Null', 'acf' ), // Conditions. 'Has any value' => __( 'Has any value', 'acf' ), 'Has no value' => __( 'Has no value', 'acf' ), 'Value is equal to' => __( 'Value is equal to', 'acf' ), 'Value is not equal to' => __( 'Value is not equal to', 'acf' ), 'Value matches pattern' => __( 'Value matches pattern', 'acf' ), 'Value contains' => __( 'Value contains', 'acf' ), 'Value is greater than' => __( 'Value is greater than', 'acf' ), 'Value is less than' => __( 'Value is less than', 'acf' ), 'Selection is greater than' => __( 'Selection is greater than', 'acf' ), 'Selection is less than' => __( 'Selection is less than', 'acf' ), // Pro-only fields. 'Repeater (Pro only)' => __( 'Repeater (Pro only)', 'acf' ), 'Flexibly Content (Pro only)' => __( 'Flexible Content (Pro only)', 'acf' ), 'Clone (Pro only)' => __( 'Clone (Pro only)', 'acf' ), 'Gallery (Pro only)' => __( 'Gallery (Pro only)', 'acf' ), ) ); // localize data. acf_localize_data( array( 'fieldTypes' => acf_get_field_types_info(), ) ); // 3rd party hook. do_action( 'acf/field_group/admin_enqueue_scripts' ); } /** * This function will setup all functionality for the field group edit page to work * * @since 3.1.8 * * @return void */ public function admin_head() { // global. global $post, $field_group; // set global var. $field_group = acf_get_field_group( $post->ID ); // metaboxes. add_meta_box( 'acf-field-group-fields', __( 'Fields', 'acf' ), array( $this, 'mb_fields' ), 'acf-field-group', 'normal', 'high' ); if ( ! defined( 'ACF_PRO' ) || ! ACF_PRO ) { add_meta_box( 'acf-field-group-pro-features', 'ACF PRO', array( $this, 'mb_pro_features' ), 'acf-field-group', 'normal', 'high' ); } add_meta_box( 'acf-field-group-options', __( 'Settings', 'acf' ), array( $this, 'mb_options' ), 'acf-field-group', 'normal', 'high' ); // actions. add_action( 'post_submitbox_misc_actions', array( $this, 'post_submitbox_misc_actions' ), 10, 0 ); add_action( 'edit_form_after_title', array( $this, 'edit_form_after_title' ), 10, 0 ); // filters. add_filter( 'screen_settings', array( $this, 'screen_settings' ), 10, 1 ); add_filter( 'get_user_option_screen_layout_acf-field-group', array( $this, 'screen_layout' ), 10, 1 ); // 3rd party hook. do_action( 'acf/field_group/admin_head' ); } /** * This action will allow ACF to render metaboxes after the title * * @date 17/08/13 * * @return void */ public function edit_form_after_title() { // globals. global $post; // render post data. acf_form_data( array( 'screen' => 'field_group', 'post_id' => $post->ID, 'delete_fields' => 0, 'validation' => 0, ) ); } /** * This function will add extra HTML to the acf form data element * * @since 5.3.8 * * @param array $args Arguments array to pass through to action. * @return void */ public function form_data( $args ) { // do action. do_action( 'acf/field_group/form_data', $args ); } /** * This function will append extra l10n strings to the acf JS object * * @since 5.3.8 * * @param array $l10n The array of translated strings. * @return $l10n */ public function admin_l10n( $l10n ) { return apply_filters( 'acf/field_group/admin_l10n', $l10n ); } /** * Admin footer third party hook support * * @since 5.3.2 * * @return void */ public function admin_footer() { // 3rd party hook do_action( 'acf/field_group/admin_footer' ); } /** * Screen settings html output * * @since 3.6.0 * * @param string $html Current screen settings HTML. * @return string $html */ public function screen_settings( $html ) { $show_field_keys = acf_get_user_setting( 'show_field_keys' ) ? 'checked="checked"' : ''; $show_field_settings_tabs = acf_get_user_setting( 'show_field_settings_tabs', true ) ? 'checked="checked"' : ''; $hide_field_settings_tabs = apply_filters( 'acf/field_group/disable_field_settings_tabs', false ); $html .= '
' . __( 'Move Complete.', 'acf' ) . '
' . '' . sprintf( /* translators: Confirmation message once a field has been moved to a different field group. */ acf_punctify( __( 'The %1$s field can now be found in the %2$s field group', 'acf' ) ), esc_html( $field['label'] ), $link //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ) . '
' . '' . __( 'Close Modal', 'acf' ) . ''; die(); } // get all field groups. $field_groups = acf_get_field_groups(); $choices = array(); // check. if ( ! empty( $field_groups ) ) { // loop. foreach ( $field_groups as $field_group ) { // bail early if no ID. if ( ! $field_group['ID'] ) { continue; } // bail early if is current. if ( $field_group['ID'] == $args['post_id'] ) { continue; } $choices[ $field_group['ID'] ] = $field_group['title']; } } // render options. $field = acf_get_valid_field( array( 'type' => 'select', 'name' => 'acf_field_group', 'choices' => $choices, 'aria-label' => __( 'Please select the destination for this field', 'acf' ), ) ); echo '' . __( 'Please select the destination for this field', 'acf' ) . '
'; echo ''; // die. die(); } } // initialize. new acf_admin_field_group(); } ?>