Hi Ian,
that's an excellent question. I have done similar things with the content component, by using the meta-keywords field to add either module ids or special keywords that get picked up by MetaMod and used to determine which modules get displayed.
To use this technique for SOBI2 you would need to find a suitable "field" to add a keyword to, where it's not going to be shown to the public. Can you make your own custom fields in SOBI2?
Then you need to find where in the database this is stored, and then query the database to get this information when the MetaMod detects that a SOBI2 item is being displayed.
From the SOBI2 recipe page on this site:
http://www.metamodpro.com/metamod/recip … obi2-pages
You can use this to detect that you are on an entry page and retrieve the id of the item:
if ( $option == "com_sobi2" and JRequest::getVar('sobi2Task') == 'sobi2Details' ) {
$sobi2Id = JRequest::getVar( 'sobi2Id' );
//... do something with it here
}
Then to retrieve something from one of the SOBI2 tables it might be something like this. Here, I am retrieving module ids from the metakeywords field of SOBI2 entries. So if you put in a keyword like MOD_123 then it will display module 123.
if ( $option == "com_sobi2" and JRequest::getVar('sobi2Task') == 'sobi2Details' ) {
$sobi2Id = JRequest::getVar( 'sobi2Id' );
$query = 'SELECT metakey from #__sobi2_item
WHERE itemid = ' . $db->quote($db->getEscaped( $sobi2Id ));
$db->setQuery( $query );
$res = $db->loadResult();
if ($res) return;
$m = preg_match("#MOD_([^.,]+)#", $res, $matches);
if ($matches) {
return @$matches[1];
}
}
Hope that helps,
Stephen