sPageSlug . '_' . $this->sTabSlug, array( $this, 'validate' ), 10, 4 ); // Sections $oFactory->addSettingSections( $this->sPageSlug, // the target page slug array( 'section_id' => $this->sSectionID, 'title' => __( 'Nested Fields', 'admin-page-framework-loader' ), 'description' => __( 'You can include fields inside a field.', 'admin-page-framework-loader' ), ) ); $oFactory->addSettingFields( $this->sSectionID, // the target section ID - pass dimensional keys of the section array( 'field_id' => 'X', 'title' => __( 'X', 'admin-page-framework-loader' ), 'type' => 'text', 'repeatable' => true, 'sortable' => true, ), array( 'field_id' => 'Y', 'title' => __( 'Y', 'admin-page-framework-loader' ), 'description' => __( 'By passing an array of field definition to the content argument, you can nest fields.', 'admin-page-framework-loader' ) . ' ' . __( 'Also the type argument can be omitted.', 'admin-page-framework-loader' ), 'content' => array( array( 'field_id' => 'i', 'title' => __( 'i', 'admin-page-framework-loader' ), 'type' => 'textarea', ), array( 'field_id' => 'ii', 'title' => __( 'ii', 'admin-page-framework-loader' ), 'type' => 'color', ), array( 'field_id' => 'iii', 'title' => __( 'iii', 'admin-page-framework-loader' ), 'repeatable' => true, 'sortable' => true, 'content' => array( array( 'field_id' => 'a', 'title' => __( 'a', 'admin-page-framework-loader' ), 'type' => 'image', 'attributes' => array( 'preview' => array( 'style' => 'max-width: 200px;', ), ), ), array( 'field_id' => 'b', 'title' => __( 'b', 'admin-page-framework-loader' ), 'content' => array( array( 'field_id' => 'first', 'title' => __( '1st', 'admin-page-framework-loader' ), 'type' => 'color', 'repeatable' => true, 'sortable' => true, ), array( 'field_id' => 'second', 'title' => __( '2nd', 'admin-page-framework-loader' ), 'type' => 'size', ), array( 'field_id' => 'third', 'title' => __( '3rd', 'admin-page-framework-loader' ), 'type' => 'select', 'label' => array( 'x' => 'X', 'y' => 'Y', 'z' => 'Z', ), ), ), // 'description' => '', ), array( 'field_id' => 'c', 'title' => __( 'c', 'admin-page-framework-loader' ), 'type' => 'radio', 'label' => array( 'a' => __( 'Apple', 'admin-page-framework-loader' ), 'b' => __( 'Banana', 'admin-page-framework-loader' ), 'c' => __( 'Cherry', 'admin-page-framework-loader' ), ), 'default' => 'b', ), ) ), ), ), array( 'field_id' => 'Z', 'title' => __( 'Z', 'admin-page-framework-loader' ), 'content' => '

' . __( 'This message is inserted with the content argument.', 'admin-page-framework-loader' ) . ' ' . __( 'The type argument can be omitted.', 'admin-page-framework-loader' ) . '

', ), array() ); } /** * @callback filter validation_{page slug}_{tab slug} * @return string */ public function validate( $aInputs, $aOldInputs, $aSavedData, $aSubmitInfo ) { return $aInputs; } }