Further along, I cloned the custom plugin for my own and put in the query parameters. After some serious time with print_r() debugging (grin), I figured out what was happening and got my plugin to respond properly in findObjectType() and return the type.
I see where it then calls setOpenGraphTags() to set the tags.
Problem: my og_open_graph_tags is empty. This causes a bug, in that you use explode on the returned parameter, which results in an array with one, empty element. That empty element causes the foreach to fire and then the call to addOpenGraphTag has no $pair[1] which throws a warning, Notice: Undefined offset: 1 in /var/www/modelinsider/html/plugins/opengraph/mi.php on line 91 (your line number will be different, of course)
You need to check $tags for empty before proceeding to the call to explode(); My code looks like this:
protected function setOpenGraphTags()
{
$tags = $this->object->getParameter('og_open_graph_tags');
if (!empty($tags))
{
$tags = explode("\n", $tags);
foreach ($tags as $tag)
{
$pair = explode("=", $tag);
// Add this open graph tag to the page. If the final parameter is false, other objects or {SCOpenGraph} tags can overwrite the value.
// If true, this tag is final.
$this->addOpenGraphTag($pair[0], trim($pair[1]), false);
}
}
}
Next issue...
In looking at the object returned by findObjectType, I see that the "associatedActions" element is empty. It should not be. I've associated an action to this object. As such, I'm at a loss as to what should happen next. I've got my graph tags working properly (when I have some - and often I have none, choosing to use the {} notation in the template itself), but now I need to implement my action, and I'm not sure where that flows.
Is "associatedActions" not what I think it is?
How exactly do I code inside my plugin to publish an action?
Here's where I'm even more confused - I implemented checkActionAfterRoute(), and did a print_r() on $action. I see my action! I presume that this is because I've associated the action with the object, and it fires because the object is returned by virtue of the plugin realizing that the query parameters (option and view) are matches. But the user hasn't taken the action yet! The action is to "collect" a picture, which requires a click on their part.
Do I need to filter inside of checkActionAfterRoute() and also be looking for the task to equal "collect" and then I know that not only did the plugin action fire, but that the situation was correct for the plugin to note that the action actually took place? If so, then... I'm stuck, as no action is being published to Facebook. Here's my code - the call to triggerAction() doesn't seem to be doing anything.
protected function checkActionAfterRoute($action)
{
if (JRequest::getCmd('option') == 'com_mi' && JRequest::getCmd('layout') == 'collect' && $action->system_name == 'collect')
{
$id = JRequest::getVar('id');
$url = 'http://www.modelinsider.com/inline/' . $id;
$this->triggerAction($action, $url);
}
}
I've verified that triggerAction() is being called, so the filter logic is good. It's 1am, so I'm off to crash. Tomorrow, I'll start tracing through that call to triggerAction() and see what's happening unless you have some advice or a "hey, no, here's what you're doing wrong" response