DragonByte Tech
Well-known member
At the moment, there doesn't appear to be an easy way of using templates to check the add-on cache whether a certain add-on is installed (and/or at least version X).
It would be helpful if we could have the following method added to the
This way, we wouldn't need to replicate this method in our own repositories for use in the templates. This would also streamline the PHP checking of installed add-ons, in case a third party would like to have a word with the checking process for whatever reason
Fillip
It would be helpful if we could have the following method added to the
AddOn
repository:
PHP:
public function hasAddOn($addOnId, $atLeastVersion = null)
{
$addOns = \XF::app()->container('addon.cache');
if (!array_key_exists($addOnId, $addOns))
{
return false;
}
if ($atLeastVersion !== null && $addOns[$addOnId] < $atLeastVersion)
{
return false;
}
return true;
}
This way, we wouldn't need to replicate this method in our own repositories for use in the templates. This would also streamline the PHP checking of installed add-ons, in case a third party would like to have a word with the checking process for whatever reason
Fillip
Upvote
1