function pathauto_file_update_alias in File Entity (fieldable files) 7.3
Same name and namespace in other branches
- 7.2 file_entity.module \pathauto_file_update_alias()
Update the URL aliases for an individual file.
Parameters
$file: A file object.
$op: Operation being performed on the file ('insert', 'update' or 'bulkupdate').
$options: An optional array of additional options.
4 calls to pathauto_file_update_alias()
- pathauto_file_insert in ./
file_entity.module - Implements hook_file_insert() on behalf of pathauto.module.
- pathauto_file_update in ./
file_entity.module - Implements hook_file_update() on behalf of pathauto.module.
- pathauto_file_update_action in ./
file_entity.module - Update action wrapper for pathauto_file_update_alias().
- pathauto_file_update_alias_multiple in ./
file_entity.module - Update the URL aliases for multiple files.
File
- ./
file_entity.module, line 2405 - Extends Drupal file entities to be fieldable and viewable.
Code
function pathauto_file_update_alias(stdClass $file, $op, array $options = array()) {
// Skip processing if the user has disabled pathauto for the file.
if (isset($file->path['pathauto']) && empty($file->path['pathauto']) && empty($options['force'])) {
return;
}
$options += array(
'language' => pathauto_entity_language('file', $file),
);
// Skip processing if the file has no pattern.
if (!pathauto_pattern_load_by_entity('file', $file->type, $options['language'])) {
return;
}
// Skip processing if pathauto_entity module is enabled.
if (module_exists('pathauto_entity')) {
return;
}
module_load_include('inc', 'pathauto');
$uri = entity_uri('file', $file);
pathauto_create_alias('file', $op, $uri['path'], array(
'file' => $file,
), $file->type, $options['language']);
}