Reorder of repeating group doesn’t apply to textarea_code
-
I can’t post a link, the client literally requires htaccess auth to even view the site.
I have a repeating group of fields that need to be re-orderable. When I click on an arrow to re-order the content switches except for content in textarea_code types.
add_action( 'cmb2_admin_init', 'homium_home_page_metabox' ); /** * Hook in and add a metabox that only appears on the 'About' page */ function homium_home_page_metabox() { $prefix = 'homium_home_'; /** * Metabox to be displayed on a single page ID */ $cmb_home_page = new_cmb2_box( array( 'id' => $prefix . 'metabox', 'title' => esc_html__( 'Home Page Metabox', 'cmb2' ), 'object_types' => array( 'page' ), // Post type 'context' => 'normal', 'priority' => 'high', 'show_names' => true, // Show field names on the left 'show_on' => array( 'key' => 'page-template', 'value' => 'page-home.php' ), // Specific post IDs to display this metabox ) ); $cmb_home_page->add_field( array( 'name' => esc_html__( 'Test Text', 'cmb2' ), 'desc' => esc_html__( 'field description (optional)', 'cmb2' ), 'id' => $prefix . 'text', 'type' => 'text', ) ); $group_field_id = $cmb_home_page->add_field( array( 'id' => $prefix . 'section', 'type' => 'group', 'description' => esc_html__( 'Generates reusable form entries', 'cmb2' ), 'options' => array( 'group_title' => esc_html__( 'Section {#}', 'cmb2' ), // {#} gets replaced by row number 'add_button' => esc_html__( 'Add Another Section', 'cmb2' ), 'remove_button' => esc_html__( 'Remove Section', 'cmb2' ), 'sortable' => true, // 'closed' => true, // true to have the groups closed by default ), ) ); $cmb_home_page->add_group_field( $group_field_id, array( 'name' => esc_html__( 'Section description', 'cmb2' ), 'description' => 'just a description, does not show on front-end', 'id' => 'description', 'type' => 'text', // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types) ) ); $cmb_home_page->add_group_field( $group_field_id, array( 'name' => esc_html__( 'Section Type', 'cmb2' ), 'desc' => esc_html__( 'field description (optional)', 'cmb2' ), 'id' => $prefix . 'select', 'type' => 'select', 'show_option_none' => true, 'default' => 'text-box', 'options' => array( 'text-box' => esc_html__( 'Simple Text Box', 'cmb2' ), 'image-title-image' => esc_html__( 'Image - Title Image', 'cmb2' ), 'title-image-image' => esc_html__( 'Title Image - Image', 'cmb2' ), 'image-content' => esc_html__( 'Image - Content', 'cmb2' ), 'content-image' => esc_html__( 'Content - Image', 'cmb2' ), 'cards-overlap' => esc_html__( 'Cards Overlap', 'cmb2' ), 'image-card' => esc_html__( 'Image - Card', 'cmb2' ), 'card-html' => esc_html__( 'Card - Html', 'cmb2' ), 'dual-box' => esc_html__( 'Dual Box', 'cmb2' ), 'two-col-box' => esc_html__( 'Two Column Box', 'cmb2' ), 'dual-html-container' => esc_html__( 'Dual HTML Container', 'cmb2' ), 'single-html-container' => esc_html__( 'Single HTML Container', 'cmb2' ), ), ) ); $cmb_home_page->add_group_field( $group_field_id, array( 'name' => esc_html__( 'background color css', 'cmb2' ), 'description' => 'CSS that describes the color of the full width container like background-color:#FFFFFF or a gradient set', 'id' => 'background-color', 'type' => 'textarea_code', ) ); $cmb_home_page->add_group_field( $group_field_id, array( 'name' => esc_html__( 'Image Left', 'cmb2' ), 'desc' => esc_html__( 'Upload an image or enter a URL.', 'cmb2' ), 'id' => 'image-left', 'type' => 'file', ) ); $cmb_home_page->add_group_field( $group_field_id, array( 'name' => esc_html__( 'Title Left', 'cmb2' ), //'description' => 'just a description, does not show on front-end', 'id' => 'title-left', 'type' => 'textarea_code', ) ); $cmb_home_page->add_group_field( $group_field_id, array( 'name' => esc_html__( 'Content Left', 'cmb2' ), 'desc' => esc_html__( 'field description (optional)', 'cmb2' ), 'id' => 'content-left', 'type' => 'textarea_code', ) ); $cmb_home_page->add_group_field( $group_field_id, array( 'name' => esc_html__( 'Image right', 'cmb2' ), 'desc' => esc_html__( 'Upload an image or enter a URL.', 'cmb2' ), 'id' => 'image-right', 'type' => 'file', ) ); $cmb_home_page->add_group_field( $group_field_id, array( 'name' => esc_html__( 'Title Right', 'cmb2' ), //'description' => 'just a description, does not show on front-end', 'id' => 'title-right', 'type' => 'textarea_code', ) ); $cmb_home_page->add_group_field( $group_field_id, array( 'name' => esc_html__( 'Content Right', 'cmb2' ), 'desc' => esc_html__( 'field description (optional)', 'cmb2' ), 'id' => 'content-right', 'type' => 'textarea_code', ) ); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Reorder of repeating group doesn’t apply to textarea_code’ is closed to new replies.