public function WebformEntityReferenceManager::getWebform in Webform 8.5
Same name and namespace in other branches
- 6.x src/WebformEntityReferenceManager.php \Drupal\webform\WebformEntityReferenceManager::getWebform()
Get an entity's target webform.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: A fieldable content entity.
Return value
\Drupal\webform\WebformInterface|null The entity's target webform or NULL.
Overrides WebformEntityReferenceManagerInterface::getWebform
File
- src/
WebformEntityReferenceManager.php, line 215
Class
- WebformEntityReferenceManager
- Webform entity reference (field) manager.
Namespace
Drupal\webformCode
public function getWebform(EntityInterface $entity = NULL) {
if ($webform_id = $this
->getUserWebformId($entity)) {
return Webform::load($webform_id);
}
elseif ($webforms = $this
->getWebforms($entity)) {
return reset($webforms);
}
else {
return NULL;
}
}