You are here

function og_context_og_group_settings_form in Organic groups 7

OG group context settings form.

1 string reference to 'og_context_og_group_settings_form'
og_context_ctools_entity_contexts_alter in og_context/og_context.module
Implements hook_ctools_entity_contexts_alter().

File

og_context/og_context.module, line 225
Get a group from a viewed page.

Code

function og_context_og_group_settings_form($form, &$form_state) {
  $conf = $form_state['conf'];
  $form['type'] = array(
    '#title' => t('Enter the context type'),
    '#type' => 'radios',
    '#options' => array(
      'select' => t('Select an OG group'),
      'context' => t('OG group form context'),
    ),
    '#default_value' => $conf['type'],
  );
  $form['gid'] = array(
    '#title' => t('Enter a group ID'),
    '#type' => 'textfield',
    '#states' => array(
      'visible' => array(
        ':input[name=type]' => array(
          'value' => 'select',
        ),
      ),
    ),
    '#default_value' => $conf['gid'],
  );
  if (!empty($conf['gid'])) {
    $group = og_load($conf['gid']);
    if ($group) {
      $form['gid']['#description'] = t('Currently set to %name group', array(
        '%name' => og_label($group->gid),
      ));
    }
  }
  return $form;
}