Issue with Uploading Font Files in Blueprint

I need to upload fonts to a file in the blueprint. I added support for ttf, otf, woff, and woff2 extensions at the path /kirby/src/Toolkit/F.php. The changes I made are as follows:

/kirby/src/toolkit/lib/f.php.

Reference: toolkit/lib/f.php at 765c3160c0ee3f35d57bbf99980190ddb9a28f5f · getkirby-v2/toolkit · GitHub

static public $mimes = array(
    ...
    'ttf'   => 'font/ttf',
    'otf'   => 'font/otf',
    'woff'  => 'font/woff',
    'woff2' => 'font/woff2',
);

static public $types = array(
    ...
    'font' => array(
      'ttf',
      'otf',
      'woff',
      'woff2'
    ),
);

/blueprints/pages/font.yml

sections:
          images:
            label: Fonts
            type: files
            layout: cards
            info: "{{ file.dimensions }}"
            size: small

Despite these additions, I still can’t upload files with these extensions. Is there a way to fix this, or am I missing something?


Error: The file type (-) is not valid.

You should not modify the source code, please see Invalid file type - #8 by mrflix for how to solve this.

1 Like