filefield_paths.variable.inc 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * @file
  4. * Contains Variable functions for the File (Field) Paths module.
  5. */
  6. /**
  7. * Implements hook_variable_info().
  8. *
  9. * @return mixed
  10. */
  11. function filefield_paths_variable_info() {
  12. $variables['filefield_paths_temp_location'] = array(
  13. 'title' => t('Temporary file location'),
  14. 'type' => 'string',
  15. 'default' => 'public://filefield_paths',
  16. 'description' => t('The location that unprocessed files will be uploaded priot to being processed by File (Field) Paths.<br />It is recommended that you use the temporary file system (temporary://) if your server configuration allows for that.'),
  17. 'validate callback' => 'filefield_paths_variable_temp_location_validate',
  18. 'group' => 'filefield_paths',
  19. );
  20. return $variables;
  21. }
  22. /**
  23. * Validate callback for 'Temporary file location' variable.
  24. *
  25. * @param $element
  26. */
  27. function filefield_paths_variable_temp_location_validate($element) {
  28. // Add FAPI element keys for standard validation callback.
  29. $element['#parents'] = array('filefield_paths_temp_location');
  30. $element['#value'] = $element['value'];
  31. // Pass element through standard validation callback.
  32. module_load_include('admin.inc', 'filefield_paths');
  33. filefield_paths_settings_form_temp_location_validate($element);
  34. }
  35. /**
  36. * Implements hook_variable_group_info().
  37. *
  38. * @return mixed
  39. */
  40. function filefield_paths_variable_group_info() {
  41. $groups['filefield_paths'] = array(
  42. 'title' => t('File (Field) Paths'),
  43. 'description' => t('File (Field) Paths settings.'),
  44. 'access' => 'administer site configuration',
  45. 'path' => array(
  46. 'admin/config/media/file-system/filefield-paths'
  47. ),
  48. );
  49. return $groups;
  50. }