public function doSearch($data, Form $form) { $values = array(); foreach ($form->Fields() as $field) { $values[$field->getName()] = $field->datavalue(); } // If we have a subaccount defined, we need to restrict the query to this subaccount if ($subaccount = MandrillMailer::getSubaccount()) { if (empty($values['Query'])) { $values['Query'] = 'subaccount:' . $subaccount; } else { $values['Query'] = $values['Query'] . ' AND subaccount:' . $subaccount; } } Session::set('MandrilAdminSearch', $values); Session::save(); return $this->redirectBack(); }