You are here

public function WebformManagedFileBase::previewManagedFile in Webform 6.x

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

Preview a managed file element upload.

Parameters

array $element: An element.

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

array $options: An array of options.

Return value

string|array A preview.

File

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

Class

WebformManagedFileBase
Provides a base class webform 'managed_file' elements.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function previewManagedFile(array $element, WebformSubmissionInterface $webform_submission, array $options = []) {
  $build = $this
    ->formatHtmlItem($element, $webform_submission, $options);
  return is_array($build) ? $build : [
    '#markup' => $build,
  ];
}