You are here

function og_subgroups_context_condition_has_children::condition_form in Subgroups for Organic groups 6

Condition form

File

modules/og_subgroups_context/plugins/og_subgroups_context_condition_has_children.inc, line 15

Class

og_subgroups_context_condition_has_children
Enable OG Subgroups to trigger a condition based on whether or not the current group has children

Code

function condition_form($context) {
  $default = $this
    ->fetch_from_context($context, 'values');
  if ($default) {
    $default = array_shift($default);
  }
  return array(
    'og_subgroups_context_has_children' => array(
      '#title' => $this->title,
      '#type' => 'radios',
      '#options' => array(
        OG_SUBGROUPS_CONTEXT_NO_CHILDREN => t('Does not have children'),
        OG_SUBGROUPS_CONTEXT_HAS_CHILDREN => t('Has children'),
      ),
      '#description' => $this->description,
      '#default_value' => $default ? $default : OG_SUBGROUPS_CONTEXT_NO_CHILDREN,
    ),
  );
}