fewbricks\acf\field_group::register PHP Method

register() public method

Register a field group.
public register ( )
    public function register()
    {
        global $fewbricks_save_json;
        if (!isset($this->settings['names_of_items_to_hide_on_screen']) && !isset($this->settings['names_of_items_to_show_on_screen'])) {
            $this->settings['hide_on_screen'] = $this->get_hide_on_screen_settings();
        } elseif (isset($this->settings['names_of_items_to_show_on_screen'])) {
            $this->settings['hide_on_screen'] = $this->get_hide_on_screen_settings(false, $this->settings['names_of_items_to_show_on_screen']);
        } else {
            $this->settings['hide_on_screen'] = $this->get_hide_on_screen_settings($this->settings['names_of_items_to_hide_on_screen'], false);
        }
        $this->settings['fields'] = $this->set_unique_keys($this->settings['fields'], $this->settings['key']);
        if (\fewbricks\helpers\is_fewbricks_in_developer_mode()) {
            if ($fewbricks_save_json === true) {
                $this->save_json();
            } elseif (isset($_GET['dumpfewbricksfields'])) {
                $this->print_settings();
            } else {
                $this->check_keys($this->settings['fields']);
            }
        }
        register_field_group($this->settings);
    }

Usage Example

$fewbricks_fc->add_layout($fewbricks_l);
$fewbricks_l = new fewacf\layout('', 'layout_2', '1509060002y');
$fewbricks_l->add_brick(new bricks\demo_buttons_list('blist2', '1509060001t'));
$fewbricks_fc->add_layout($fewbricks_l);
$fewbricks_fg->add_flexible_content($fewbricks_fc);
$fewbricks_fg->register();
/**
 * Buttons list
 * Check demo_buttons_list to see how to set up repeaters.
 */
$fewbricks_fg = new fewacf\field_group('Fewbricks Demo - Buttons list', '1509111339o', $fewbricks_fg_location, 40);
$fewbricks_fg->add_brick((new bricks\demo_buttons_list('buttons_list', '1509052316o'))->set_field_label_prefix('Button list'));
$fewbricks_fg->register();
/**
 * Standard list
 * Also showing off repeaters.
 */
$fewbricks_fg = new fewacf\field_group('Fewbricks Demo - Standard list', '1509111339p', $fewbricks_fg_location, 50);
$fewbricks_fg->add_brick((new bricks\demo_standard_list('a_list', '1509042107x'))->set_field_label_prefix('A list'));
$fewbricks_fg->register();
/**
 * Footer.
 * Shows how to use fields directly in a field group without setting up a brick.
 * Normally you would put global data like this in an options page
 * (http://www.advancedcustomfields.com/resources/acf_add_options_page/). To achieve this,
 * create the options page as decribed by ACF and then set the location to match that options page.
 */
$fewbricks_fg = new fewacf\field_group('Fewbricks Demo - Footer', '1603242347a', $fewbricks_fg_location, 200);
$fewbricks_fg->add_field(new acf_fields\text('Footer text', 'footer_text', '1603242348a'));
$fewbricks_fg->register();
All Usage Examples Of fewbricks\acf\field_group::register