/** * Returns whether or not the entry meets the criteria necessary to trigger the event * * @param mixed $options * @param SproutForms_EntryModel $entry * @param array $params * * @return bool */ public function validateOptions($options, SproutForms_EntryModel $entry, array $params = array()) { $isNewEntry = isset($params['isNewEntry']) && $params['isNewEntry']; $whenNew = isset($options['sproutForms']['saveEntry']['whenNew']) && $options['sproutForms']['saveEntry']['whenNew']; // If any section ids were checked // Make sure the entry belongs in one of them if (!empty($options['sproutForms']['saveEntry']['formIds']) && count($options['sproutForms']['saveEntry']['formIds'])) { if (!in_array($entry->getForm()->id, $options['sproutForms']['saveEntry']['formIds'])) { return false; } } // If only new entries was checked // Make sure the entry is new if (!$whenNew || $whenNew && $isNewEntry) { return true; } return false; }