You are here

function workflow_notify_og_form_alter in Workflow 7.2

Same name and namespace in other branches
  1. 7 workflow_notify/workflow_notify_og/workflow_notify_og.module \workflow_notify_og_form_alter()

Implements hook_form_alter().

Add a column for limiting user groups by OG group.

File

workflow_notify/workflow_notify_og/workflow_notify_og.module, line 81
Notify roles by OG Groups for Workflow state transitions.

Code

function workflow_notify_og_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'workflow_notify_settings_form':
      $limit = variable_get('workflow_notify_og', array());
      if (!empty($form['states'])) {

        // Add a group limit flag to each state.
        foreach ($form['states'] as $sid => $element) {
          $form['states'][$sid]['limit_by_group'] = array(
            '#type' => 'radios',
            '#options' => array(
              t('No'),
              t('Yes'),
            ),
            '#attributes' => array(
              'class' => array(
                'limit-by-group',
              ),
            ),
            '#default_value' => isset($limit[$sid]) ? $limit[$sid] : 0,
          );
        }

        // Add our submission handler.
        $form['#submit'][] = 'workflow_notify_og_form_submit';
      }
  }
}