You are here

public function YamlFormRequest::getCurrentYamlForm in YAML Form 8

Get form associated with the current request.

Return value

\Drupal\yamlform\YamlFormInterface|null The current request's form.

Overrides YamlFormRequestInterface::getCurrentYamlForm

1 call to YamlFormRequest::getCurrentYamlForm()
YamlFormRequest::getYamlFormEntities in src/YamlFormRequest.php
Get the form and source entity for the current request.

File

src/YamlFormRequest.php, line 92

Class

YamlFormRequest
Handles form requests.

Namespace

Drupal\yamlform

Code

public function getCurrentYamlForm() {
  $source_entity = self::getCurrentSourceEntity('yamlform');
  if ($source_entity && method_exists($source_entity, 'hasField') && $source_entity
    ->hasField('yamlform')) {
    return $source_entity->yamlform->entity;
  }
  else {
    return $this->routeMatch
      ->getParameter('yamlform');
  }
}