- Posts: 88
- Thank you received: 7
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
How to check if current plugin is enabled or activated?
- tassoman
- Topic Author
- Offline
- Premium Member
Less
More
1 year 10 months ago #228127
by tassoman
«All your survey answers are belong to us »
How to check if current plugin is enabled or activated? was created by tassoman
Your LimeSurvey version: 3.x latest
==================
Hello there, I'm extending PluginManager\PluginBase class. I have name, description attributes but I can't find a method or attribute to evaluate if plugin was enabled.
My plugin is doing things, whatever. Just hooking also when disabled.
Inside init() method I've just subscribed to beforeAdminMenuRender. I'd like to add a trigger who subscribe only if plugin is enabled.
I've tried with $this->checkActive(__CLASS__) but dies with Trying to get property 'active' of non-object
==================
Hello there, I'm extending PluginManager\PluginBase class. I have name, description attributes but I can't find a method or attribute to evaluate if plugin was enabled.
My plugin is doing things, whatever. Just hooking also when disabled.
Inside init() method I've just subscribed to beforeAdminMenuRender. I'd like to add a trigger who subscribe only if plugin is enabled.
I've tried with $this->checkActive(__CLASS__) but dies with Trying to get property 'active' of non-object
«All your survey answers are belong to us »
Please Log in to join the conversation.
- tassoman
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 88
- Thank you received: 7
1 year 10 months ago #228128
by tassoman
«All your survey answers are belong to us »
Replied by tassoman on topic How to check if current plugin is enabled or activated?
Nevermind -_- I founded, inside api!
Solution is $this->api->pluginIsActive($this->getName())
Solution is $this->api->pluginIsActive($this->getName())
«All your survey answers are belong to us »
The following user(s) said Thank You: DenisChenu
Please Log in to join the conversation.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13935
- Thank you received: 2551
1 year 10 months ago #228258
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic How to check if current plugin is enabled or activated?
… argl … it's in API …
I use own system always … (check in DB directly)
Else : currently i try to create helper for the tools
1. Yii::getPathOfAlidas : gitlab.com/SondagesPro/coreAndTools/relo...AnyResponse.php#L267
2. App()->getConfig : gitlab.com/SondagesPro/coreAndTools/relo...nyResponse.php#L1252
I use own system always … (check in DB directly)
Else : currently i try to create helper for the tools
1. Yii::getPathOfAlidas : gitlab.com/SondagesPro/coreAndTools/relo...AnyResponse.php#L267
2. App()->getConfig : gitlab.com/SondagesPro/coreAndTools/relo...nyResponse.php#L1252
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Please Log in to join the conversation.
- tassoman
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 88
- Thank you received: 7
1 year 10 months ago #228270
by tassoman
«All your survey answers are belong to us »
Replied by tassoman on topic How to check if current plugin is enabled or activated?
Oldschool singleton development sometimes can be a bit confusing. Really fast but needs a lot of discipline.
For plugin development, I better prefer using namespacing and dependency injection, but the important thing is to get things done in a safe, affordable and fast way.
For plugin development, I better prefer using namespacing and dependency injection, but the important thing is to get things done in a safe, affordable and fast way.
«All your survey answers are belong to us »
Please Log in to join the conversation.