function rh_file_form_file_entity_edit_alter in Rabbit Hole 7.2
Implements hook_form_FORM_ID_alter().
This will add Rabbit Hole options to the file form when editing a file. The user will be able to override the default Rabbit Hole options.
File
- modules/
rh_file/ rh_file.module, line 71 - Main module file for Rabbit Hole files module.
Code
function rh_file_form_file_entity_edit_alter(&$form, $form_state) {
// Add the Rabbit Hole form, and add an extra javascript file that's needed
// for the fieldset summary.
rabbit_hole_form($form, 'file', $form_state['file']->type, 'rh_file', $form_state['file']);
if (isset($form['rabbit_hole'])) {
$form['rabbit_hole']['#attached']['js'][] = drupal_get_path('module', 'rh_file') . '/rh-file.js';
}
// Add a custom submit function. This is used to disable the redirect to
// file/123 if Rabbit Hole is enabled and the user doesn't have the bypass
// rh_file permission.
if (!user_access('bypass rh_file')) {
$form['actions']['submit']['#submit'][] = 'rh_file_entity_edit_submit';
}
}