Answer the question
In order to leave comments, you need to log in
How to remove css styles that are inserted by Bitrix on each landing?
A very smart Bitrix inserts code that no one needs right into the page because he thinks that he needs it for some reason.
<style>
body {
font-weight: 400;
font-family: "Roboto", Arial, sans-serif;
line-height: 1.6;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-moz-font-feature-settings: "liga", "kern";
text-rendering: optimizelegibility;
}
</style>
<style>
h1, h2, h3, h4, h5, h6 {
font-family: "Roboto", Arial, sans-serif;
}
</style>
<style>
html {font-size: 14px;}
body {font-size: 1rem;}
.g-font-size-default {font-size: 1rem;}
</style>
Answer the question
In order to leave comments, you need to log in
The answer is the following. This is not in the documentation, they decided not to describe it to the end.
The code is removed by this hook. We are fraying Bitrix's desire to insert something from our topic.
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandler('landing', 'onHookExec',
function(\Bitrix\Main\Event $event)
{
$result = new \Bitrix\Main\Entity\EventResult;
$result->modifyFields([
'ThemeFonts' => function(/** @var \Bitrix\Landing\Hook\Page $hook */ $hook)
{
\Bitrix\Landing\Manager::setPageView(
'ThemeFonts',
''
);
//обязательно вернуть true, если НЕ требуется выполнение системного
return true;
}
]);
return $result;
}
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question