Get label for select field value from Blueprint

Right, this is just about the (fallback) solution I’ve come to— the only difference being that the array is defined as a static property on the extended PageModel for that blueprint.

Additionally, they’re in need of translation, so some kind of lookup function will be included in the class to handle a label array like this:

class VarietalPage extends Page {
  # ...
  public static $attribute_labels = [
    'rust' => [
      'resistant' => [
        'en' => 'Resistant',
        'es' => 'Resistente'
      ],
      'tolerant' => [
        'en' => 'Tolerant',
        'es' => 'Tolerante'
      ]
      'susceptible' => [
        'en' => 'Susceptible',
        'es' => 'Susceptible'
      ]
    ],
    'cbd' => [
      'resistant' => [
        'en' => 'Resistant',
        'es' => 'Resistente'
      ],
      'tolerant' => [
        'en' => 'Tolerant',
        'es' => 'Tolerante'
      ]
      'susceptible' => [
        'en' => 'Susceptible',
        'es' => 'Susceptible'
      ]
    ]
  ];
  # ...
}

The trouble here is that I’ve already defined these translations in the blueprint, so it’s dozens (probably 100 or more by the time all the fields are included) of lines of duplicate code— basically the entire blueprint translated to native PHP.

Seems like there ought to be a programmatic solution, right!?