Skip to main content
Temporary hooks listing/documentation Started by emanuele · · Read 72946 times 0 Members and 1 Guest are viewing this topic. previous topic - next topic

Re: Temporary hooks listing/documentation

Reply #15

Then I would have the shoutbox without hooks Insert.Tthis would be inserted here:

above
Code: (php) [Select]
function template_boardindex_outer_above()
{
    global $context, $settings, $txt;
    
    template_inc_talk_aboveIndex();

below
Code: (php) [Select]
function template_info_center()
{
    global $context, $txt;
    
    template_inc_talk_belowIndex();

Here you can watch it in my SMF modification =>http://experiri.scaricare.de/index.php?topic=3.msg3#msg3




Regards Stephan

Re: Temporary hooks listing/documentation

Reply #16

One thing I can't easily quite figure out from this massive list of hooks is if there is a straightforward way to add something underneath the poster info. Specifically I mean something like in the attached screenshot.

Of course I could tap into integrate_buffer, but that's not really terribly different from source modification.

Re: Temporary hooks listing/documentation

Reply #17

That's an SMF screen, so it may depend if you want to add stuff to the dropdown or directly under the avatar.
Anyway you could either borrow the custom fields "space" (i.e. integrate_prepare_display_context) and use placement equal to 0 or 1) or actually use a custom field (that from the screenshot looks like what you would take more advantage from).
Bugs creator.
Features destroyer.
Template killer.

Re: Temporary hooks listing/documentation

Reply #18

It's a per-post thing (like IP address), so integrate_prepare_display_context is probably what I'm looking for. It's my own take on this mod, with mostly importantly a different detection mechanism and full user agent.

Re: Temporary hooks listing/documentation

Reply #19

Makes sense. :D
Bugs creator.
Features destroyer.
Template killer.

Re: Temporary hooks listing/documentation

Reply #20

I must be missing something. I enabled Advanced Profile Fields, but while they're showing up for editing in my profile, they don't seem to show on the board like they do here. Is there a switch somewhere that I'm missing? Besides that I haven't quite been able to figure out how to tap into these custom fields, 'cause there doesn't seem to be a $message['member']['custom_fields'] or $output['member']['custom_fields'] or some such.[1] Could you maybe give me a little hint in the right direction? Of course it wouldn't be the worst thing to have to do a little source modification in the theme given how I was able to stick everything else in hooks, but it'd be pretty cool to go hooks only. ;)
For this purpose I tend to find the easiest way to gain some quick insight is by sticking in something like error_log(print_r($output, TRUE), 0), rather than necessarily by perusing the code.

Re: Temporary hooks listing/documentation

Reply #21

Okay, I found the problem. The icons show up only after you enter their editing space and explicitly click save. That in turn also fills up the $output['member']['custom_fields'] array. Reported as #2479.
Last Edit: April 03, 2016, 08:24:51 am by Frenzie

Re: Temporary hooks listing/documentation

Reply #22

Today I was in "coding fancy stuff" mood and wrote this:
https://gist.github.com/emanuele45/4924876bb2b4d32f1ed6f9d38989a27f
the idea is parse any file, find all the instances of call_integration_hook, grab any "doc block" before it and parse the resulting stuff the same way any normal DocBlock is parsed, for example:
Code: [Select]
		/**
* This hook allows to alter the content of the arrays containing the data
* for each message.
*
* @param mixed[] $output Data ready to be sent to the template
* @param mixed[] $message Data coming from the database
*/
call_integration_hook('integrate_prepare_display_context', array(&$output, &$message));
at the moment, the code in the gist creates an array with all the elements, what is left is to actually create the documentation similarly to documentor (or whatever is currently used :P).

What do you think?
Bugs creator.
Features destroyer.
Template killer.

Re: Temporary hooks listing/documentation

Reply #23

Pretty cool idea  :)  ... may require us to add some docblocks for some of the hooks, I'd imagine some are not documented well or at all.   Could do the same thing for the events as well.

Docs are done with apigen

Re: Temporary hooks listing/documentation

Reply #24

I wonder if you could just use the doc block parser but I imagine this is much faster. Good idea to lessen the workload on documentation

Re: Temporary hooks listing/documentation

Reply #25

Quote from: Spuds – Could do the same thing for the events as well.
Yep, I started with hooks because are easier. O:-)

Quote from: Joshua Dickerson – I wonder if you could just use the doc block parser but I imagine this is much faster.
I looked into this a couple of times (or three), though as far as I understood, all the documentation generators are geared towards collecting only stuff that is outside the functions in very specific places and are not able and not easy to persuade to grab comments in other places. :-\
Bugs creator.
Features destroyer.
Template killer.

Re: Temporary hooks listing/documentation

Reply #26

I seem to be missing an integrate_profile_buttons or something along those lines here?

Re: Temporary hooks listing/documentation

Reply #27

I think it should be integrate_profile_areas.

Debug the profile site if you are not sure. $db_show_debug = true;


Re: Temporary hooks listing/documentation

Reply #29

It ends with _areas and there is only one with that in profile page. I also do use a similar integrate_admin_areas for admin menu. So I think it is correct (if by button you mean the menu button that is :))).