From c415767e0e356cf86da04368fe67d2d8c969eae9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thiemo=20M=C3=A4ttig?= Date: Wed, 18 May 2016 15:49:26 +0200 Subject: [PATCH] Add actual documentation for ContentHandler::getActionOverrides Change-Id: I7fd803204ad137dd3510ea321ff7e6fa11d910c0 --- includes/actions/Action.php | 2 +- includes/content/ContentHandler.php | 7 ++++++- includes/page/Article.php | 2 +- includes/page/WikiPage.php | 10 ++-------- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/includes/actions/Action.php b/includes/actions/Action.php index 839d7b23e7..84bf16ee8f 100644 --- a/includes/actions/Action.php +++ b/includes/actions/Action.php @@ -62,7 +62,7 @@ abstract class Action { * the action is disabled, or null if it's not recognised * @param string $action * @param array $overrides - * @return bool|null|string|callable + * @return bool|null|string|callable|Action */ final private static function getClass( $action, array $overrides ) { global $wgActions; diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index f3d678108f..e225fb783f 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -641,7 +641,12 @@ abstract class ContentHandler { * * @since 1.21 * - * @return array Always an empty array. + * @return array An array mapping action names (typically "view", "edit", "history" etc.) to + * either the full qualified class name of an Action class, a callable taking ( Page $page, + * IContextSource $context = null ) as parameters and returning an Action object, or an actual + * Action object. An empty array in this default implementation. + * + * @see Action::factory */ public function getActionOverrides() { return []; diff --git a/includes/page/Article.php b/includes/page/Article.php index 6c42e3427e..4c9eaedce4 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -2204,7 +2204,7 @@ class Article implements Page { /** * Call to WikiPage function for backwards compatibility. - * @see WikiPage::getActionOverrides + * @see ContentHandler::getActionOverrides */ public function getActionOverrides() { return $this->mPage->getActionOverrides(); diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 040a6f328a..870215672d 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -183,18 +183,12 @@ class WikiPage implements Page, IDBAccessObject { } /** - * Returns overrides for action handlers. - * Classes listed here will be used instead of the default one when - * (and only when) $wgActions[$action] === true. This allows subclasses - * to override the default behavior. - * * @todo Move this UI stuff somewhere else * - * @return array + * @see ContentHandler::getActionOverrides */ public function getActionOverrides() { - $content_handler = $this->getContentHandler(); - return $content_handler->getActionOverrides(); + return $this->getContentHandler()->getActionOverrides(); } /** -- 2.20.1