mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 08:23:52 +00:00
f8b76afef3
Instead make isUneditableSection an optional property of ContentHeadingItem. Change-Id: Icfddf28aa789b5014ac183ff9f9699f38d78c121
46 lines
1 KiB
PHP
46 lines
1 KiB
PHP
<?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
|
|
) {
|
|
if (
|
|
( $threadItemData['type'] ?? null ) === 'heading' &&
|
|
!( $threadItemData['uneditableSection'] ?? false ) &&
|
|
$contextSource->getSkin()->getSkinName() === 'minerva'
|
|
) {
|
|
$overflowMenuItems[] = new OverflowMenuItem(
|
|
'edit',
|
|
'edit',
|
|
$contextSource->msg( 'skin-view-edit' ),
|
|
2
|
|
);
|
|
}
|
|
}
|
|
}
|