signup_handler_field_signup_user_form_data.inc in Signup 6.2
File
views/handlers/signup_handler_field_signup_user_form_data.inc
View source
<?php
class signup_handler_field_signup_user_form_data extends views_handler_field_prerender_list {
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['form_data_fieldname'] = array(
'#type' => 'textfield',
'#title' => t(' Field Name'),
'#description' => t('If you want to display a single field from the signup form (see theme/signup_form.inc), enter its name here. Otherwise, all fields will be displayed.'),
'#default_value' => isset($this->options['form_data_fieldname']) ? $this->options['form_data_fieldname'] : '',
);
}
function query() {
$this
->ensure_my_table();
$this
->add_additional_fields();
parent::query();
}
function pre_render($values) {
if (!$this->options['form_data_fieldname']) {
foreach ($values as $key => $result) {
$form_data = unserialize($result->{$this->field_alias});
$sid = $result->{$this->aliases['sid']};
$nid = $result->{$this->aliases['nid']};
$uid = $result->{$this->aliases['uid']};
drupal_alter('signup_form_data_display', $form_data, $nid, $sid, $uid, 'view');
if (is_array($form_data)) {
foreach ($form_data as $pane_id => $pane_data) {
foreach ((array) $pane_data as $key => $value) {
$this->items[$result->{$this->field_alias}][$key] = check_plain(theme('signup_custom_data_field_text', $key, $value));
}
}
}
}
}
}
function render($values) {
if ($this->options['form_data_fieldname']) {
$form_data = unserialize($values->{$this->field_alias});
return check_plain($form_data[$this->options['form_data_fieldname']]);
}
else {
return parent::render($values);
}
}
}