How can I build this module for our Magento 2 cache warmer to crawl both desktop and mobile version pages?
We would like to create a plugin with the method afterGetData on the class MagentoFrameworkAppHttpContext
In this method of the plugin, I would like to add a condition by which an additional parameter “device-type” is added to that data.
The afterGetData method may look like this one:
public function afterGetData($subject, $data)
{
if ([mobile-user-agent-condition]) {
$data[‘device-type’] = ‘mobile’;
} else {
$data[‘device-type’] = ‘desktop’;
}
return $data;
}
Where [mobile-user-agent-condition] is the condition that should return ‘true’ if the user agent is a mobile user-agent.