From: daniel Date: Mon, 16 Apr 2012 14:55:43 +0000 (+0200) Subject: allow CotentHandler to override actions X-Git-Tag: 1.31.0-rc.0~22097^2^2~250 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=5fe05b62c85c196081fe661691e1cab280e8263d;p=lhc%2Fweb%2Fwiklou.git allow CotentHandler to override actions --- 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