seppzzz/zipable-dataobjects

This module adds a link (Button) to DataObjects to zip em and download on the fly

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

Type:silverstripe-vendormodule

dev-main 2023-12-03 20:28 UTC

This package is auto-updated.

Last update: 2025-01-03 22:45:54 UTC


README

create .zip files from dataobjects on the fly with textfile and images

Requirements

  • SilverStripe 4 (tested with 4.11 and up)

Installation

Installation is supported via composer only

composer require seppzzz/zipable-dataobjects

Documentation

config.yml :

YourDataObject:
  extensions:
    - seppzzz\ZipableDataObjects\ZipableDataObject

On your Dataobject :

dont change the keys 'Textfields' and 'Images'.

create as many textfields in 'Textfields' - array as needed.

with 'Images' array point to your Image - Object

public function createZipableFields()
{
		
	$fields = [
		'Textfields' => [
			'Title' => $this->Title,
			'Subtitle' => $this->SubTitle,
			'Content' => $this->Content
		],
		'Images' => $this->Images()
	];
		
	return $fields;
		
}

In your template :

<% if $getDownloadLink %>			
	<a href="$getDownloadLink" class="btn btn-primary zipDownloadButton">Download ZIP</a>
<% end_if %>