Globally turn off counters in all panel fields

Hi there,

I would like to turn off all counters by default in all panle fields that make use of it, as I consider this one of the few Kirby defaults that are not very sensible (editors always tend to think there’s a certain max length, which isn’t the case).

How could I achieve this, without setting each new field manually to counter: false?

Thanks!

A small plugin could do:

site/plugins/dontount/index.php:

<?php

use Kirby\Cms\App as Kirby;

Kirby::plugin('trych/dontcount', [
    'fields' => array_reduce(['text', 'textarea'], fn($carry, $type) => $carry + [
        $type => [
            'extends' => $type,
            'props' => [
                'counter' => fn($value = false) => $value
            ]
        ]
    ], [])
]);

Thanks @rasteiner, this works great!

1 Like