This adds supportsDirectApiEditing and supportsDirectEditing methods to ContentHandler. Both return false by default for the ContentHandler base class, and true for TextContentHandler and it's derivatives. (everything in core) Extension content types that directly extend AbstractContent / ContentHandler, often / generally don't support direct editing. EntityContent in Wikibase and Flow boards are the two such content types currently in gerrit-hosted extensions. The use and direct settings of the allowNonTextContent member variable is replaced by enableApiEditOverride and a setter for that. The only place allowNonTextContent is used in all of Wikimedia-hosted git repos is core itself (EditPage and ApiEditPage), so should be safe to make this change. With this change, Wikibase can remove its ApiCheckCanExecute hook handler that disallows editing there, and MobileFrontend could check if direct editing is allowed before enabling it's editing features, instead of Wikibase having to add MobileFrontend hook handlers to disable the features. Bug: T96382 Change-Id: I276cd6ecedf38108f1f2be16b38e699e8c5d2d0c
13 lines
283 B
PHP
13 lines
283 B
PHP
<?php
|
|
|
|
/**
|
|
* @group ContentHandler
|
|
*/
|
|
class TextContentHandlerTest extends MediaWikiLangTestCase {
|
|
|
|
public function testSupportsDirectEditing() {
|
|
$handler = new TextContentHandler();
|
|
$this->assertTrue( $handler->supportsDirectEditing(), 'direct editing is supported' );
|
|
}
|
|
|
|
}
|