/** * Returns the content table name that should be joined in for an elements query. * * @param ElementCriteriaModel * * @throws Exception * @return string */ public function getContentTableForElementsQuery(ElementCriteriaModel $criteria) { if ($criteria->id && $criteria->formId) { $form = SproutForms_FormRecord::model()->findById($criteria->formId); if ($form) { return sprintf('sproutformscontent_%s', trim(strtolower($form->handle))); } } }
/** * Returns the value of a given field * * @param string $field * @param string $value * @return SproutForms_FormRecord */ public function getFieldValue($field, $value) { $criteria = new \CDbCriteria(); $criteria->condition = "{$field} =:value"; $criteria->params = array(':value' => $value); $criteria->limit = 1; $result = SproutForms_FormRecord::model()->find($criteria); return $result; }