简体   繁体   中英

Access Drupal webform fields in custom page

I've placed a copy of the webform-submission page in my sites theme folder, and am modifying it to display the submissions pages how I would like. At the moment, to print an elements value, I use:

$submission->data[n]['value'][0]

Where data[n] is specific to the element in the webform. Is there any way I can use something more like $submission->data[element_key]['value'][0] to get the field info. It just makes for much easier reading, especially since I won't be the person maintaining the site.

Thanks.

ps this is in Drupal 7, webform 3.0

The $usbmission array is built in the function webform_get_submissions .

Notice that the table which contains the element_key data you're looking for ( webform_component table) is not queried in this function.

So if you want that data, you would have to fetch the element_key information yourself and rebuild the $submission array in an implementation of hook_webform_submission_load .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM