]> projects.mako.cc - editimage_extension/blobdiff - EditImage.php
removed debug code
[editimage_extension] / EditImage.php
index e945b7f487c0de0884acdebc9a93b7e0ac3ac943..af64e8dde84a7a5ade15577bbc579833c82ae67e 100644 (file)
@@ -15,6 +15,8 @@ $wgAutoloadClasses['EditImage'] = $dir . 'EditImage_body.php';
 $wgExtensionMessagesFiles['EditImage'] = $dir . 'EditImage.i18n.php';
 $wgSpecialPages['EditImage'] = 'EditImage'; 
 # $wgHooks['LanguageGetSpecialPageAliases'][] = 'EditImageLocalizedPageName';
+$wgHooks['SkinTemplateContentActions'][] = 'wfAddactionContentHook';
+#$wgHooks['UnknownAction'][] = 'wfAddactActionHook';
 
 function myExtensionLocalizedPageName(&$specialPageArray, $code) {
   # The localized title of the special page is among the messages of the extension:
@@ -38,4 +40,23 @@ $wgExtensionCredits['specialpage'][] = array(
 
 
 
+function wfAddActionContentHook( &$content_actions ) {
+    global $wgRequest, $wgRequest, $wgTitle;
+    
+    $action = $wgRequest->getText( 'action' ); 
+    if ( $wgTitle->getNamespace() == NS_IMAGE ) {
+
+        $editimage_page = SpecialPage::getTitleFor( 'EditImage');;
+
+        $content_actions['editimage'] = array(
+            'class' => $action == 'editimage' ? 'selected' : false,
+            'text' => "Crop Image", // the wfMsg was not working...
+            'href' => $editimage_page->getLocalURL("image={$wgTitle->getPrefixedURL()}")
+            );
+    }
+
+    return true;
+}
+
+
 ?>

Benjamin Mako Hill || Want to submit a patch?