From 5fe05b62c85c196081fe661691e1cab280e8263d Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 16 Apr 2012 16:55:43 +0200 Subject: [PATCH] allow CotentHandler to override actions --- includes/ContentHandler.php | 12 ++++++++++++ includes/WikiPage.php | 14 +++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/includes/ContentHandler.php b/includes/ContentHandler.php index 607ec249d8..b1e5827d02 100644 --- a/includes/ContentHandler.php +++ b/includes/ContentHandler.php @@ -358,6 +358,18 @@ abstract class ContentHandler { } } + /** + * 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 actiuon handlers. + * + * @return Array + */ + public function getActionOverrides() { + return array(); + } + /** * Return an Article object suitable for viewing the given object * diff --git a/includes/WikiPage.php b/includes/WikiPage.php index b44db8dbf4..46385464ae 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -139,9 +139,21 @@ class WikiPage extends Page { * @return Array */ public function getActionOverrides() { - return array(); + $content_handler = $this->getContentHandler(); + return $content_handler->getActionOverrides(); } + /** + * Returns the ContentHandler instance to be used to deal with the content of this WikiPage. + * + * Shorthand for ContentHandler::getForModelName( $this->getContentModelName() ); + * + * @return ContentHandler + */ + public function getContentHandler() { + return ContentHandler::getForModelName( $this->getContentModelName() ); + } + /** * Get the title object of the article * @return Title object of this page -- 2.20.1