Skip to content

Commit

Permalink
fix github issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Jungnickel committed Nov 28, 2017
1 parent 08750f1 commit 5e6ca42
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/ExpandedSingles.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public function init()

// Modified the entry index sources
Event::on(Entry::class, Element::EVENT_REGISTER_SOURCES, function(RegisterElementSourcesEvent $event) {
if ($this->getSettings()->expandSingles) {

// Are we in the context of index?
if ($this->getSettings()->expandSingles && $event->context == 'index') {

// Are there any Singles at all?
foreach ($event->sources as $source) {
Expand Down
3 changes: 0 additions & 3 deletions src/services/SinglesList.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ public function createSinglesList(RegisterElementSourcesEvent $event)
// Grab all the Singles
$singleSections = Craft::$app->sections->getSectionsByType(Section::TYPE_SINGLE);

// Get logged-in user
$user = Craft::$app->getUser();

// Create list of Singles
foreach ($singleSections as $single) {
$entry = Entry::find()
Expand Down

0 comments on commit 5e6ca42

Please sign in to comment.