Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Hook for linktree v2.1

Started by wintstar, November 07, 2021, 02:07:42 PM

Previous topic - Next topic


Would it be possible with Relase 2.1 to add a hook for linktree in Sources/Load.php.

This would be useful for mods like portal, article, blog, CMS.

The hook could be used to avoid changes for mods in the Load.php file.

<search position="replace"><![CDATA[ // Start the linktree off empty..
$context['linktree'] = array();]]></search>
<add><![CDATA[ // Start the linktree off empty..not quite, have to insert forum
$context['linktree'] = array(array('url' => $scripturl . '?action=forum', 'name' => $txt['example_forum']));]]></add>
<search position="replace"><![CDATA[ // Build up the linktree.
$context['linktree'] = array_merge(
'url' => $scripturl . '#c' . $board_info['cat']['id'],
'name' => $board_info['cat']['name']
<add><![CDATA[ // Build up the linktree (adding for example blog, cms, articles, portal forum index)
$context['linktree'] = array_merge(
'url' => $scripturl . '?action=forum#c' . $board_info['cat']['id'],
'name' => $board_info['cat']['name']
Regards Stephan

,,In order for the possible to come into being, the impossible must be attempted again and again."
Hermann Hesse (1877-1962)

My HomepageMy Board - My Atelier


Since the linktree is just a $context variable, you can already access it using any integration hook at all. So if you want to change it in certain situations, choose a hook that is relevant to that situation. If you want to change it in every situation, choose a hook such as 'integrate_buffer' so that you can make your changes just before the template output begins.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.