/** * Decide if the field should be displayed based on thr progressive profiling conditions * * @param array|null $submissions * @param Lead $lead * @param Form $form * * @return boolean */ public function showForContact($submissions = null, Lead $lead = null, Form $form = null) { // Always show in the kiosk mode if ($form !== null && $form->getInKioskMode() === true) { return true; } // Hide the field if there is the submission count limit and hide it untill the limit is overcame if ($this->showAfterXSubmissions > 0 && $this->showAfterXSubmissions > count($submissions)) { return false; } if ($this->showWhenValueExists === false) { // Hide the field if there is the value condition and if we already know the value for this field if ($submissions) { foreach ($submissions as $submission) { if (!empty($submission[$this->alias])) { return false; } } } // Hide the field if the value is already known from the lead profile if ($lead !== null && $this->leadField && $lead->getFieldValue($this->leadField) !== null) { return false; } } return true; }
/** * {@inheritDoc} */ public function getFieldValue($field, $group = NULL) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getFieldValue', array($field, $group)); return parent::getFieldValue($field, $group); }