You are here

public function WebformManagedFileBase::getTargetEntity in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/WebformManagedFileBase.php \Drupal\webform\Plugin\WebformElement\WebformManagedFileBase::getTargetEntity()

Get referenced entity.

Parameters

array $element: An element.

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

array $options: An array of options.

Return value

\Drupal\Core\Entity\EntityInterface The referenced entity.

Overrides WebformElementEntityReferenceInterface::getTargetEntity

File

src/Plugin/WebformElement/WebformManagedFileBase.php, line 1416

Class

WebformManagedFileBase
Provides a base class webform 'managed_file' elements.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function getTargetEntity(array $element, WebformSubmissionInterface $webform_submission, array $options = []) {
  $value = $this
    ->getValue($element, $webform_submission, $options);
  if (empty($value)) {
    return NULL;
  }
  return $this
    ->getFile($element, $value, $options);
}