Skip to content

Commit

Permalink
Merge pull request #53 from enupal/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
andrelopez authored Jun 3, 2022
2 parents a9fb13b + e84a806 commit c4c6ed4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Enupal Snapshot Changelog

## 2.0.1 - 2022.06.03
### Fixed
- Fixed issue when retrieving variables on footer and headers ([#52])

[#52]: https://github.com/enupal/snapshot/issues/52

## 2.0.0 - 2022.05.21

### Added
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "enupal/snapshot",
"description": "PDF or Image generation from a Url or HTML page",
"type": "craft-plugin",
"version": "2.0.0",
"version": "2.0.1",
"keywords": [
"craft",
"cms",
Expand All @@ -15,7 +15,7 @@
"support": {
"email": "[email protected]",
"issues": "https://github.com/enupal/snapshot/issues",
"docs": "https://enupal.com/craft-plugins/enupal-snapshot/docs"
"docs": "https://docs.enupal.com/enupal-snapshot/"
},
"authors": [
{
Expand Down
10 changes: 4 additions & 6 deletions src/contracts/SnappyPdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ protected function getGenerator(): GeneratorInterface
*/
public function displayHtml($html, $settings = null)
{
Snapshot::$app->snapshots::addVariables($settings['variables'] ?? []);

$settingsModel = $this->populateSettings($settings);

$response = $this->_generatePdf($html, $settingsModel);
Expand Down Expand Up @@ -154,17 +156,13 @@ public function getDefaultOptions($options = [])
];

if (isset($options['header-html'])) {
$variables = $settings['variables'] ?? [];

$html = Craft::$app->getView()->renderTemplate($options['header-html'], $variables);
$html = Craft::$app->getView()->renderTemplate($options['header-html'], Snapshot::$app->snapshots->getFieldVariables());

$options['header-html'] = $html;
}

if (isset($options['footer-html'])) {
$variables = $settings['variables'] ?? [];

$html = Craft::$app->getView()->renderTemplate($options['footer-html'], $variables);
$html = Craft::$app->getView()->renderTemplate($options['footer-html'], Snapshot::$app->snapshots->getFieldVariables());

$options['footer-html'] = $html;
}
Expand Down

0 comments on commit c4c6ed4

Please sign in to comment.