public function GroupRoleUIController::overviewForm in Group 7
Builds the entity overview form.
Overrides EntityDefaultUIController::overviewForm
File
- classes/
group_role.ui_controller.inc, line 76 - Defines the Entity API UI class for group roles.
Class
- GroupRoleUIController
- UI class for group roles.
Code
public function overviewForm($form, &$form_state) {
if (!empty($form_state['build_info']['args'][1])) {
$group_type = $form_state['build_info']['args'][1];
// We're not viewing the global UI.
$this->global_ui = FALSE;
// Whether the parent group type is fixed.
if (entity_has_status('group_type', $group_type, ENTITY_FIXED)) {
$this->type_fixed = TRUE;
}
// Show only the roles for this group type.
$conditions = array(
'type' => $group_type->name,
);
}
else {
// Show all global roles.
$conditions = array(
'global' => 1,
);
}
// Determine whether or not we show the tabledrag.
$this->tabledrag = $this->global_ui || !$this->type_fixed;
// Show the appropriate description for the overview page.
$help = !$this->global_ui ? t("<p>These are <strong>group type specific roles</strong>, meaning they only apply to this group type. You can create global group roles by visiting <a href='@url'>the 'Group roles' page</a>.</p>", array(
'@url' => url('admin/group/role'),
)) : t("<p>These are <strong>global group roles</strong>, meaning they apply to every group of every group type. Use this if you don't want to create the same role over and over again for every group type. A good usage example would be a <em>group moderator</em> role that has limited admin rights.</p><p>You can create group type specific roles under 'Roles' on the 'Permissions' tab of a group type.</p>");
// Apply the variables set above.
$form['help'] = array(
'#markup' => $help,
);
$form['table'] = $this
->roleTable($conditions);
if ($this->tabledrag) {
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save order'),
);
}
return $form;
}