Smuggli has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/152065

Change subject: Check if view should be added before creating it
......................................................................

Check if view should be added before creating it

Check in the hooks if something should be added not when it is created. So
the authors box was added on some special pages for example

Change-Id: I508a6579e2068ebd177889760e53b6dc8507b2e5
---
M Authors/Authors.class.php
1 file changed, 17 insertions(+), 10 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/65/152065/1

diff --git a/Authors/Authors.class.php b/Authors/Authors.class.php
index b07db22..c5edec2 100644
--- a/Authors/Authors.class.php
+++ b/Authors/Authors.class.php
@@ -160,10 +160,15 @@
         * @return bool always true
         */
        public function onSkinTemplateOutputPageBeforeExec( &$skin, &$tpl ) {
-               global $wgDefaultSkin;
-               if ( $wgDefaultSkin != "bluespiceskin" ){
+               if ( $this->checkContext() === false ) {
                        return true;
                }
+
+               global $wgDefaultSkin;
+               if ( $wgDefaultSkin != "bluespiceskin" ) {
+                       return true;
+               }
+
                $oAuthorsView = $this->getAuthorsViewForAfterContent( $skin );
                $tpl->data['bs_dataAfterContent']['bs-authors'] = array(
                        'position' => 10,
@@ -181,20 +186,22 @@
         * @return boolean
         */
        public function onSkinAfterContent( &$data, $sktemplate ) {
-               global $wgDefaultSkin;
-               if ( $wgDefaultSkin == "bluespiceskin" )
+               if ( $this->checkContext() === false ) {
                        return true;
-               $oAuthorsView = $this->getAuthorsViewForAfterContent( 
$sktemplate );
-               if ( $oAuthorsView instanceof ViewAuthors ) {
-                       $data .= $oAuthorsView->execute();
                }
+
+               global $wgDefaultSkin;
+               if ( $wgDefaultSkin == "bluespiceskin" ) {
+                       return true;
+               }
+
+               $oAuthorsView = $this->getAuthorsViewForAfterContent( 
$sktemplate );
+               $data .= $oAuthorsView->execute();
+
                return true;
        }
 
        private function getAuthorsViewForAfterContent( $oSkin ) {
-               if ( $this->checkContext() === false ) {
-                       return true;
-               }
                $oTitle = $oSkin->getTitle();
 
                //Read in config variables

-- 
To view, visit https://gerrit.wikimedia.org/r/152065
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I508a6579e2068ebd177889760e53b6dc8507b2e5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Smuggli <mug...@hallowelt.biz>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to