forked from stfnhmplr/pagekit-gallery
-
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.
added slideshow for blog/site with shortcode
- Loading branch information
stfnhmplr
committed
Aug 26, 2016
1 parent
365c7a0
commit 56b370f
Showing
2 changed files
with
41 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Pagekit\Blog\Content; | ||
|
||
use Pagekit\Content\Event\ContentEvent; | ||
use Pagekit\Event\EventSubscriberInterface; | ||
|
||
class ReadmorePlugin implements EventSubscriberInterface | ||
{ | ||
/** | ||
* Content plugins callback. | ||
* | ||
* @param ContentEvent $event | ||
*/ | ||
public function onContentPlugins(ContentEvent $event) | ||
{ | ||
$content = preg_split('/\[readmore\]/i', $event->getContent()); | ||
|
||
if ($event['readmore'] && count($content) > 1) { | ||
$event['post']->readmore = true; | ||
$event->setContent($content[0]); | ||
} else { | ||
$event->setContent(implode('', $content)); | ||
} | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function subscribe() | ||
{ | ||
return [ | ||
'content.plugins' => ['onContentPlugins', 10] | ||
]; | ||
} | ||
} |
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,5 @@ | ||
<ul class="uk-slideshow" data-uk-slideshow> | ||
{% for image in images %} | ||
<li><img src="storage/shw-gallery/{{ image.filename }}" alt="{{ image.alt }}"></li> | ||
{% endfor %} | ||
</ul> |