public function validateOptionsForm(&
$form, FormStateInterface
$form_state) { $custom_fields =
['output_lifespan', 'results_lifespan'
];
foreach ($custom_fields as $field) { $cache_options =
$form_state->
getValue('cache_options'
);
if ($cache_options[$field] == 'custom' && !
is_numeric($cache_options[$field . '_custom'
])) { $form_state->
setError($form[$field . '_custom'
],
$this->
t('Custom time values must be numeric.'
));
} } } public function summaryTitle() { $results_lifespan =
$this->
getLifespan('results'
);
$output_lifespan =
$this->
getLifespan('output'
);
return $this->dateFormatter->
formatInterval($results_lifespan, 1
) . '/' .
$this->dateFormatter->
formatInterval($output_lifespan, 1
);
} protected function getLifespan($type) { $lifespan =
$this->options
[$type . '_lifespan'
] == 'custom' ?
$this->options
[$type . '_lifespan_custom'
] :
$this->options
[$type . '_lifespan'
];
return $lifespan;
} protected function cacheExpire($type) { $lifespan =
$this->
getLifespan($type);