Extension talk:Edit Section Link Transform

From MediaWiki.org
Jump to: navigation, search

Contents

[edit] 2007

[edit] Extension origins

See Project:Support desk/Archive 09#MediaWiki:Editsection. —Eep² 14:07, 2 September 2007 (UTC)

[edit] 2008

[edit] Thanks

Nice little extension! Thank you! --Töff 20:57, 31 August 2008 (UTC)

[edit] How do I add "edit" text over the image button?

Is there a way to put text over the image? Where and to what do I add to the code?


[edit] 2011

[edit] Adjusted code, thanks works very well

I have adjusted the code as follows.
In the localsettings.php I entered:
$wgBacktotoptext = "Back To The Top...";
require_once("$IP/extensions/backtotop.php");

Then adjusted your code to:

<?php
if ( !defined( 'MEDIAWIKI' ) ) {
        die( 'This file is a MediaWiki extension, it is not a valid entry point' );
}
 
$wgExtensionCredits['parserhook'][] = array(
    'name'=>'Edit Section Link Transform',
    'url'=>'http://www.mediawiki.org/wiki/Extension:Edit_Section_Link_Transform',
    'author'=>'Tim Laqua, t.laqua at gmail dot com',
    'description'=>'Replaces the [edit] EditSection link in articles with an icon.',
    'version'=>'1.0'
);
 
$wgHooks['ParserAfterTidy'][]  = 'wfEditSectionLinkTransform'; 
 
function wfEditSectionLinkTransform(&$parser, &$text) {
    global $wgBacktotoptext;
    $text = preg_replace("/<span class=\"editsection\">\[<a href=\"(.+)\" title=\"(.+)\">".wfMsg('editsection')."<\/a>\]<\/span>/i", "<span class=\"editsection\">[<a href=\"#top\">$wgBacktotoptext</a>] [<a href=\"$1\" title=\"$2\">".wfMsg('editsection')."</a>]</span>",$text);
            #return false;
#}
    return true;
}

Been looking for a way of adding back to the top button next to edit for a while now, thanks very much. Hope you didn't mind.

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox