Trigger event change or bug in docs?

Locked
User avatar
danr7
Joomla! Apprentice
Joomla! Apprentice
Posts: 41
Joined: Wed Oct 18, 2006 10:26 pm

Trigger event change or bug in docs?

Post by danr7 » Thu May 03, 2007 5:00 am

I'm trying to create a plug-in that uses the onAfterDisplayTitle() event. In the documentation on the function at http://dev.joomla.org/component/option, ... splaytitle it says:

5.5.5.3 Return Value
An array. In XHTML/HTML views, this is is an array of strings, each of which becomes a line in the output stream.

My test function returns an array like this:

return array("Hello World!");

When the articles displays, it doesn't display correctly and generates this error:

Notice: Array to string conversion in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\JoomlaSVN\components\com_content\views\article\view.html.php on line 159

Now, when I track down the routine in the view.html.php file and added a print_r() on result returned by the $dispatcher->trigger call, the results looked like this:

Array ( [0] => Array ( [0] => Hello World! ) )

So it looks like it is encapsulating my returned array inside another array. When this encapsulated array is passed to the "implode("\n", $results)", the Notice above is generated. Next, I went to the event.php file where my event function would be called and found the following code:

$result[] = call_user_func_array($observer['handler'], $args);

I believe that puts the returned result as an element of the $result[] array. Is that correct?

So I try and return a single string and the output works. Now my question is which is correct: the documentation or the coding? Will the code be changed to accept an array (which will break my plug-in) or is the documentation in error?

Any guidance would be greatly appreciated.

Locked

Return to “Third Party Testing for Joomla! 1.5”