From 60e96102050d1ccc4913753ffda50af0cd9337b7 Mon Sep 17 00:00:00 2001 From: brettp Date: Tue, 6 Jul 2010 20:20:09 +0000 Subject: Updated documentation for embed. Fixed bug passing internal_name for elggEmbedInsertContent(). Showing a message if no embedable items are returned. git-svn-id: http://code.elgg.org/elgg/trunk@6644 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/embed/views/default/embed/embed.php | 67 ++++++++++++++++++--------------- mod/embed/views/default/embed/link.php | 2 +- 2 files changed, 38 insertions(+), 31 deletions(-) (limited to 'mod/embed/views/default') diff --git a/mod/embed/views/default/embed/embed.php b/mod/embed/views/default/embed/embed.php index 250a7a465..b57c3b289 100644 --- a/mod/embed/views/default/embed/embed.php +++ b/mod/embed/views/default/embed/embed.php @@ -12,7 +12,7 @@ $sections = elgg_get_array_value('sections', $vars, array()); $active_section = elgg_get_array_value('active_section', $vars, array_shift(array_keys($sections))); $upload_sections = elgg_get_array_value('upload_sections', $vars, array()); -$internal_name = elgg_get_array_value('internal_name', $vars, array()); +$internal_name = elgg_get_array_value('internal_name', $vars); if (!$sections) { $content = elgg_echo('embed:no_sections'); @@ -80,34 +80,38 @@ if (!$sections) { if (!elgg_view_exists($view)) { $view = "embed/item/$layout"; } - - // pull out some common tests - // embed requires ECML, but until we have plugin deps working - // we need to explicitly check and use a fallback. - if ($ecml_enabled = is_plugin_enabled('ecml')){ - $ecml_valid_keyword = ecml_is_valid_keyword($active_section); + + if (!isset($embed_info['items']) || !is_array($embed_info['items']) || !count($embed_info['items'])) { + $content .= elgg_echo('embed:no_section_content'); } else { - $ecml_valid_keyword = FALSE; - } - - $items_content = ''; - foreach ($embed_info['items'] as $item) { - $item_params = array( - 'section' => $active_section, - 'item' => $item, - 'ecml_enabled' => $ecml_enabled, - 'ecml_keyword' => ($ecml_valid_keyword) ? $active_section : 'entity', - 'icon_size' => elgg_get_array_value('icon_size', $section_info, 'tiny'), - ); - - $items_content .= elgg_view($view, $item_params); + // pull out some common tests + // embed requires ECML, but until we have plugin deps working + // we need to explicitly check and use a fallback. + if ($ecml_enabled = is_plugin_enabled('ecml')){ + $ecml_valid_keyword = ecml_is_valid_keyword($active_section); + } else { + $ecml_valid_keyword = FALSE; + } + + $items_content = ''; + foreach ($embed_info['items'] as $item) { + $item_params = array( + 'section' => $active_section, + 'item' => $item, + 'ecml_enabled' => $ecml_enabled, + 'ecml_keyword' => ($ecml_valid_keyword) ? $active_section : 'entity', + 'icon_size' => elgg_get_array_value('icon_size', $section_info, 'tiny'), + ); + + $items_content .= elgg_view($view, $item_params); + } + + $params['content'] = $items_content; + $params['count'] = $embed_info['count']; + + $content .= elgg_view('navigation/pagination', $params); + $content .= elgg_view("embed/layouts/$layout", $params); } - - $params['content'] = $items_content; - $params['count'] = $embed_info['count']; - - $content .= elgg_view('navigation/pagination', $params); - $content .= elgg_view("embed/layouts/$layout", $params); } else { $content .= elgg_echo('embed:no_section_content'); } @@ -115,21 +119,24 @@ if (!$sections) { $content .= elgg_echo('embed:invalid_section'); } } + echo $content; ?>