Revision 2b3c8cc1
Added by Assos Assos about 9 years ago
drupal7/sites/all/modules/file_entity/file_entity.module | ||
---|---|---|
79 | 79 |
// Miscellaneous hooks |
80 | 80 |
'file_mimetype_mapping_alter', |
81 | 81 |
'file_url_alter', |
82 |
// Stream wrappers |
|
83 |
'stream_wrappers', |
|
84 |
'stream_wrappers_alter', |
|
82 | 85 |
); |
83 | 86 |
$info += array_fill_keys($hooks, array('group' => 'file')); |
84 | 87 |
} |
... | ... | |
875 | 878 |
'controls' => TRUE, |
876 | 879 |
'autoplay' => FALSE, |
877 | 880 |
'loop' => FALSE, |
881 |
'preload' => NULL, |
|
878 | 882 |
), |
879 | 883 |
'file' => 'file_entity.theme.inc', |
880 | 884 |
), |
... | ... | |
887 | 891 |
'muted' => FALSE, |
888 | 892 |
'width' => NULL, |
889 | 893 |
'height' => NULL, |
894 |
'preload' => NULL, |
|
890 | 895 |
), |
891 | 896 |
'file' => 'file_entity.theme.inc', |
892 | 897 |
), |
... | ... | |
954 | 959 |
|
955 | 960 |
// Ensure some of the Entity API callbacks are supported. |
956 | 961 |
$entity_info['file']['creation callback'] = 'entity_metadata_create_object'; |
957 |
$entity_info['file']['view callback'] = 'file_view_multiple';
|
|
958 |
$entity_info['file']['edit callback'] = 'file_entity_metadata_form_file';
|
|
962 |
$entity_info['file']['view callback'] = 'file_entity_metadata_view_file';
|
|
963 |
$entity_info['file']['form callback'] = 'file_entity_metadata_form_file';
|
|
959 | 964 |
$entity_info['file']['access callback'] = 'file_entity_access'; |
960 | 965 |
|
961 | 966 |
// Add integration with the Title module for file name replacement support. |
... | ... | |
1023 | 1028 |
return $uri; |
1024 | 1029 |
} |
1025 | 1030 |
|
1031 |
/** |
|
1032 |
* Entity API callback to view files. |
|
1033 |
*/ |
|
1034 |
function file_entity_metadata_view_file($entities, $view_mode = 'full', $langcode = NULL) { |
|
1035 |
$result = file_view_multiple($entities, $view_mode, 0, $langcode); |
|
1036 |
// Make sure to key the result with 'file' instead of 'files'. |
|
1037 |
return array('file' => reset($result)); |
|
1038 |
} |
|
1039 |
|
|
1026 | 1040 |
/** |
1027 | 1041 |
* Entity API callback to get the form of a file entity. |
1028 | 1042 |
*/ |
... | ... | |
1036 | 1050 |
/** |
1037 | 1051 |
* Implements hook_ctools_plugin_directory(). |
1038 | 1052 |
*/ |
1039 |
|
|
1040 |
function file_entity_ctools_plugin_directory($module, $type) { |
|
1041 |
if ($module == 'ctools' && $type == 'content_types') { |
|
1042 |
return 'plugins/' . $type; |
|
1053 |
function file_entity_ctools_plugin_directory($module, $plugin) { |
|
1054 |
if (in_array($module, array('panelizer', 'ctools', 'page_manager'))) { |
|
1055 |
return 'plugins/' . $plugin; |
|
1043 | 1056 |
} |
1044 | 1057 |
} |
1045 | 1058 |
|
... | ... | |
1491 | 1504 |
$names = &drupal_static(__FUNCTION__); |
1492 | 1505 |
|
1493 | 1506 |
if (!isset($names)) { |
1507 |
$names = array(); |
|
1494 | 1508 |
$info = entity_get_info('file'); |
1495 | 1509 |
foreach ($info['bundles'] as $bundle => $bundle_info) { |
1496 | 1510 |
$names[$bundle] = $bundle_info['label']; |
... | ... | |
1563 | 1577 |
/** |
1564 | 1578 |
* Implements hook_ctools_plugin_api(). |
1565 | 1579 |
*/ |
1566 |
function file_entity_ctools_plugin_api($owner, $api) {
|
|
1567 |
if ($owner == 'file_entity' && $api == 'file_type') {
|
|
1580 |
function file_entity_ctools_plugin_api($module, $api) {
|
|
1581 |
if (($module == 'file_entity' && $api == 'file_type') || ($module == 'page_manager' && $api == 'pages_default') || $module == 'panelizer') {
|
|
1568 | 1582 |
return array('version' => 1); |
1569 | 1583 |
} |
1570 |
if ($owner == 'file_entity' && $api == 'file_default_displays') {
|
|
1584 |
if ($module == 'file_entity' && $api == 'file_default_displays') {
|
|
1571 | 1585 |
return array('version' => 1); |
1572 | 1586 |
} |
1573 | 1587 |
} |
... | ... | |
1955 | 1969 |
return file_get_content_headers($file); |
1956 | 1970 |
} |
1957 | 1971 |
|
1958 |
return -1;
|
|
1972 |
return NULL;
|
|
1959 | 1973 |
} |
1960 | 1974 |
|
1961 | 1975 |
/** |
Also available in: Unified diff
Weekly update of contrib modules