You are here

protected function WebformSubmissionForm::getLimitSourceEntity in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformSubmissionForm.php \Drupal\webform\WebformSubmissionForm::getLimitSourceEntity()

Get source entity for use with entity limit total and user submissions.

Return value

\Drupal\Core\Entity\EntityInterface|null The webform submission's source entity.

2 calls to WebformSubmissionForm::getLimitSourceEntity()
WebformSubmissionForm::checkTotalLimit in src/WebformSubmissionForm.php
Check webform submission total limits.
WebformSubmissionForm::checkUserLimit in src/WebformSubmissionForm.php
Check webform submission user limit.

File

src/WebformSubmissionForm.php, line 2998

Class

WebformSubmissionForm
Provides a webform to collect and edit submissions.

Namespace

Drupal\webform

Code

protected function getLimitSourceEntity() {

  /** @var \Drupal\webform\WebformSubmissionInterface $webform_submission */
  $webform_submission = $this
    ->getEntity();
  $source_entity = $webform_submission
    ->getSourceEntity();
  if ($source_entity && $source_entity
    ->getEntityTypeId() !== 'webform') {
    return $source_entity;
  }
  return NULL;
}