<?php
namespace Moto\ClickAction; use Moto\Twig\Extension\LinkerExtension; class File extends AbstractClickAction { protected $_defaultData = array( 'target' => '_blank' ); public function getUrl() { $fileSrc = $this->get('file'); if ($fileSrc) { $linker = new LinkerExtension(); return $linker->file($fileSrc); } else { return ''; } } public function getTarget() { if ($this->get('forceDownload', false)) { return ''; } return '_blank'; } public function getAdditionalAttributes() { if ($this->get('forceDownload', false)) { return 'download="' . $this->get('fileName') . '"'; } return ''; } } 