Created
June 21, 2022 10:50
-
-
Save bwaidelich/f73d331b8edad8e84f599675f2fdf4e7 to your computer and use it in GitHub Desktop.
Neos CMS: Fusion based Zip Archive (example structure)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Some.Package:ZipArchiveLink zip.files={['resource://Neos.Neos/Public/Images/Login/Logo.svg', 'resource://Neos.Neos/Public/Images/Login/Wallpaper.jpg']} filename="archive.zip"> | |
Download | |
</Some.Package:ZipArchiveLink> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prototype(Some.Package:ZipArchiveUri) { | |
@class = 'Some\\Package\\ZipArchiveUriImplementation' | |
files = ${[]} | |
} | |
prototype(Some.Package:ZipArchiveLink) < prototype(Neos.Fusion:Component) { | |
filename = '' | |
content = '' | |
attributes = Neos.Fusion:DataStructure | |
zip = Some.Package:ZipArchiveUri | |
renderer = afx`<a href={props.zip} download={props.filename} {...props.attributes}>{props.content}</a>` | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace Some\Package; | |
use Neos\Fusion\FusionObjects\AbstractFusionObject; | |
final class ZipArchiveUriImplementation extends AbstractFusionObject | |
{ | |
public function evaluate() | |
{ | |
foreach ($this->fusionValue('files') as $filePathAndName) { | |
// your zip archive logic here | |
} | |
return '/path/to/generated/archive.zip'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment