function views_contact_form_style::render in Views Contact Form 7
Renders views
Overrides views_plugin_style::render
File
- views/
views_contact_form_style.inc, line 59 - This file holds style plugin for Views
Class
- views_contact_form_style
- @class Extension of the Views Plugin Syle
Code
function render() {
$view = $this->view;
if (count($view->result) < 1) {
return;
}
$email_field = isset($this->options['to']['email']) ? $this->options['to']['email'] : NULL;
if (is_null($email_field)) {
return;
}
$sets = $this
->render_grouping($this->view->result, $this->options['grouping']);
// Turn this all into an $options array for the jump menu.
$this->view->row_index = 0;
foreach ($sets as $title => $records) {
foreach ($records as $row_index => $row) {
$email = $this
->get_field_value($row_index, $email_field);
if (valid_email_address($email)) {
$emails[] = $email;
}
}
}
if (empty($emails)) {
return;
}
$data['emails'] = $emails;
$form = drupal_get_form('views_contact_form_contact_form', $data);
return drupal_render($form);
}