[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 »

  • 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 »

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 »

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

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

Re: [RFC] hook assign_block_vars

Post by Sam »

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 »

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 »

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