Extension talk:Edit Section Link Transform
Add topic2007
[edit]Extension origins
[edit]See Project:Support desk/Archive 09#MediaWiki:Editsection. —Eep² 14:07, 2 September 2007 (UTC)
2008
[edit]Thanks
[edit]Nice little extension! Thank you! --Töff 20:57, 31 August 2008 (UTC)
How do I add "edit" text over the image button?
[edit]Is there a way to put text over the image? Where and to what do I add to the code?
2011
[edit]Adjusted code, thanks works very well
[edit]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.
2012
[edit]1.19.0
[edit]I use this function as "BackToTop" in 1.19.0. Thanks for create :-)
To adjust the
$wgHooks['ParserAfterTidy'][] = 'wfEditSectionLinkTransform';
in
$wgHooks['OutputPageBeforeHTML'][] = 'wfEditSectionLinkTransform';
and it is working. (Sorry for my broken English) --Speedy McCat. Keiner ist unnütz, er kann immer noch als schlechtes Beispiel dienen. (talk) 09:44, 22 May 2012 (UTC)
2013
[edit]1.19.3
[edit]It doesn't seem to be working anymore. The edit like doesn't output the URL. Just a blank URL when it displays on page.
1.19.6
[edit]Edit 5-22-2013 . Same guy that complained above. I got it working now. Use code below. Check out my wiki for an example Dungeon Striker Wiki
<?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['OutputPageBeforeHTML'][] = 'wfEditSectionLinkTransform';
function wfEditSectionLinkTransform(&$parser, &$text) {
global $wgEditSectionIcon;
$text = preg_replace("/<span class=\"editsection\">\[<a href=\"(.+)\" title=\"(.+)\">".
wfMsg('editsection')."<\/a>\]<\/span>/i", "<span class=\"editsection\"><a href=\"$1\" title=\"$2\"><img src=\"".
$wgEditSectionIcon."\" width=\"56px\" height=\"19px\" border=\"0\" alt=\"\"></a></span>",
$text);
return true;
}
2014
[edit]<?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, modified by Ralf Naujokat',
'description' => 'Replaces the [edit] EditSection link in articles with an icon.',
'version' => '2.1, 2016-07-01'
);
$wgHooks['OutputPageBeforeHTML'][] = 'wfEditSectionLinkTransform';
function wfEditSectionLinkTransform( &$parser, &$text )
{
global $wgEditSectionIcon;
$pattern = ''
.'/'
.'<span class="mw-editsection-bracket">\[<\/span>'
.'<a href="(.+)" title="(.+)">'.wfMessage('editsection').'<\/a>'
.'<span class="mw-editsection-bracket">\]<\/span>'
.'/i'
;
$replacement = ''
.'<a href="$1" title="$2">'
.'<img src="'.$wgEditSectionIcon.'" border="0" />'
.'</a>'
;
$text = preg_replace( $pattern, $replacement, $text );
return true;
}
2017
[edit]1.28.x
[edit]This is working with MediaWiki, V. 1.28.0 - 2 (R. Naujokat)
1.29.x
[edit]This is working with MediaWiki, V. 1.29.0 - 1.29.2 (R. Naujokat)
1.30.0
[edit]This is working with MediaWiki, V. 1.30.0 (R. Naujokat)
2018
[edit]1.31.x
[edit]This is working with MediaWiki, V. 1.31.0 - 1.31.1 (R. Naujokat)
Timeless skin
[edit]MediaWiki 1.31 now contains the new "timeless" skin embedded in the standard tarball distribution. This skin uses its own icon for editing, a pencil on the right-hand side of every headline. Additionally the "EditSectionLinkTransform" adds its icon, so we have two icons. I think when using the timeless skin, it'd be the best the extension does nothing. --Alzi24 (talk) 11:52, 21 December 2018 (UTC)
Alternative??
[edit]What's the alternative way of transforming links into icons now this extension is no longer supported? 81.154.143.7 01:00, 26 October 2024 (UTC)