Skip to content

Commit

Permalink
feat(groups): group edit form now uses tabs for different sections
Browse files Browse the repository at this point in the history
  • Loading branch information
jeabakker committed Jun 1, 2021
1 parent 3c6a77f commit a9103de
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 9 deletions.
3 changes: 3 additions & 0 deletions mod/groups/languages/en.php
Expand Up @@ -18,6 +18,9 @@
'groups:all' => "All groups",
'groups:add' => "Create a new group",
'groups:edit' => "Edit group",
'groups:edit:profile' => "Profile",
'groups:edit:access' => "Access",
'groups:edit:tools' => "Tools",
'groups:delete' => 'Delete group',
'groups:membershiprequests' => 'Manage join requests',
'groups:membershiprequests:pending' => 'Manage join requests (%s)',
Expand Down
41 changes: 32 additions & 9 deletions mod/groups/views/default/forms/groups/edit.php
@@ -1,28 +1,51 @@
<?php
/**
* Group edit form
*
* @uses $vars['entity'] The group being edited (empty during creation)
*/

/* @var ElggGroup $entity */
$entity = elgg_extract("entity", $vars, false);
$entity = elgg_extract('entity', $vars, false);

// context needed for input/access view
elgg_push_context("group-edit");
elgg_push_context('group-edit');

// build group edit tabs
$tabs = [];

// build the group profile fields
echo elgg_view("groups/edit/profile", $vars);
$tabs[] = [
'name' => 'profile',
'text' => elgg_echo('groups:edit:profile'),
'content' => elgg_view('groups/edit/profile', $vars),
];

// build the group access options
echo elgg_view("groups/edit/access", $vars);
$tabs[] = [
'name' => 'access',
'text' => elgg_echo('groups:edit:access'),
'content' => elgg_view('groups/edit/access', $vars),
];

// build the group tools options
echo elgg_view("groups/edit/tools", $vars);
$tabs[] = [
'name' => 'tools',
'text' => elgg_echo('groups:edit:tools'),
'content' => elgg_view('groups/edit/tools', $vars),
];

// show tabs
echo elgg_view('page/components/tabs', [
'id' => 'groups-edit',
'tabs' => $tabs,
]);

// display the save button and some additional form data
if ($entity) {
echo elgg_view("input/hidden", [
"name" => "group_guid",
"value" => $entity->getGUID(),
if ($entity instanceof \ElggGroup) {
echo elgg_view('input/hidden', [
'name' => 'group_guid',
'value' => $entity->guid,
]);
}

Expand Down

0 comments on commit a9103de

Please sign in to comment.