You are here

function og_subgroups_group_select_options in Subgroups for Organic groups 6

Create form select options for the subgroup selector

Parameters

$indent: The indention to be used.

Return value

A keyed array used for a form select widget

4 calls to og_subgroups_group_select_options()
og_subgroups_add_group_select_form in includes/form.inc
Add form components to select group parents on the group node form
og_subgroups_context_condition_node_below_og::condition_values in modules/og_subgroups_context/plugins/og_subgroups_context_condition_node_below_og.inc
Condition values
og_subgroups_form_alter in ./og_subgroups.module
Implenentation of hook_form_alter().
og_subgroups_views_handler_filter_og_group_nid_override::allowed_values in modules/og_subgroups_views/includes/og_subgroups_views_handler_filter_og_group_nid_override.inc

File

includes/form.inc, line 92

Code

function og_subgroups_group_select_options($only_enabled = FALSE, $indent = '--') {
  og_subgroups_include('tree');
  $options = array();

  // Get the tree
  if ($tree = og_subgroups_get_tree()) {

    // Iterate the tree
    foreach ($tree as $branch) {

      // Check access to use this group
      if (!og_subgroups_mask_group($branch, TRUE)) {

        // Add the initial group as an option
        $options[$branch->nid] = $branch->title;
      }

      // Add all the children
      _og_subgroups_group_select_options_recursive($options, $branch->children, $indent);
    }
  }

  // Add the groups that don't have children
  $options += _og_subgroups_group_select_options_without_family($only_enabled);

  // Add no parent as a selection option
  $options = array(
    t('<No parent group>'),
  ) + $options;
  return $options;
}