'', // 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 $messages; } /** * Enqueues any scripts necessary for internal post type. * * @since 5.0.0 */ public function admin_enqueue_scripts() { parent::admin_enqueue_scripts(); acf_localize_text( array( 'The string "field_" may not be used at the start of a field name' => esc_html__( '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' => esc_html__( 'This field cannot be moved until its changes have been saved', 'acf' ), 'Field group title is required' => esc_html__( 'Field group title is required', 'acf' ), 'Move field group to trash?' => esc_html__( 'Move field group to trash?', 'acf' ), 'No toggle fields available' => esc_html__( 'No toggle fields available', 'acf' ), 'Move Custom Field' => esc_html__( 'Move Custom Field', 'acf' ), 'Field moved to other group' => esc_html__( 'Field moved to other group', 'acf' ), 'Field groups linked successfully.' => esc_html__( 'Field groups linked successfully.', 'acf' ), 'Checked' => esc_html__( 'Checked', 'acf' ), '(no label)' => esc_html__( '(no label)', 'acf' ), '(this field)' => esc_html__( '(this field)', 'acf' ), 'copy' => esc_html__( 'copy', 'acf' ), 'or' => esc_html__( 'or', 'acf' ), 'Show this field group if' => esc_html__( 'Show this field group if', 'acf' ), 'Null' => esc_html__( 'Null', 'acf' ), 'PRO Only' => esc_html__( 'PRO Only', 'acf' ), // Conditions. 'Has any value' => esc_html__( 'Has any value', 'acf' ), 'Has no value' => esc_html__( 'Has no value', 'acf' ), 'Value is equal to' => esc_html__( 'Value is equal to', 'acf' ), 'Value is not equal to' => esc_html__( 'Value is not equal to', 'acf' ), 'Value matches pattern' => esc_html__( 'Value matches pattern', 'acf' ), 'Value contains' => esc_html__( 'Value contains', 'acf' ), 'Value is greater than' => esc_html__( 'Value is greater than', 'acf' ), 'Value is less than' => esc_html__( 'Value is less than', 'acf' ), 'Selection is greater than' => esc_html__( 'Selection is greater than', 'acf' ), 'Selection is less than' => esc_html__( 'Selection is less than', 'acf' ), 'Relationship is equal to' => esc_html__( 'Relationship is equal to', 'acf' ), 'Relationship is not equal to' => esc_html__( 'Relationship is not equal to', 'acf' ), 'Relationships contain' => esc_html__( 'Relationships contain', 'acf' ), 'Relationships do not contain' => esc_html__( 'Relationships do not contain', 'acf' ), 'Post is equal to' => esc_html__( 'Post is equal to', 'acf' ), 'Post is not equal to' => esc_html__( 'Post is not equal to', 'acf' ), 'Posts contain' => esc_html__( 'Posts contain', 'acf' ), 'Posts do not contain' => esc_html__( 'Posts do not contain', 'acf' ), 'Has any post selected' => esc_html__( 'Has any post selected', 'acf' ), 'Has no post selected' => esc_html__( 'Has no post selected', 'acf' ), 'Has any relationship selected' => esc_html__( 'Has any relationship selected', 'acf' ), 'Has no relationship selected' => esc_html__( 'Has no relationship selected', 'acf' ), 'Page is equal to' => esc_html__( 'Page is equal to', 'acf' ), 'Page is not equal to' => esc_html__( 'Page is not equal to', 'acf' ), 'Pages contain' => esc_html__( 'Pages contain', 'acf' ), 'Pages do not contain' => esc_html__( 'Pages do not contain', 'acf' ), 'Has any page selected' => esc_html__( 'Has any page selected', 'acf' ), 'Has no page selected' => esc_html__( 'Has no page selected', 'acf' ), 'User is equal to' => esc_html__( 'User is equal to', 'acf' ), 'User is not equal to' => esc_html__( 'User is not equal to', 'acf' ), 'Users contain' => esc_html__( 'Users contain', 'acf' ), 'Users do not contain' => esc_html__( 'Users do not contain', 'acf' ), 'Has any user selected' => esc_html__( 'Has any user selected', 'acf' ), 'Has no user selected' => esc_html__( 'Has no user selected', 'acf' ), 'Term is equal to' => esc_html__( 'Term is equal to', 'acf' ), 'Term is not equal to' => esc_html__( 'Term is not equal to', 'acf' ), 'Terms contain' => esc_html__( 'Terms contain', 'acf' ), 'Terms do not contain' => esc_html__( 'Terms do not contain', 'acf' ), 'Has any term selected' => esc_html__( 'Has any term selected', 'acf' ), 'Has no term selected' => esc_html__( 'Has no term selected', 'acf' ), // Custom Select2 templates. 'Type to search...' => esc_html__( 'Type to search...', 'acf' ), 'This Field' => esc_html__( 'This Field', 'acf' ), ) ); acf_localize_data( array( 'fieldTypes' => acf_get_field_types_info(), 'fieldCategoriesL10n' => acf_get_field_categories_i18n(), 'PROUpgradeURL' => acf_add_url_utm_tags( 'https://www.advancedcustomfields.com/pro/', 'ACF upgrade', 'field-type-selection' ), 'PROFieldTypes' => acf_get_pro_field_types(), 'PROLocationTypes' => array( 'block' => esc_html__( 'Block', 'acf' ), 'options_page' => esc_html__( 'Options Page', 'acf' ), ), ) ); do_action( 'acf/field_group/admin_enqueue_scripts' ); } /** * Set up functionality for the field group edit page. * * @since 3.1.8 */ public function admin_head() { 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' ); 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. */ public function edit_form_after_title() { 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( '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 array $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 */ public function admin_footer() { $this->include_pro_features(); do_action( 'acf/field_group/admin_footer' ); } /** * Renders HTML for the ACF PRO features upgrade notice. */ public function include_pro_features() { // Bail if on PRO. if ( acf_is_pro() && acf_pro_is_license_active() ) { return; } // Bail if not the edit field group screen. if ( ! acf_is_screen( 'acf-field-group' ) ) { return; } acf_get_view( 'acf-field-group/pro-features' ); } /** * 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 .= '
' . esc_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 ) . '
' . '' . esc_html__( 'Close Modal', 'acf' ) . ''; die(); } // Get all field groups. $field_groups = acf_get_field_groups(); $choices = array(); if ( ! empty( $field_groups ) ) { 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 '' . esc_html__( 'Please select the destination for this field', 'acf' ) . '
'; echo ''; die(); } } // initialize. new acf_admin_field_group(); endif; // Class exists check. ?>