function commerce_stripe_settings_form_image_validate in Commerce Stripe 7
Same name and namespace in other branches
- 7.3 commerce_stripe.module \commerce_stripe_settings_form_image_validate()
Custom validation callback for image field of stripe settings form. Uploaded image file is temporary by default, it'll be removed during the file garbage collection process. Change its status to FILE_STATUS_PERMANENT.
Parameters
array $element:
array $form_state:
array $form:
1 string reference to 'commerce_stripe_settings_form_image_validate'
- commerce_stripe_settings_form in ./
commerce_stripe.module - Payment method settings form.
File
- ./
commerce_stripe.module, line 308 - This module provides Stripe (http://stripe.com/) payment gateway integration to Commerce. Commerce Stripe offers a PCI-compliant way to process payments straight from you Commerce shop.
Code
function commerce_stripe_settings_form_image_validate($element, &$form_state, $form) {
if (isset($element['fid']['#value'])) {
$file = file_load($element['fid']['#value']);
if (is_object($file) && $file->status !== FILE_STATUS_PERMANENT) {
$file->status = FILE_STATUS_PERMANENT;
file_save($file);
}
}
}