pmpapi_remote_files.module in Public Media Platform API Integration 7
Hook implementations for the PMPAPI remote files module.
File
pmpapi_remote_files/pmpapi_remote_files.moduleView source
<?php
/**
* @file
* Hook implementations for the PMPAPI remote files module.
*/
/**
* Implements hook_form_FORM_ID_alter() for pmpapi_pull_admin_config().
*/
function pmpapi_remote_files_form_pmpapi_pull_admin_config_alter(&$form, &$form_state, $form_id) {
$file_profiles = array(
'audio',
'image',
'video',
);
$form['pmpapi_remote_files_settings'] = array(
'#type' => 'checkboxes',
'#title' => t('Allow for remote files'),
'#options' => drupal_map_assoc($file_profiles),
'#default_value' => variable_get('pmpapi_remote_files_settings', array()),
'#weight' => 0,
'#description' => t('Checked PMP profiles, when pulled, will not be copied locally. See the remote stream wrapper module for more information.'),
);
$form['#submit'][] = 'pmpapi_remote_files_settings_submit';
}
/**
* Form submission handler for pmpapi_pull_admin_config().
*
* @see pmpapi_pull_admin_config_validate
*/
function pmpapi_remote_files_settings_submit($form, &$form_state) {
variable_set('pmpapi_remote_files_settings', $form_state['values']['pmpapi_remote_files_settings']);
}
/**
* Implements hook_pmpapi_pull_make_local_files().
*/
function pmpapi_remote_files_pmpapi_pull_make_local_files($profile) {
$settings = variable_get('pmpapi_remote_files_settings', array());
// If box is checked for $profile, don't make local files
if (in_array($profile, $settings, TRUE)) {
return FALSE;
}
return TRUE;
}
Functions
Name | Description |
---|---|
pmpapi_remote_files_form_pmpapi_pull_admin_config_alter | Implements hook_form_FORM_ID_alter() for pmpapi_pull_admin_config(). |
pmpapi_remote_files_pmpapi_pull_make_local_files | Implements hook_pmpapi_pull_make_local_files(). |
pmpapi_remote_files_settings_submit | Form submission handler for pmpapi_pull_admin_config(). |