\Drupal\strata\Plugin\views\field EnumField

Renders a stored enum value as the label it was given a label for.

The realm, verb, severity and classification columns hold the enum's case value - keyvalue, ddl, WARN - because that is what the journal stores and what a filter matches on. Each of those enums already carries a label for exactly this, so a report shows "Key-value store" and "Schema change" rather than the wire form.

There is a subclass per column rather than one handler for all four because ViewsField is not a repeatable attribute, so a plugin id needs a class of its own. The subclasses carry the attribute and name their enum; everything else is here.

Summary

Methods
Properties
Constants
options
buildOptionsForm
render
No public properties found
No public constants found
labelled
defineOptions
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Methods

options()

options() : array<string|int,string>

Every label this column can render, keyed by the value the column stores.

Returns

array

Stored value keyed to label.

buildOptionsForm()

buildOptionsForm(array  $form, \Drupal\Core\Form\FormStateInterface  $form_state) : void

{@inheritdoc}

Parameters

array $form

The form.

\Drupal\Core\Form\FormStateInterface $form_state

The form state.

Returns

void —

render()

render(\Drupal\views\ResultRow  $values) : string

{@inheritdoc}

Parameters

\Drupal\views\ResultRow $values

The row.

Returns

string —

The rendered value.

labelled()

labelled(list<\Drupal\strata\Journal\Realm|\Drupal\strata\Journal\Verb|\Drupal\strata\Capture\Classifier\Classification>  $cases) : array<string,string>

The labels of an enum whose cases carry one.

Parameters

list<\Drupal\strata\Journal\Realm|\Drupal\strata\Journal\Verb|\Drupal\strata\Capture\Classifier\Classification> $cases

The enum's cases.

Returns

array

Case value keyed to label.

defineOptions()

defineOptions() : array<string,mixed>

{@inheritdoc}

Returns

array

The option definitions.