]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2895: Embed uses longtext menu -- I believe that covers *all* the menus we...
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 1 Mar 2011 08:02:12 +0000 (08:02 +0000)
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 1 Mar 2011 08:02:12 +0000 (08:02 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@8534 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/embed/start.php
mod/embed/views/default/embed/link.php [deleted file]

index cda9f4db49e69b531837280c9c1c2c34b3915091..f071657a9150a1607f503b2851d4edd6df24f075 100644 (file)
@@ -15,12 +15,33 @@ function embed_init() {
        elgg_extend_view('css/elgg', 'embed/css');
        elgg_extend_view('js/elgg', 'embed/js');
        elgg_extend_view('footer/analytics', 'embed/lightbox_init');
-       elgg_extend_view('input/longtext', 'embed/link', 1);
+       
+       elgg_register_plugin_hook_handler('register', 'menu:longtext', 'embed_longtext_menu');
 
        // Page handler for the modal media embed
        elgg_register_page_handler('embed', 'embed_page_handler');
 }
 
+function embed_longtext_menu($hook, $type, $items, $vars) {
+       // yeah this is naughty.  embed and ecml might want to merge.
+       if (elgg_is_active_plugin('ecml')) {
+               $active_section = 'active_section=web_services&';
+       } else {
+               $active_section = '';
+       }
+       
+       $items[] = array(
+               'name' => 'embed',
+               'href' => "pg/embed/?{$active_section}internal_name={$vars['name']}",
+               'text' => elgg_echo('media:insert'),
+               'rel' => 'facebox',
+               'class' => 'elgg-longtext-control',
+               'weight' => 1,
+       );
+       
+       return $items;
+}
+
 /**
  * Serves pages for upload and embed.
  *
diff --git a/mod/embed/views/default/embed/link.php b/mod/embed/views/default/embed/link.php
deleted file mode 100644 (file)
index dc3b331..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/**
- * Displays an "Embed media" link in longtext inputs.
- */
-
-// yeah this is naughty.  embed and ecml might want to merge.
-if (elgg_is_active_plugin('ecml')) {
-       $active_section = 'active_section=web_services&';
-} else {
-       $active_section = '';
-}
-
-$url = "pg/embed/?{$active_section}internal_name={$vars['name']}";
-
-echo elgg_view('output/url', array(
-       'href' => $url,
-       'text' => elgg_echo('media:insert'),
-       'rel' => 'facebox',
-       'class' => 'elgg-longtext-control',
-));