protected function YamlFormSubmissionForm::checkTotalLimit in YAML Form 8
Check form submission total limits.
Return value
bool TRUE if form submission total limit have been met.
2 calls to YamlFormSubmissionForm::checkTotalLimit()
- YamlFormSubmissionForm::getCustomForm in src/
YamlFormSubmissionForm.php - Get custom form which is displayed instead of the form's elements.
- YamlFormSubmissionForm::save in src/
YamlFormSubmissionForm.php - Form submission handler for the 'save' action.
File
- src/
YamlFormSubmissionForm.php, line 1289
Class
- YamlFormSubmissionForm
- Provides a form to collect and edit submissions.
Namespace
Drupal\yamlformCode
protected function checkTotalLimit() {
$yamlform = $this
->getYamlForm();
// Check per entity total limit.
$entity_limit_total = $this
->getYamlFormSetting('entity_limit_total');
if ($entity_limit_total && ($source_entity = $this
->getLimitSourceEntity())) {
if ($this->storage
->getTotal($yamlform, $source_entity) >= $entity_limit_total) {
return TRUE;
}
}
// Check total limit.
$limit_total = $this
->getYamlFormSetting('limit_total');
if ($limit_total && $this->storage
->getTotal($yamlform) >= $limit_total) {
return TRUE;
}
return FALSE;
}