13 class File extends \Magento\Framework\Data\Form\Element\AbstractElement
42 \
Magento\Framework\Data\Form\Element\Factory $factoryElement,
43 \
Magento\Framework\Data\Form\Element\CollectionFactory $factoryCollection,
44 \
Magento\Framework\Escaper $escaper,
45 \
Magento\Backend\Helper\Data $adminhtmlData,
46 \
Magento\Framework\View\Asset\Repository $assetRepo,
50 $this->_adminhtmlData = $adminhtmlData;
51 $this->_assetRepo = $assetRepo;
53 parent::__construct($factoryElement, $factoryCollection, $escaper,
$data);
65 if ($this->getRequired()) {
71 '<input id="%s" name="%s" %s />%s%s',
90 if ($this->getValue() && !$this->getRequired() && !is_array($this->getValue())) {
91 $checkboxId = sprintf(
'%s_delete', $this->
getHtmlId());
94 'name' => sprintf(
'%s[delete]', $this->
getName()),
96 'class' =>
'checkbox',
99 $label = [
'for' => $checkboxId];
100 if ($this->getDisabled()) {
101 $checkbox[
'disabled'] =
'disabled';
102 $label[
'class'] =
'disabled';
120 return 'delete-file';
130 return __(
'Delete File');
141 if ($this->getValue() && !is_array($this->getValue())) {
143 'alt' =>
__(
'Download'),
144 'title' =>
__(
'Download'),
145 'src' => $this->_assetRepo->getUrl(
'images/fam_bullet_disk.gif'),
146 'class' =>
'v-middle' 151 $html .=
'<a href="' .
$url .
'">' .
__(
'Download') .
'</a>';
168 'name' => sprintf(
'%s[value]', $this->
getName()),
169 'id' => sprintf(
'%s_value', $this->
getHtmlId()),
182 return $this->_adminhtmlData->getUrl(
183 'customer/index/viewfile',
184 [
'file' => $this->urlEncoder->encode($this->getValue())]
200 $parts[] = sprintf(
'%s="%s"', $k, $v);
203 return sprintf(
'<%s %s%s>',
$element, implode(
' ', $parts), $closed ?
' /' :
'');
214 if (is_array($this->getValue())) {
217 $value = $this->getValue();
222 return parent::getEscapedValue(
$index);