function file_entity_set_title_alt_properties in File Entity (fieldable files) 7.2
Same name and namespace in other branches
- 7.3 file_entity.file.inc \file_entity_set_title_alt_properties()
Set the title / alt properties of file objects.
Parameters
array $files: List of file entities.
stdClass $language: (optional) A language object to use for translating the title and alt properties. Defaults to the language of the current request.
4 calls to file_entity_set_title_alt_properties()
- file_entity_entitycache_file_load in ./
file_entity.file.inc - Implements hook_entitycache_ENTITY_TYPE_load().
- file_entity_file_load in ./
file_entity.file.inc - Implements hook_file_load().
- file_entity_set_title_alt_properties_on_file_fields in ./
file_entity.file.inc - Sets the title / alt properties on file fields attached to entities.
- file_view_file in ./
file_entity.file_api.inc - Generate an array for rendering just the file portion of a file entity.
1 string reference to 'file_entity_set_title_alt_properties'
- file_view_file in ./
file_entity.file_api.inc - Generate an array for rendering just the file portion of a file entity.
File
- ./
file_entity.file.inc, line 274 - File hooks implemented by the File entity module.
Code
function file_entity_set_title_alt_properties($files, $language = NULL) {
if (!isset($language)) {
$language = $GLOBALS['language'];
}
$replace_options = array(
'clear' => TRUE,
'sanitize' => FALSE,
'language' => $language,
);
foreach ($files as $file) {
if (empty($file->title)) {
$file->title = file_entity_replace_title($file, $replace_options, NULL, $language->language);
}
if (empty($file->alt)) {
$file->alt = file_entity_replace_alt($file, $replace_options, NULL, $language->language);
}
}
}