What it is
GroupForm extensions allow you to add form elements to the group configuration form in the AdminCP, and then process the values supplied for those form elements in order to format and/or store the configuration. This allows you to easily add additional per-group settings for your application, if needed.
How to use
/**
* Process Form
*
* @param \IPS\Helpers\Form $form The form
* @param \IPS\Member\Group $group Existing Group
* @return void
*/
public function process( &$form, $group )
The process() method allows you to add new form elements to the group form in the AdminCP. A new tab will be added automatically so you do not need to do that, however you can add headers and separators to the form if desired. As the $form parameter is passed by reference, you can simply add new elements to $form directly.
/**
* Save
*
* @param array $values Values from form
* @param \IPS\Member\Group $group The group
* @return void
*/
public function save( $values, &$group )
The save() method is called in order to save the values submitted in the form. Typically based on the amount of the fields you'll either create a new setting in your application and use it to save the values, or create a new database table to save the data.
It is important that, keeping in line with the rest of the Community Suite, you follow some guidelines when creating settings on the group configuration page.
- Settings should always be labeled in the affirmative, rather than the negative. For instance, instead of "Block access to application" you should label the setting "Can access application" (and simply negate the submitted value if the backend code is still expecting this to be an off setting instead of an on setting).
- Setting labels should be clear and concise, and setting descriptions should elaborate on anything that may not be immediately understood by the label alone.
- Form toggles should be used to show and hide form elements that become important or unimportant based on other selections.
- Settings that will never apply to a guest should be hidden if the group being adjusted is equal to \IPS\Settings::i()->guest_group in order to prevent confusion.
Report Document