'fmModules', 'label' => __( 'Modules', 'space' ), 'collapsed' => false, 'children' => get_module_module_component() )); $fm->add_meta_box(__( 'Page Modules', 'space' ), 'page', 'show_after_title', 'high'); } function get_module_types() { return array( 'label' => __('Module type', 'space'), 'inline_label' => true, 'options' => array( 'example1panel' => 'Example 1 panel', 'example2panel' => 'Example 2 panel', ), ); } function get_module_module_component() { global $editPostType; $module = array( 'module' => new Fieldmanager_Group(array( 'label' => __('New Module', 'space'), 'label_macro' => array( __( 'Module: %s', 'space' ), 'module_name' ), 'limit' => 0, 'add_more_label' => __( 'Add another module', 'space' ), 'collapsible' => true, 'collapsed' => true, 'sortable' => true, 'starting_count' => 1, 'extra_elements' => 0, 'children' => array( 'type' => new Fieldmanager_Select(get_module_types()), 'module_name' => new Fieldmanager_TextField(array( 'label' => __('Module Name', 'space'), )), 'example1panel' => new Fieldmanager_Group(get_example1_module_component()), 'example2panel' => new Fieldmanager_Group(get_example2_module_component()), ) )) ); return $module; } function get_example1_module_component() { return array( 'label' => __('Example1 panel', 'space'), 'display_if' => array( 'src' => 'type', 'value' => 'example1panel' ), 'children' => array( 'intro' => new Fieldmanager_RichTextArea(array( 'label' => __('Intro', 'space'), )), 'items' => new Fieldmanager_Group(array( 'label' => __('Item', 'space'), 'label_macro' => array( __( 'Item: %s', 'space' ), 'name' ), 'limit' => 0, 'add_more_label' => __( 'Add another item', 'space' ), 'collapsible' => true, 'collapsed' => true, 'sortable' => true, 'starting_count' => 1, 'extra_elements' => 0, 'children' => array( 'name' => new Fieldmanager_TextField(array( 'label' => __('name', 'space'), )), 'type' => new Fieldmanager_Select(array( 'label' => __('Type', 'space'), 'type_ahead' => true, 'first_empty' => true, 'options' => array( 'nested1' => 'Nested 1', 'nested2' => 'Nested 2', ) )), 'nested1' => new Fieldmanager_Group(get_example1_nested1_module_component()), 'nested2' => new Fieldmanager_Group(get_example1_nested2_module_component()), ), )), ) ); }