1 | <?php |
||||
2 | /** |
||||
3 | * View a file |
||||
4 | * |
||||
5 | * @package ElggFile |
||||
6 | */ |
||||
7 | |||||
8 | $guid = elgg_extract('guid', $vars); |
||||
9 | |||||
10 | elgg_entity_gatekeeper($guid, 'object', 'file'); |
||||
11 | |||||
12 | $file = get_entity($guid); |
||||
13 | |||||
14 | $owner = elgg_get_page_owner_entity(); |
||||
15 | |||||
16 | elgg_push_entity_breadcrumbs($file, false); |
||||
17 | |||||
18 | $title = $file->getDisplayName(); |
||||
19 | |||||
20 | $content = elgg_view_entity($file, [ |
||||
21 | 'full_view' => true, |
||||
22 | 'show_responses' => true, |
||||
23 | ]); |
||||
24 | |||||
25 | if ($file->canDownload()) { |
||||
1 ignored issue
–
show
Bug
introduced
by
Loading history...
|
|||||
26 | elgg_register_menu_item('title', [ |
||||
27 | 'name' => 'download', |
||||
28 | 'text' => elgg_echo('download'), |
||||
29 | 'href' => $file->getDownloadURL(), |
||||
1 ignored issue
–
show
The method
getDownloadURL() does not exist on ElggEntity . It seems like you code against a sub-type of ElggEntity such as ElggFile .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
30 | 'icon' => 'download', |
||||
31 | 'link_class' => 'elgg-button elgg-button-action', |
||||
32 | ]); |
||||
33 | } |
||||
34 | |||||
35 | $body = elgg_view_layout('content', [ |
||||
36 | 'content' => $content, |
||||
37 | 'title' => $title, |
||||
38 | 'filter' => '', |
||||
39 | 'entity' => $file, |
||||
40 | ]); |
||||
41 | |||||
42 | echo elgg_view_page($title, $body); |
||||
43 |