News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Hook for linktree v2.1

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

Previous topic - Next topic

wintstar

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

https://github.com/SimpleMachines/SMF2.1/blob/release-2.1/Sources/Load.php#L1230-L1242

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.

<operation>
<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>
</operation>
<operation>
<search position="replace"><![CDATA[ // Build up the linktree.
$context['linktree'] = array_merge(
$context['linktree'],
array(array(
'url' => $scripturl . '#c' . $board_info['cat']['id'],
'name' => $board_info['cat']['name']
)),]]></search>
<add><![CDATA[ // Build up the linktree (adding for example blog, cms, articles, portal forum index)
$context['linktree'] = array_merge(
$context['linktree'],
array(array(
'url' => $scripturl . '?action=forum#c' . $board_info['cat']['id'],
'name' => $board_info['cat']['name']
)),]]></add>
</operation>
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

Sesquipedalian

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.

Advertisement: