You are here

public function WebformRevisionsRequest::getCurrentWebform in Config Entity Revisions 8.2

Same name and namespace in other branches
  1. 8 modules/webform_revisions/src/WebformRevisionsRequest.php \Drupal\webform_revisions\WebformRevisionsRequest::getCurrentWebform()
  2. 1.x modules/webform_revisions/src/WebformRevisionsRequest.php \Drupal\webform_revisions\WebformRevisionsRequest::getCurrentWebform()

Get webform associated with the current request.

Return value

\Drupal\webform\WebformInterface|null The current request's webform.

Overrides WebformRequest::getCurrentWebform

1 call to WebformRevisionsRequest::getCurrentWebform()
WebformRevisionsRequest::getWebformEntities in modules/webform_revisions/src/WebformRevisionsRequest.php
Get the webform and source entity for the current request.

File

modules/webform_revisions/src/WebformRevisionsRequest.php, line 160

Class

WebformRevisionsRequest
Handles webform requests.

Namespace

Drupal\webform_revisions

Code

public function getCurrentWebform() {
  $webform = $this->routeMatch
    ->getParameter('webform');
  if (is_string($webform)) {
    $webform = $this->entityTypeManager
      ->getStorage('webform')
      ->load($webform);
  }
  if ($webform) {
    return $webform;
  }
  $source_entity = static::getCurrentSourceEntity('webform');
  if ($source_entity && ($source_entity_webform = $this->webformEntityReferenceManager
    ->getWebform($source_entity))) {
    return $source_entity_webform;
  }
  return NULL;
}