/** * Implements theme_preprocess_webform_confirmation(). * * Generates a download link for the file requested. */ function centroid_custom_preprocess_webform_confirmation(&$vars) { // Lots of checks so things don't error out when everything isn't present, // but also don't have a forced nid or something. Note that there /is/ a // constant component id, since data fields don't have field names. if ($submission = webform_menu_submission_load($vars['sid'], NULL)) { if ($referring_nid = $submission->data[CENTROID_RESOURCES_WEBFORM_NID_COMPONENT_ID][0]) { try { $wnode = entity_metadata_wrapper('node', $referring_nid); if (!empty($wnode->field_file) && ($file = $wnode->field_file->value())) { $file_uri = file_create_url($file['uri']); $vars['download_link'] = l(t('Download'), $file_uri, array('attributes' => array('class' => array('btn', 'btn-primary', 'btn-lg')))); } } catch (EntityMetadataWrapperException $exc) { watchdog('centroid_custom_theme', 'EntityMetadataWrapper exception in %function() <pre>@trace</pre>', array('%function' => __FUNCTION__, '@trace' => $exc->getTraceAsString()), WATCHDOG_ERROR); } } } }
public function __construct($sid) { $sub = webform_menu_submission_load($sid, 24); $this->data = $sub; }
public function __construct($sid) { //parent::__construct(); $cnodeid = 24; // nid of contact-sales form page... $sub = webform_menu_submission_load($sid, $cnodeid); //if ( function_exists('watchdog') ) watchdog('gating', 'webform_menu_submission_load<br /><pre>'. print_r($sub,true) .'</pre>'); $wdata = array('C_FirstName' => $sub->data[1]['value'][0], 'C_LastName' => $sub->data[2]['value'][0], 'C_EmailAddress' => $sub->data[3]['value'][0], 'C_BusPhone' => $sub->data[4]['value'][0], 'C_Country' => $sub->data[5]['value'][0], 'C_State_Prov' => $sub->data[20]['value'][0], 'C_Company' => $sub->data[7]['value'][0], 'C_Industry1' => $sub->data[8]['value'][0], 'C_Job_Role1' => $sub->data[9]['value'][0], 'C_Department1' => $sub->data[10]['value'][0], 'C_Company_Type1' => $sub->data[11]['value'][0]); $this->data = $wdata; }