You are here

function context_og_reaction_set_group_context::options_form in Context OG 7

Same name and namespace in other branches
  1. 6.3 plugins/context_og_reaction_set_group_context.inc \context_og_reaction_set_group_context::options_form()
  2. 7.2 plugins/context_og_reaction_set_group_context.inc \context_og_reaction_set_group_context::options_form()

Choose a group whose OG context will be set for this reaction.

Overrides context_reaction::options_form

File

plugins/context_og_reaction_set_group_context.inc, line 10

Class

context_og_reaction_set_group_context
Expose organic groups as context reactions.

Code

function options_form($context) {
  $result = context_og_query_og_nodes();
  $options = array();
  foreach ($result as $group) {
    $type = node_type_get_name($group->type);
    $options[$group->gid] = $type . ': ' . $group->title;
  }
  $values = $this
    ->fetch_from_context($context);
  $form = array(
    'group' => array(
      '#title' => t('Group'),
      '#description' => t('Set the group context to the selected group.'),
      '#type' => 'select',
      '#multiple' => FALSE,
      '#options' => $options,
      '#default_value' => isset($values['group']) ? $values['group'] : '',
    ),
  );
  return $form;
}