function acf_get_valid_field_group_key($key = '') { // test if valid if (!acf_is_field_group_key($key)) { // empty if (!$key) { $key = uniqid(); } // add prefix $key = "group_{$key}"; } // return return $key; }
function mb_options() { // global global $post; // vars $field_group = acf_get_field_group($post); // field key (leave in for compatibility) if (!acf_is_field_group_key($field_group['key'])) { $field_group['key'] = uniqid('group_'); } // don't use view because we need access to $this context include acf_get_path('admin/views/field-group-options.php'); }
function get_clone_setting_choice($selector = '') { // bail early no selector if (!$selector) { return ''; } // ajax_fields if (isset($_POST['fields'][$selector])) { return $this->get_clone_setting_field_choice($_POST['fields'][$selector]); } // field if (acf_is_field_key($selector)) { return $this->get_clone_setting_field_choice(acf_get_field($selector)); } // group if (acf_is_field_group_key($selector)) { return $this->get_clone_setting_group_choice(acf_get_field_group($selector)); } // return return $selector; }
<?php // global global $post; // vars $field_group = acf_get_field_group($post); // field key if (!acf_is_field_group_key($field_group['key'])) { $field_group['key'] = uniqid('group_'); } ?> <div class="acf-hidden"> <input type="hidden" name="acf_field_group[key]" value="<?php echo $field_group['key']; ?> " /> </div> <table class="acf-table"> <tbody> <?php // menu_order acf_render_field_wrap(array('label' => __('Order No.', 'acf'), 'instructions' => __('Field groups are created in order <br />from lowest to highest', 'acf'), 'type' => 'number', 'name' => 'menu_order', 'prefix' => 'acf_field_group', 'value' => $field_group['menu_order']), 'tr'); // position acf_render_field_wrap(array('label' => __('Position', 'acf'), 'instructions' => '', 'type' => 'select', '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'), 'tr'); // style acf_render_field_wrap(array('label' => __('Style', 'acf'), 'instructions' => '', 'type' => 'select', 'name' => 'style', 'prefix' => 'acf_field_group', 'value' => $field_group['style'], 'choices' => array('default' => __("Standard (WP metabox)", 'acf'), 'seamless' => __("Seamless (no metabox)", 'acf'))), 'tr'); // label_placement acf_render_field_wrap(array('label' => __('Label placement', 'acf'), 'instructions' => '', 'type' => 'select', 'name' => 'label_placement', 'prefix' => 'acf_field_group', 'value' => $field_group['label_placement'], 'choices' => array('top' => __("Top aligned", 'acf'), 'left' => __("Left Aligned", 'acf'))), 'tr'); // instruction_placement acf_render_field_wrap(array('label' => __('Instruction placement', 'acf'), 'instructions' => '', 'type' => 'select', 'name' => 'instruction_placement', 'prefix' => 'acf_field_group', 'value' => $field_group['instruction_placement'], 'choices' => array('label' => __("Below labels", 'acf'), 'field' => __("Below fields", 'acf'))), 'tr'); // hide on screen