Skip to content
This repository has been archived by the owner on Feb 13, 2022. It is now read-only.

Commit

Permalink
🐛 closes #21
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Meilick <[email protected]>
  • Loading branch information
bnomei committed Apr 30, 2020
1 parent dd6c6f3 commit ac3ef46
Show file tree
Hide file tree
Showing 6 changed files with 235 additions and 213 deletions.
15 changes: 15 additions & 0 deletions classes/Bnomei/Srcset.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function __construct($data = null, array $options = [])
$this->text = $this->imageKirbytagFromData($this->options);
$this->text = $this->applySrcset($this->text, $this->options);
$this->text = $this->applyRatio($this->text, $this->options);
$this->text = $this->applyWrapper($this->text, $this->options);
}

/**
Expand Down Expand Up @@ -234,6 +235,19 @@ public function applySrcset(string $text, array $data = []): string
return $text;
}

/**
* @param string $text
* @param array $data
* @return string
*/
public function applyWrapper(string $text, array $data = []): string
{
if ($this->option('markdown.extra')) {
return "\n\n<srcsetplugin>\n\n" . $text . "\n\n</srcsetplugin>\n\n";
}
return $text;
}

/**
* @param string $text
* @param array $data
Expand Down Expand Up @@ -304,6 +318,7 @@ public static function defaultOptions(): array
'ratio' => option('bnomei.srcset.ratio'),
'quality' => intval(option('thumbs.quality', 80)),
'nonce' => $nonce,
'markdown.extra' => option('markdown.extra', false),
];
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bnomei/kirby3-srcset",
"type": "kirby-plugin",
"version": "3.3.4",
"version": "3.3.5",
"license": "MIT",
"description": "Kirby 3 Plugin for creating lazyloading image srcset",
"authors": [
Expand Down
Loading

0 comments on commit ac3ef46

Please sign in to comment.