Answers.Body: <p>Yes, it's available in <code>$event-&gt;params['entry']</code>.</p>
  
  <pre><code>$entry = $event-&gt;params['entry'];
  if ($entry-&gt;myLightswitch) {
      // do things
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T15:48:27.730Z
Answers.Text: Oh wow, it's that easy. I was going about it far more complicated. Thank you.
Answers.UserDisplayName: Chris
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T15:41:41.007Z
Answers.LastActivityDate: 2016-03-28T15:41:41.007Z
Answers.UserDisplayName: carlcs
Body: <p>Essentially I want the plugin to trigger on <code>entries.onSaveEntry</code> 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.</p>
  
  <p>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 <code>$event-&gt;params['entry']</code>?</p>
  
  <p>Thank you. </p>
  
Tags: <plugin-development><conditional>
Title: Having a plugin trigger on entries.onSaveEntry if a Lightswitch is turned on
ThreadText: # Having a plugin trigger on entries.onSaveEntry if a Lightswitch is turned on
  
  (Asked by: username_0 on 2016-03-28)
  
  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.
  
  **Tags:** plugin-development, conditional
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-03-28. Score: 1 | Accepted answer
  
  Yes, it's available in `$event->params['entry']`.
  
  ```
  $entry = $event->params['entry'];
  if ($entry->myLightswitch) {
      // do things
  }
  
  ```
  
  > **Comments:**
  > **username_0**: Oh wow, it's that easy. I was going about it far more complicated. Thank you.  
  
  ---
  
  