Show Item-Icon by Default or with Blueprint-Option
wottpal opened this issue · comments
Hi @jongacnik,
this is an awesome plugin, thanks!
Currently there seems no way of differentiating pages with different templates than defining a custom snippet with icon & name in it. This seems like a rather "ugly" workaround for a very common task, right? :)
Wouldn't it be nice to have the blueprint-defined icon at the left of the item-name by default or at least with a simple option like icon: true
. This is the snippet which works fine for me:
<?= $entry->icon() ?> <?= $entry->title() ?>
Update: I just missed the obvious way of declaring an extra column via icon: Icon
but this wastes to much horizontal space IMHO.
Matured Idea of easily enhancing columns without custom snippets:
Icons
Prepend <?= $entry->icon() ?>
(with trailing whitespace) if icon
is set to true
like:
title:
label: Title
icon: true
Preview-Link
Append something like <a href="<?=$entry->url()?>" target="_blank" style="float: right;"><i class="icon icon-left fa fa-play-circle-o"></i></a>
if preview
is set to true
like:
date:
label: Date
preview: true
Date-Formatting
Call the date($format, $field)
function with the given field and format-intructions like:
date:
label: Date
format: d.m.y
Only if visible
Imitiate the behavior of the default Panel sidebar showing the date by wrapping the actual column count with something like <?php if($entry->isVisible()): ?>...<?php else: ?>—<?php endif ?>
if only-if-visible
is set to true
.
Marginalia
Wrap column content with the class marginalia
(gray it out a little bit) the editor to better focus on whats important if (maybe) gray
is set to true
.
Just some ideas :)
Dennis
Hi @wottpal thanks for your notes! The Kirby plugins I write are typically solving needs I have for specific client/personal projects, and I publish them just in case they help someone else out. For my needs, defining column values as snippets works great. That said, I agree these kind of helpers could be useful additions, and I'm happy to review pull-requests!
🤘 J
Nice, I'm definitely willed to do a PR. I just wanted to make sure that you are ok with this :)
I'll go for a two week hiking trip to Scotland tomorrow and will tackle this afterwards!
🤘
Rewrote the field to be based around xhr/json due to needs of my project. This heavily changed the internals and certainly changes the implementation of the above. All custom functionality should be attainable via the new filter
option. I'm happy with the current implementation so perhaps a fork is a better option if you want to implement your additions.
p.s. Enjoy hiking through Scotland
Your new filter
function seems awesome! Having the ability to define everything in one file is also great. I don't think there is a need for forking, but I'll see when I'm back :)