-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sonja Broda
committed
Mar 4, 2019
1 parent
c076674
commit 8c92f2f
Showing
5 changed files
with
42 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
/** | ||
* Kirby 3 CodePen Embeds | ||
* | ||
* @version 0.9.0 | ||
* @version 0.9.1 | ||
* @author Sonja Broda <[email protected]> | ||
* @copyright Sonja Broda <[email protected]> | ||
* @link https://github.com/texnixe/kirby3-codepen | ||
|
@@ -17,37 +17,6 @@ | |
'codepen' => __DIR__ . '/snippets/codepen.php' | ||
], | ||
'tags' => [ | ||
'codepen' => [ | ||
'attr' => [ | ||
'user', | ||
'title', | ||
'preview', | ||
'height', | ||
'defaultTab' | ||
], | ||
'html' => function($tag) { | ||
|
||
$id = $tag->value; | ||
$user = $tag->user ?? ''; | ||
$title = $tag->title ?? ''; | ||
$preview = $tag->preview ?? $tag->kirby()->option('texnixe.codepen.preview', true); | ||
$height = $tag->height ?? $tag->kirby()->option('texnixe.codepen.height', 300); | ||
$defaultTab = $tag->defaultTab ?? $tag->kirby()->option('texnixe.codepen.defaultTab', 'js,result'); | ||
$themeId = $tag->kirby()->option('texnixe.codepen.themeId', 1); | ||
|
||
$html = snippet('codepen', [ | ||
'id' => $id, | ||
'user' => $user, | ||
'title' => $title, | ||
'preview' => $preview, | ||
'height' => $height, | ||
'defaultTab' => $defaultTab, | ||
'themeId' => $themeId | ||
], true); | ||
|
||
return $html; | ||
|
||
} | ||
] | ||
'codepen' => require __DIR__ . '/tags/codepen.php' | ||
] | ||
]); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"description": "Kirby 3 plugin providing a Kirbytag (shortcode) for CodePen embeds", | ||
"author": "Sonja Broda <[email protected]>", | ||
"license": "MIT", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/texnixe/kirby3-codepen" | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<div class="codepen-wrapper"> | ||
<p data-height="<?= $height ?>" data-theme-id="<?= $themeId ?>" data-slug-hash="<?= $id ?>" data-default-tab="<?= $defaultTab ?>" data-user="<?= $user ?>" data-embed-version="2" data-pen-title="<?= $title ?>" data-preview="<?= $preview ?>" class="codepen"><?= $content ?></p> | ||
</div> | ||
<script async src="https://static.codepen.io/assets/embed/ei.js"></script> | ||
<script async src="https://static.codepen.io/assets/embed/ei.js"></script> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
return [ | ||
'attr' => [ | ||
'user', | ||
'title', | ||
'preview', | ||
'height', | ||
'defaultTab', | ||
'themeId' | ||
], | ||
'html' => function($tag) { | ||
|
||
$id = $tag->value; | ||
$user = $tag->user ?? ''; | ||
$title = $tag->title ?? ''; | ||
$preview = $tag->preview ?? $tag->kirby()->option('texnixe.codepen.preview', true); | ||
$height = $tag->height ?? $tag->kirby()->option('texnixe.codepen.height', 300); | ||
$defaultTab = $tag->defaultTab ?? $tag->kirby()->option('texnixe.codepen.defaultTab', 'result'); | ||
$themeId = $tag->kirby()->option('texnixe.codepen.themeId', 1); | ||
|
||
|
||
$html = snippet('codepen', [ | ||
'id' => $id, | ||
'user' => $user, | ||
'title' => $title, | ||
'preview' => $preview, | ||
'height' => $height, | ||
'defaultTab' => $defaultTab, | ||
'themeId' => $themeId | ||
], true); | ||
|
||
return $html; | ||
|
||
} | ||
]; |