1

Essentially I want the plugin to trigger on entries.onSaveEntry which I have working fine at the moment. I want to add a Lightswitch field that will be a condition however. i.e. The plugin will only trigger on save if the Lightswitch entry is turned on.

However I'm having trouble finding use of how to get the status of a field (specifically Lightswitch). Is that data available to be in $event->params['entry']?

Thank you.

1

Yes, it's available in $event->params['entry'].

$entry = $event->params['entry'];
if ($entry->myLightswitch) {
    // do things
}
1
  • Oh wow, it's that easy. I was going about it far more complicated. Thank you.
    – Chris
    Mar 28 '16 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.