Merge "Remove the Group::insertAfter() function in Minerva"

This commit is contained in:
jenkins-bot 2023-02-08 17:12:24 +00:00 committed by Gerrit Code Review
commit a8135a8cff

View file

@ -22,7 +22,6 @@ namespace MediaWiki\Minerva\Menu;
use DomainException;
use MediaWiki\Minerva\Menu\Entries\IMenuEntry;
use MediaWiki\Minerva\Menu\Entries\SingleMenuEntry;
/**
* Model for a menu that can be presented in a skin.
@ -128,34 +127,6 @@ final class Group {
throw new DomainException( "The \"{$name}\" entry doesn't exist." );
}
/**
* Insert an entry after an existing one.
* @deprecated since 1.39
* @param string $targetName The name of the existing entry to insert
* the new entry after
* @param string $name The name of the new entry
* @param string $text Entry label
* @param string $url The URL entry points to
* @param string $className Optional HTML classes
* @param string|null $icon defaults to $name if not specified
* @param bool $trackable Whether an entry will track clicks or not. Default is false.
* @param bool $isJSOnly Whether the entry works without JS
* @throws DomainException When the existing entry doesn't exist
*/
public function insertAfter( $targetName, $name, $text, $url,
$className = '', $icon = null, $trackable = false, $isJSOnly = false
) {
wfDeprecated( __METHOD__, '1.39' );
$this->throwIfNotUnique( $name );
$index = $this->search( $targetName );
$entry = SingleMenuEntry::create( $name, $text, $url, $className, $icon, $trackable );
if ( $isJSOnly ) {
$entry->setJSOnly();
}
array_splice( $this->entries, $index + 1, 0, [ $entry ] );
}
/**
* @param string $targetName
* @return IMenuEntry