Hook to alter Walled Garden view

Hello, I'm running Elgg 3.3.12 and my plugin is attempting to alter the output of the walled_garden page. I've created a hook that calls back to a function that alters the 'log in' title of the walled_garden page, however I can only access the $vars['title'] by calling:
elgg_register_plugin_hook_handler('view_vars', 'page/layouts/elements/header', 'walled_garden_page');

As I would like to replace the site-name hyperlink and remove the footer of the walled_garden page, I have tried to call:
elgg_register_plugin_hook_handler('view_vars', 'page/walled_garden', 'walled_garden_page');
elgg_register_plugin_hook_handler('view_vars', 'page/elements/walled_garden/header','walled_garden_page');

However, neither of the above returns the value of the $vars['title'] (log in). Is there way to return all the elements used in the walled_garden page?

Thanks in advance. 
 

  • why don't you overrule the views? http://learn.elgg.org/en/stable/guides/views.html#overriding-views

    • views/default/resources/walled_garden.php (the resource)
    • views/default/page/walled_garden.php (the layout, here you can remove footer, etc)
    • views/default/page/elements/walled_garden/* (different elements in the layout)
       
  • Thanks for your speedy response, Jerome. I did what you suggested originally and then I read there was a caveat to that methodology due to long term maintenance.

    If it is possible, I would really like to get a grip of those hooks :) 

    Just out of interest, is there a performance implication in either of the solutions?

  • I did what you suggested originally and then I read there was a caveat to that methodology due to long term maintenance.

    What would be the problem? If you override the views in your own plugin (and NOT change the core views) the only problem I can see if we patch something in a view you won't get it.

    Since this rarely happens for the core views (mainly in major builds) I don't think this will be a problem.

    Just out of interest, is there a performance implication in either of the solutions?

    Hooks add a (tiny) bit of extra execution and therefor performance costs (but it's very very small), overruling the view doesn't add additional execution so no penalty

  • Thanks again, Jerome. I'll do as you suggest.

    I'll have to find another use for those hooks :)

  • I'll have to find another use for those hooks

    hint: menu items ;)

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking