[RFC] hook assign_block_vars

These event requests have either been rejected by the community or have become redundant because of code changes or other events requests.
Post Reply
topdown
Registered User
Posts: 12
Joined: Sat Dec 01, 2007 5:04 am

[RFC] hook assign_block_vars

Post by topdown » Sat Aug 21, 2010 6:04 am

  • Name: hook_assign_block_vars
  • Rationale: This hook will allow someone to filter/add to a specified assign_block_vars allowing addition of vars in a specific loop.
  • Placement: includes/template.php
  • Input arguments: $block_name, $vararray = array(), $args = array()
  • Output format: array
  • Output semantics: Returns the array for $block_name
  • Infrastructure: This would allow hooking into any templates block_vars array with ease and without editing core files or other mods.

User avatar
Erik Frèrejean
Registered User
Posts: 207
Joined: Thu Oct 25, 2007 2:25 pm
Location: surfnet
Contact:

Re: [RFC] hook assign_block_vars

Post by Erik Frèrejean » Sat Aug 21, 2010 12:03 pm

I might miss something, but this sounds like template::alter_block_array. I'm not sure what advantage this hook will bring over alter_block_array.
Available on .com
Support Toolkit developer

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: [RFC] hook assign_block_vars

Post by nickvergessen » Sat Aug 21, 2010 1:23 pm

With the hook you don't need to edit the core, else you need to edit the core and add your alter statement somewhere.
Member of the Development-TeamNo Support via PM

User avatar
Sam
Registered User
Posts: 31
Joined: Fri Jan 23, 2009 10:24 pm

Re: [RFC] hook assign_block_vars

Post by Sam » Sat Aug 21, 2010 3:40 pm

I believe a better approach would be to hook the arrays before they enter that function. You have a better understanding of what data is going in, and you don't need to detect what's going into assign_block_vars

Michaelo
Registered User
Posts: 106
Joined: Thu Apr 01, 2004 7:56 am
Location: Dublin

Re: [RFC] hook assign_block_vars

Post by Michaelo » Fri Jan 07, 2011 12:22 am

I have deleted this and posted in: [3.1/Ascraeus] Hook Location Requests viewtopic.php?f=111&p=218361#p218361
Last edited by Michaelo on Mon Jan 10, 2011 7:33 am, edited 3 times in total.
Mods: Forum Icons Enhancement, Kiss Portal Engine
Links:
Kiss Portal Engine (dev site) Stargate Portal (archive site) ...
Styles: Technika

Michaelo
Registered User
Posts: 106
Joined: Thu Apr 01, 2004 7:56 am
Location: Dublin

Re: [RFC] hook assign_block_vars

Post by Michaelo » Sun Jan 09, 2011 6:50 pm

Consider the following... (viewtopic.php code ref: Check sticky/announcement time limit)

Simplified version, assume core code:

Code: Select all

if ($topic_data['topic_type'] == POST_STICKY)
{
	... some code including an sql query ...
} 
A mod edit would result in:

Code: Select all

if ($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == MOD_VAR)
{
	... somecode including an sql query ...
}
How would this be handled with hooks?
Mods: Forum Icons Enhancement, Kiss Portal Engine
Links:
Kiss Portal Engine (dev site) Stargate Portal (archive site) ...
Styles: Technika

Post Reply