+
+/**
+ * Network hook into the HTML head to enable infinite scroll.
+ *
+ * Since the HTML head is built after the module content has been generated, we need to retrieve the base query string
+ * of the page to make the correct asynchronous call. This is obtained through the Pager that was instantiated in
+ * networkThreadedView or networkFlatView.
+ *
+ * @global Pager $pager
+ * @param App $a
+ * @param string $htmlhead The head tag HTML string
+ */
+function network_infinite_scroll_head(App $a, &$htmlhead)
+{
+ /// @TODO this will have to be converted to a static property of the converted Module\Network class
+ global $pager;
+
+ if (PConfig::get(local_user(), 'system', 'infinite_scroll')
+ && defaults($_GET, 'mode', '') != 'minimal'
+ ) {
+ $tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl');
+ $htmlhead .= Renderer::replaceMacros($tpl, [
+ '$pageno' => $pager->getPage(),
+ '$reload_uri' => $pager->getBaseQueryString()
+ ]);
+ }
+}