File method for getting select label value?

Hi,
I have done something like this before, but am not sure how to go about it here. I have a file blueprint with the following field:

blockTag:
  label: Block tag
  type: select
  empty: false
  options:
    project-delivery-team: Project delivery team
    involving-setting-staff: Involving setting staff
    working-with-children: Working with children & young people
    involving-families-and-communities: Involving families & communities
    positive-setting-culture: Positive setting culture
    evaluation: Evaluation

And am listing these files in another blueprint like this:

resourcesFiles:
  type: files
  headline: Resources
  template: resource-file
  info: "{{file.blockTag}} - {{file.modified('jS F Y')}}"
  empty: No resources added yet

The {{file.blockTag}} is outputting the value (e.g. involving-setting-staff) and I would like to output the label (e.g. Involving setting staff).

Would I need a file method for this?

Yes, file.blockTag returns the field value (what is stored in the file meta data). The option label, however, is only available in your file blueprint, not in the data.

Cool, thought so.

For future travellers here is what I did:

site/plugins/file-methods/index.php


<?php

Kirby::plugin('mhd/file-methods', [
    'fileMethods' => [
        'getSelectLabel' => function() {
          $options = $this->blueprint()->field('blockTag');
          $value = $this->blockTag()->value();
          if(!empty($value)):
            return $options['options'][$value];
          endif;
        }
    ]
 ]);

?>