/** * Creates and returns a MobileFormatter * * @param MobileContext $context * @param string $html * * @return MobileFormatter */ public static function newFromContext(MobileContext $context, $html) { $mfSpecialCaseMainPage = $context->getMFConfig()->get('MFSpecialCaseMainPage'); $title = $context->getTitle(); $isMainPage = $title->isMainPage() && $mfSpecialCaseMainPage; $isFilePage = $title->inNamespace(NS_FILE); $isSpecialPage = $title->isSpecialPage(); $html = self::wrapHTML($html); $formatter = new MobileFormatter($html, $title); $formatter->enableExpandableSections(!$isMainPage && !$isSpecialPage); $formatter->setIsMainPage($isMainPage); if ($context->getContentTransformations() && !$isFilePage) { $formatter->setRemoveMedia($context->imagesDisabled()); } return $formatter; }
/** * Wrapper for MobileContext::getMFConfig() * @see MobileContext::getMFConfig() * @return Config */ public function getMFConfig() { return $this->mobileContext->getMFConfig(); }