Skip to content

Commit

Permalink
added slideshow for blog/site with shortcode
Browse files Browse the repository at this point in the history
  • Loading branch information
stfnhmplr committed Aug 26, 2016
1 parent 365c7a0 commit 56b370f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/Content/MiniGalleryPlugin.php
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]
];
}
}
5 changes: 5 additions & 0 deletions views/slideshow.php
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>

0 comments on commit 56b370f

Please sign in to comment.