Page MenuHomePhabricator

Hooks for EditPage Toolbar (function getEditToolbar)
Closed, DeclinedPublic

Description

Author: vg_mediawiki

Description:
Hi,

IMHO, the function getEditToolbar should have 2 hooks for changing the toolarray
and changing the whole toolbar.

The diff should be this:

1529a1531,1537

		// add hook for additionalToolbar Elements
		// first hook extends the normal array....
		// change requiered for PHP5 since passByReference is not allowed anymore
		// 
		
		wfRunHooks( 'changeToolarray', array( &$toolarray  ) );

1550c1557

<

		wfRunHooks( 'addToolbarElements', array( &$toolbar  ) );

Greetings


Version: 1.6.x
Severity: enhancement
OS: Linux
Platform: PC

Details

Reference
bz7245

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:23 PM
bzimport set Reference to bz7245.
bzimport added a subscriber: Unknown Object (MLST).

gunter.schmidt wrote:

Added sitetoolbar function

Attached:

gunter.schmidt wrote:

Example of customized site toolbar

Attached:

gunter.schmidt wrote:

I think it would be easier to have a parameter for LocalSettings.php: $wgUseSiteToolbar = true;
In order to use it, the admin would have to create a file sitetoolbar.php in the main directory (see attachment) and add the
new buttons to /skins/common/images.

And a change in EditPage.php, see patch (Note: This change can be delivered as part of MediaWiki for there is a parameter).

Insert:

if ( $wgUseSiteToolbar = true ) {
    // would be nicer if we could have MediaWiki:SiteToolbar like MediaWiki:common.css
    #print "<br>$IP/sitetoolbar.php";
    if(file_exists("$IP/sitetoolbar.php")) { 
        include_once("$IP/sitetoolbar.php"); 
        $toolarray=$sitetoolarray;
    }
}
if ( count ($toolarray) == 0 ) // if there is a problem with the sitetoolarray

before: $toolarray = array(

robchur wrote:

The editing toolbar can already be changed via JavaScript; we provide a
straightforward array to customise it.

gunter.schmidt wrote:

Maybe it would be a good idea to document that customization procedure somewhere, otherwise it is worthless:

http://meta.wikimedia.org/wiki/Customizing:Edit_Toolbar

vg_mediawiki wrote:

Hi,

I dislike both ways mentioned here

http://meta.wikimedia.org/wiki/Customizing:Edit_Toolbar

In both ways, I've to make the changes more often. (each update)
I even would prefer the hooks more than the SiteToolbar since
I don't have to reevent existings Elements, but this would be fine for me
too.

Greetings Volker

(In reply to comment #4)

The editing toolbar can already be changed via JavaScript; we provide a
straightforward array to customise it.

This is how we customize the edit toolbar. Suggest closing WONTFIX since a method of configuring this already exists.

(In reply to comment #6)

Hi,

I dislike both ways mentioned here

http://meta.wikimedia.org/wiki/Customizing:Edit_Toolbar

In both ways, I've to make the changes more often. (each update)
I even would prefer the hooks more than the SiteToolbar since
I don't have to reevent existings Elements, but this would be fine for me
too.

Greetings Volker

Nothing should ever be lost during an update. TBH, that page on meta that suggests hacking the code should be deleted.