From 146c55ddd745be06f6206e70884cb9e430ba6231 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Sat, 27 Aug 2011 18:54:13 -0700 Subject: Fixes #2911. Embed plugins works again. Added menu for embed sections. This plugin is painfully messy. --- mod/embed/start.php | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) (limited to 'mod/embed/start.php') diff --git a/mod/embed/start.php b/mod/embed/start.php index bdd832b4e..6c26163e9 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -74,13 +74,34 @@ function embed_page_handler($page) { // listing // item // default to embed/listing | item if not found. - // @todo trigger for all right now. If we categorize these later we can trigger - // for certain categories. - $sections = elgg_trigger_plugin_hook('embed_get_sections', 'all', NULL, array()); - $upload_sections = elgg_trigger_plugin_hook('embed_get_upload_sections', 'all', NULL, array()); - - elgg_sort_3d_array_by_value($sections, 'name'); - elgg_sort_3d_array_by_value($upload_sections, 'name'); + + // @todo the menu system is good for registering and sorting, but not great for + // displaying tabs. + // Pulling in the menu manually and passing it through the embed/tabs view. + // We should work on making it easier to use tabs through the menu system, then fix + // this mess. + $menus = get_config('menus'); + $menu = $menus['embed:sections']; + + $sections = array(); + $upload_sections = array(); + + foreach ($menu as $item) { + switch ($item->section) { + case 'upload': + $upload_sections[$item->getName()] = array( + 'name' => $item->getText(), + ); + break; + + default: + $sections[$item->getName()] = array( + 'name' => $item->getText(), + ); + break; + } + } + $active_section = get_input('active_section', ''); $active_section = preg_replace('[\W]', '', $active_section); $internal_id = get_input('internal_id', ''); @@ -97,4 +118,4 @@ function embed_page_handler($page) { // exit because this is in a modal display. exit; -} +} \ No newline at end of file -- cgit v1.2.3