/**
  * Change the module used as an entry-point for Oasis skin and use custom class for rendering edit page
  *
  * Keep global and user nav only.
  *
  * @author macbre
  */
 function setupEditPage(Article $editedArticle, $fullScreen = true, $class = false)
 {
     wfProfileIn(__METHOD__);
     $user = $this->app->wg->User;
     // don't render edit area when we're in read only mode
     if ($this->app->runFunction('wfReadOnly')) {
         // set correct page title
         $this->out->setPageTitle($this->app->runFunction('wfMsg', 'editing', $this->app->getGlobal('wgTitle')->getPrefixedText()));
         return false;
     }
     // use "reskined" edit page layout
     $this->fullScreen = $fullScreen;
     if ($fullScreen) {
         // set Oasis entry-point
         Wikia::setVar('OasisEntryControllerName', 'EditPageLayout');
     }
     // macbre: load YUI on edit page (it's always loaded using $.loadYUI)
     // PLB has problems with $.loadYUI not working correctly in Firefox (callback is fired to early)
     /*
     $srcs = F::build('AssetsManager',array(),'getInstance')->getGroupCommonURL('yui');
     $wgJsMimeType = $this->app->wg->JsMimeType;
     foreach($srcs as $src) {
     	$this->out->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$src}\"></script>");
     }
     */
     $this->out->addModules('wikia.yui');
     // Disable custom JS while loading the edit page on MediaWiki JS pages and user subpages (BugID: 41449)
     if ($editedArticle->getTitle()->getNamespace() === NS_MEDIAWIKI && substr($editedArticle->getTitle()->getText(), -3) === '.js' || $editedArticle->getTitle()->getNamespace() === NS_USER && preg_match('/^' . preg_quote($user->getName(), '/') . '\\/.*\\.js$/', $editedArticle->getTitle()->getText())) {
         $this->out->disallowUserJs();
     }
     // initialize custom edit page
     $this->editPage = new EditPageLayout($editedArticle);
     $editedTitle = $this->editPage->getEditedTitle();
     $formCustomHandler = $this->editPage->getCustomFormHandler();
     $this->addJsVariable('wgIsEditPage', true);
     $this->addJsVariable('wgEditedTitle', $editedTitle->getPrefixedText());
     $this->addJsVariable('wgEditPageClass', $class ? $class : 'SpecialCustomEditPage');
     $this->addJsVariable('wgEditPageHandler', !is_null($formCustomHandler) ? $formCustomHandler->getLocalUrl('wpTitle=$1') : $this->app->getGlobal('wgScript') . '?action=ajax&rs=EditPageLayoutAjax&title=$1');
     $this->addJsVariable('wgEditPagePopularTemplates', TemplateService::getPromotedTemplates());
     $this->addJsVariable('wgEditPageIsWidePage', $this->isWidePage());
     if ($user->isLoggedIn()) {
         global $wgRTEDisablePreferencesChange;
         $wgRTEDisablePreferencesChange = true;
         $this->addJsVariable('wgEditPageWideSourceMode', (bool) $user->getOption('editwidth'));
         unset($wgRTEDisablePreferencesChange);
     }
     $this->addJsVariableRef('wgEditPageFormType', $this->editPage->formtype);
     $this->addJsVariableRef('wgEditPageIsConflict', $this->editPage->isConflict);
     $this->addJsVariable('wgEditPageIsReadOnly', $this->editPage->isReadOnlyPage());
     $this->addJsVariableRef('wgEditPageHasEditPermissionError', $this->editPage->mHasPermissionError);
     $this->addJsVariableRef('wgEditPageSection', $this->editPage->section);
     // data for license module (BugId:6967)
     $titleLicensing = GlobalTitle::newFromText('Community_Central:Licensing', null, 177);
     $this->addJsVariable('wgEditPageLicensingUrl', $titleLicensing->getFullUrl());
     $this->addJsVariable('wgRightsText', $this->app->wg->RightsText);
     // copyright warning for notifications (BugId:7951)
     $this->addJsVariable('wgCopywarn', $this->editPage->getCopyrightNotice());
     // extra hooks for edit page
     $this->app->registerHook('MakeGlobalVariablesScript', 'EditPageLayoutHelper', 'onMakeGlobalVariablesScript', array(), false, $this);
     $this->app->registerHook('SkinGetPageClasses', 'EditPageLayoutHelper', 'onSkinGetPageClasses', array(), false, $this);
     WF::setInstance('EditPageLayoutHelper', $this);
     $this->editPage->setHelper($this);
     wfProfileOut(__METHOD__);
     return $this->editPage;
 }