1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-20 13:21:54 +02:00

Event hooks now allows for multiple form elements.

Also added $frm->renderHooks($data).
This commit is contained in:
Cameron
2012-11-30 20:47:26 -08:00
parent 564b0600e9
commit 97a0ada0cb
11 changed files with 76 additions and 124 deletions

View File

@@ -1551,6 +1551,47 @@ class e_form
}
/**
* Render Table cells from hooks.
* @param array $data
* @return string
*/
function renderHooks($data)
{
$hooks = e107::getEvent()->triggerHook($data);
$text = "";
if(!empty($hooks))
{
foreach($hooks as $plugin => $hk)
{
$text .= "\n\n<!-- Hook : {$plugin} -->\n";
if(!empty($hk))
{
foreach($hk as $hook)
{
$text .= "\t\t\t<tr>\n";
$text .= "\t\t\t<td>".$hook['caption']."</td>\n";
$text .= "\t\t\t<td>".$hook['html']."";
$text .= (varset($hook['help'])) ? "\n<span class='field-help'>".$hook['help']."</span>" : "";
$text .= "</td>\n\t\t\t</tr>\n";
}
}
}
}
return $text;
}
/**
* Render Table cells from field listing.
* @param array $fieldarray - eg. $this->fields