\Drupal\strata\Form TierSettingsForm

Which buckets history is spread across, and when it moves between them.

The ladder is validated by building it, not by a second copy of the rules written for a form. TierMap refuses a repeated bucket, a threshold that does not increase and a tier naming no provider, and every one of those produces a store that looks configured and is not; running the real constructor here is what stops the two sets of rules drifting apart.

The retention cutoffs are printed next to the age thresholds, because the two are separate dials that answer questions about the same history and an operator setting one wants to see the other. A tier threshold near a retention cutoff means a bucket fills up as a rollup level empties.

The nearest tier's threshold is not editable. It holds everything by definition, and a form that let it be set would let a site configure a store with a gap at the front.

Summary

Methods
Properties
Constants
getFormId
buildForm
validateForm
submitForm
create
No public properties found
TIERS
SETTINGS
settingKeys
getEditableConfigNames
fieldFor
setting
coerce
engine
No protected constants found
addLadder
addTier
rowsFrom
cutoffs
providerOptions
No private properties found
No private constants found

Constant

TIERS

TIERS = 4

Tier rows the form renders.

Four is what the shape this exists for needs - hot, last month, half a year, a year or two - and a row left without a provider is dropped on save, so a site using two configures two.

SETTINGS

SETTINGS = 'strata.settings'

The configuration object every settings form edits.

Properties

$engine

$engine : ?\Drupal\strata\Engine

The engine, reset after a save.

Type

Engine|null

Methods

getFormId()

getFormId() : string

{@inheritdoc}

Returns

string —

buildForm()

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

{@inheritdoc}

Parameters

array $form
\Drupal\Core\Form\FormStateInterface $form_state

Returns

array —

validateForm()

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

{@inheritdoc}

Parameters

array $form
\Drupal\Core\Form\FormStateInterface $form_state

Returns

void —

submitForm()

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

{@inheritdoc}

Parameters

array $form
\Drupal\Core\Form\FormStateInterface $form_state

Returns

void —

create()

create(\Symfony\Component\DependencyInjection\ContainerInterface  $container) : static

{@inheritdoc}

The engine is asked for, never required. composer.json PSR-4 maps Drupal\strata\ onto src/, so every class here loads off composer's autoloader whether or not the module is in core.extension, while strata.services.yml reaches the container only when it is. A router table still holding this route after the module left - a failed install, a composer remove with no uninstall - therefore resolves the class, calls this, and answered 500 with ServiceNotFoundException until 1.0.3. The property is nullable and every use of it is null-safe, so asking is the whole fix.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container

Returns

static —

settingKeys()

settingKeys() : array<string,string>

The settings this form owns, keyed to their type.

Returns

array

Dotted config key keyed to one of "string", "int", "float" or "bool".

getEditableConfigNames()

getEditableConfigNames() : list<string>

{@inheritdoc}

Returns

list

The configuration this form edits.

fieldFor()

fieldFor(string  $key) : string

The form field a config key is edited by.

Dots are not valid in a form element name, so a nested key is rendered under a flattened one.

Parameters

string $key

The dotted config key.

Returns

string —

The form field name.

setting()

setting(string  $key, mixed  $default = null) : mixed

One current setting.

Parameters

string $key

The dotted config key.

mixed $default

What to return when nothing is configured.

Returns

mixed —

The configured value.

coerce()

coerce(mixed  $value, string  $type) : mixed

Coerces a submitted value to the type the config schema declares.

A form always submits strings, and configuration is schema-validated on save, so an integer setting handed the string "15" fails validation on a site running strictConfigSchema.

Parameters

mixed $value

The submitted value.

string $type

One of "string", "int", "float" or "bool".

Returns

mixed —

The coerced value.

addLadder()

addLadder(array  $form) : void

The tier rows.

Parameters

array $form

The form, added to by reference.

Returns

void —

addTier()

addTier(array  $ladder, int  $tier, array  $configured) : void

One tier row.

Parameters

array $ladder

The ladder element, added to by reference.

int $tier

Position on the ladder.

array $configured

What is configured for that position.

Returns

void —

rowsFrom()

rowsFrom(\Drupal\Core\Form\FormStateInterface  $form_state) : list<array<string,mixed>>

The tier rows a submission describes, with the empty ones dropped.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state

The submitted form.

Returns

list> —

Rows in ladder order.

cutoffs()

cutoffs() : string

Where the retention ladder's levels currently end, as a hint for the age thresholds.

Returns

string —

A sentence naming the cutoffs, or a plain sentence when nothing is configured.

providerOptions()

providerOptions() : array<string,string>

The providers a tier can be built from.

Returns

array

Provider id keyed to a label, with an empty option meaning the row is unused.