I have a custom method of detecting whether an extension is installed or not, but it’s not very robust. I would use this custom function to make template content conditional, for example, only display “widget” if the “fubar” extension is installed.
With the ability to activate/deactivate extensions in OXID 4.6.x, I imagine this sort of detection is now built in. Does anybody know how OXID detects that an extension is active? Maybe there’s now a function for detecting this in the 4.6 OXID core that developers could use?
Hi,
I reckon isModuleActive would do the job
BTW: Looked it up in source code documentation, you found it already?
Regards
Sorry, yes, found the oxModule class in the source code shortly after posting. This is a very welcome addition to 4.6!
But, indeed, the documentation would have been a cleaner way to figure this out. Keep forgetting that some open-source projects actually have good documentation
i am actually dealing with same problem: displaying something only if a special module is active.
And thats the way i manage it yet:
in the template i place a custom block instead of directly including widget template
and in the metadata.php i overwrite this block with my widget template… So the block gets overwritten only if the module is active.
[QUOTE=vanilla thunder;103584]
in the template i place a custom block instead of directly including widget template
and in the metadata.php i overwrite this block with my widget template… So the block gets overwritten only if the module is active.[/QUOTE]
Interesting, I didn’t think of that. Now there are two choice:
[{ if $oModule->isActive(‘foobar’) }] …
versus
[{block name=“foobar_widget”}] …
Very nice! I’ll have to think about one versus the other, but your block proposal seems more elegant.