You are here

function _webform_submit_view in Webform view 7

Deal with what happens when one of our custom components is submitted.

Implements _webform_submit_component().

File

./webform_view.inc, line 307
Additional component for webform that allows views to be used as embeddable elements.

Code

function _webform_submit_view($component, $value) {

  // $value is an array, should contain indexed clusters of information
  // one for each row.
  // eg array(
  // 51 => array('item' => 'the node title', 'quantity' => 2)
  // )
  // Can clear out blank values here.
  // eg 'quantity';
  $required_key = $component['extra']['filter_field_id'];

  // If this key is set, then rows without it are skipped.
  $return = array();
  foreach ($value as $key => $row) {
    if (is_array($row)) {
      if ($required_key == '<none>' || !empty($row[$required_key])) {
        $return[$key] = $row;
      }
    }
  }

  // Webform internals just can't deal with nested arrays, so at this point we
  // have to hide our data in serialized form. Dull, but the only way to be
  // safe it seems.
  return serialize($return);
}