flokosiol / kirby-subpagelist

Subpagelist field plugin for Kirby 2
MIT License
46 stars 4 forks source link

Display template type in list #6

Closed coreytegeler closed 8 years ago

coreytegeler commented 8 years ago

Would it be possible to show the template or intededTemplate value within the list?

flokosiol commented 8 years ago

Unfortunately this is not possible at the moment, because I'm using Kirby's default sidebar snippet to display the list of subpages.

But I will have closer look at it and maybe it's possible to implement your suggestion.

coreytegeler commented 8 years ago

It was easy enough to add in what I need into /panel/app/snippets/pages/sidebar/subpage.php, but I'd like to avoid digging into the core Kirby files like that

Maybe there could simply be a clone of the subpage/subpages files within the plugin that allows for customization.

I'm having trouble figuring out how to reconfigure the below code to use a file within the plugin directory. Snippet() always looks in /panel/app/snippets/ but doesn't seem to let me get out of it. The path below looks here: /panel/app/snippets//////////sites/fields/subpagelist/subpages.php

$subpages = new Snippet('../../../sites/fields/subpagelist/subpages', array(
      'title'      => $this->i18n($this->label),
      'page'       => $this->page(),
      'subpages'   => $children,
      'addbutton'  => $this->page->addButton(),
      'pagination' => $pagination
));

$wrapper->html(tpl::load(__DIR__ . DS . 'template.php', array('subpages' => $subpages)));
return $wrapper;

any advice?

flokosiol commented 8 years ago

Finally I had the time to have a short look at this and I found a solution how to use custom snippets. I need some more time to clean things up, but after that I can show you how to do it. But it's nothing I will add to the official repo for now …

coreytegeler commented 8 years ago

Awesome! I super appreciate the help

flokosiol commented 8 years ago

https://gist.github.com/flokosiol/0de6a275471250774c5ddcaa6e411587

Replace the two files inside the subpagelist folder and adjust the template file as mentioned in the comments. This should work … hopefully :)