diff options
Diffstat (limited to 'mod/file/start.php')
-rw-r--r-- | mod/file/start.php | 94 |
1 files changed, 24 insertions, 70 deletions
diff --git a/mod/file/start.php b/mod/file/start.php index b94dc309a..843ae0794 100644 --- a/mod/file/start.php +++ b/mod/file/start.php @@ -57,11 +57,30 @@ function file_init() { // temporary - see #2010 elgg_register_action("file/download", "$action_path/download.php"); - // embed support - elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'file_embed_get_sections'); - elgg_register_plugin_hook_handler('embed_get_items', 'file', 'file_embed_get_items'); - elgg_register_plugin_hook_handler('embed_get_upload_sections', 'all', 'file_embed_get_upload_sections'); + $item = ElggMenuItem::factory(array( + 'name' => 'file', + 'text' => elgg_echo('file'), + 'priority' => 10, + 'data' => array( + 'options' => array( + 'type' => 'object', + 'subtype' => 'file', + ), + ), + )); + elgg_register_menu_item('embed', $item); + + $item = ElggMenuItem::factory(array( + 'name' => 'file_upload', + 'text' => elgg_echo('file:upload'), + 'priority' => 100, + 'data' => array( + 'view' => 'embed/file_upload/content', + ), + )); + + elgg_register_menu_item('embed', $item); } /** @@ -332,69 +351,4 @@ function file_icon_url_override($hook, $type, $returnvalue, $params) { $url = elgg_trigger_plugin_hook('file:icon:url', 'override', $params, $url); return $url; } -} - -/** - * Register file as an embed type. - * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params - */ -function file_embed_get_sections($hook, $type, $value, $params) { - $value['file'] = array( - 'name' => elgg_echo('file'), - 'layout' => 'list', - 'icon_size' => 'small', - ); - - return $value; -} - -/** - * Return a list of files for embedding - * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params - */ -function file_embed_get_items($hook, $type, $value, $params) { - $options = array( - 'owner_guid' => elgg_get_logged_in_user_guid(), - 'type_subtype_pair' => array('object' => 'file'), - 'count' => TRUE - ); - - if ($count = elgg_get_entities($options)) { - $value['count'] += $count; - - unset($options['count']); - $options['offset'] = $params['offset']; - $options['limit'] = $params['limit']; - - $items = elgg_get_entities($options); - - $value['items'] = array_merge($items, $value['items']); - } - - return $value; -} - -/** - * Register file as an embed type. - * - * @param unknown_type $hook - * @param unknown_type $type - * @param unknown_type $value - * @param unknown_type $params - */ -function file_embed_get_upload_sections($hook, $type, $value, $params) { - $value['file'] = array( - 'name' => elgg_echo('file'), - 'view' => 'file/embed_upload' - ); - - return $value; -} +}
\ No newline at end of file |