You are here

function webform_protected_downloads_configuration_form_submit in Webform Protected Downloads 7

Same name and namespace in other branches
  1. 6 webform_protected_downloads.form.inc \webform_protected_downloads_configuration_form_submit()

Implementation of hook_submit().

_state

Parameters

array $form:

Return value

void

File

./webform_protected_downloads.form.inc, line 281

Code

function webform_protected_downloads_configuration_form_submit($form, $form_state) {
  $values = $form_state['values'];
  $node = $values['node'];
  foreach ($values['files'] as $fid => $protected) {
    $protected = (bool) $protected;
    webform_protected_downloads_file_set_protected($node->nid, $fid, $protected);
  }
  webform_protected_downloads_set_configuration($node->nid, array(
    'mail_field_cid' => $values['access_verification']['mail_field_cid'],
    'mail_from' => $values['access_verification']['mail_from'],
    'mail_subject' => $values['access_verification']['mail_subject'],
    'mail_body' => $values['access_verification']['mail_body'],
    'access_type' => $values['access_verification']['access_type'],
    'expiration_download' => $values['access_verification']['expiration_download'],
    'expiration_session' => $values['access_verification']['expiration_session'],
    'retroactive' => $values['access_verification']['retroactive'],
    'redirect' => $values['access_verification']['redirect'],
    'text_download_access' => $values['protected_download_page']['text_download_access']['value'],
    'text_download_access_format' => $values['protected_download_page']['text_download_access']['format'],
    'text_download_noaccess' => $values['protected_download_page']['text_download_noaccess']['value'],
    'text_download_noaccess_format' => $values['protected_download_page']['text_download_noaccess']['format'],
  ));
  drupal_set_message('Your changes have been saved');
}