I got stuck. I'm coding a simple module which will be placed/visible only on com_content article pages. This module fetches keywords from the current article, and to avoid an additional database query I use JDocument/getMetaData:
$item = JFactory::getDocument();
$item_keywords = $item->getMetaData('keywords');
This code works well when the module is placed in regular module position and I'm able to get the list of keywords:
architecture, design studio, house
But when I inserted the module in article content through the {loadposition} plugin, I found out that the module cannot retrieve keywords from the current article using JDocument/getMetaData.
Is there any solution how I can retrieve article keywords in the module without additional database query?
Probably I'll add a a code that checks how the module is loaded. My code:
$item = JFactory::getDocument();
if ($item->template) {
echo "standart module load - use getMetaData";
} else {
echo "module loaded by plugin - create an additional query";
}
Do you have a better idea?