Group Extension API – multiple fields?
-
Hi!
I’m trying to figure out how to use the Group Extension API to register multiple custom fields, and display/edit them under the same group view.
My use case involves allowing a group to define their address. This means that I’ll need to register fields like:
-Address
-Unit/apt/ste number
-City
-State
-ZipI’d like to be able to display/edit these elements under the same view, as well.
What is the correct syntax for registering these elements? It is clear that I cannot have 2 separate __construct(); defines, like this:
function __construct() { $args = array( 'slug' => 'group-extension-zipcode', 'name' => 'Group Information', 'nav_item_position' => 105, 'screens' => array( 'edit' => array( 'name' => 'Details', // Changes the text of the Submit button // on the Edit page 'submit_text' => 'Submit', ), 'create' => array( 'position' => 100, ), ), ); parent::init( $args ); } function __construct() { $args = array( 'slug' => 'group-extension-address', 'name' => 'Group Information', 'nav_item_position' => 105, 'screens' => array( 'edit' => array( 'name' => 'Details', // Changes the text of the Submit button // on the Edit page 'submit_text' => 'Submit', ), 'create' => array( 'position' => 100, ), ), ); parent::init( $ }
Does this mean that I need to register separate classes to define multiple fields? If so, how do I associate the fields to exist under the same view/edit screen?
I’m totally crap at PHP and am probably just overlooking simple multidimensional constructor syntax for
parent::init( $args );
?Thanks!
- The topic ‘Group Extension API – multiple fields?’ is closed to new replies.