2023-09-28 11:00:36 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* DiscussionTools hooks for listening to our own hooks
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @ingroup Extensions
|
|
|
|
* @license MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace MediaWiki\Extension\DiscussionTools\Hooks;
|
|
|
|
|
|
|
|
use IContextSource;
|
|
|
|
use MediaWiki\Extension\DiscussionTools\OverflowMenuItem;
|
|
|
|
|
|
|
|
class DiscussionToolsHooks implements
|
|
|
|
DiscussionToolsAddOverflowMenuItemsHook
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param OverflowMenuItem[] &$overflowMenuItems
|
|
|
|
* @param string[] &$resourceLoaderModules
|
|
|
|
* @param array $threadItemData
|
|
|
|
* @param IContextSource $contextSource
|
|
|
|
* @return bool|void
|
|
|
|
*/
|
|
|
|
public function onDiscussionToolsAddOverflowMenuItems(
|
|
|
|
array &$overflowMenuItems,
|
|
|
|
array &$resourceLoaderModules,
|
|
|
|
array $threadItemData,
|
|
|
|
IContextSource $contextSource
|
|
|
|
) {
|
2023-10-11 15:53:55 +00:00
|
|
|
if (
|
|
|
|
( $threadItemData['type'] ?? null ) === 'heading' &&
|
|
|
|
!( $threadItemData['uneditableSection'] ?? false ) &&
|
|
|
|
$contextSource->getSkin()->getSkinName() === 'minerva'
|
|
|
|
) {
|
2023-09-28 11:00:36 +00:00
|
|
|
$overflowMenuItems[] = new OverflowMenuItem(
|
|
|
|
'edit',
|
|
|
|
'edit',
|
|
|
|
$contextSource->msg( 'skin-view-edit' ),
|
|
|
|
2
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|