You are here

function makemeeting_pollpanel_process in Make Meeting Scheduler 6

makemeeting_pollpanel_process()

1 string reference to 'makemeeting_pollpanel_process'
makemeeting_elements in ./makemeeting.module
Implements hook_elements().

File

./makemeeting.module, line 198
Make Meeting module

Code

function makemeeting_pollpanel_process($element, $form_state) {

  // processing posted datas
  if ($element['#attributes']['maybe_option'] == 1 || $element['#attributes']['multiple_allowed'] == 1) {
    $alter_ids = array();

    // collects the alter_ids and the vote values
    foreach ($element['#post'] as $k => $v) {
      preg_match("/(option_)(\\d+)/", $k, $matches);
      if (is_numeric($matches[2])) {
        $alter_ids[$matches[2]] = $v;
      }
    }
  }
  else {
    $alter_ids = array();

    // collect only the alter_ids
    foreach ($element['#post'] as $k => $v) {
      if (preg_match("/option_/i", $k)) {
        $alter_ids[] = $v;
      }
    }
  }
  $element['#value']['alter_ids'] = $alter_ids;
  $element['#value']['name'] = $element['#post']['your_name'];

  // adding custon css
  drupal_add_css(drupal_get_path('module', 'makemeeting') . '/pollpanel.css');
  return $element;
}