function _elasticsearch_validate_ttl_field in Elasticsearch Connector 8
Same name and namespace in other branches
- 8.7 elasticsearch_connector.module \_elasticsearch_validate_ttl_field()
- 8.2 elasticsearch_connector.module \_elasticsearch_validate_ttl_field()
- 8.5 elasticsearch_connector.module \_elasticsearch_validate_ttl_field()
- 8.6 elasticsearch_connector.module \_elasticsearch_validate_ttl_field()
Validates #element_validate of any form element as Elasticsearch TTL setting.
Parameters
array $element:
array $form_state:
array $form:
File
- ./
elasticsearch_connector.module, line 522 - Provides hook implementations and functions accessible from other modules.
Code
function _elasticsearch_validate_ttl_field(array $element, array &$form_state, array $form) {
if (!empty($element['#value']) && !preg_match('/^([\\d]+)(d|m|h|ms|w)$/', $element['#value'])) {
form_error($element, t('Invalid elasticsearch TTL value. Please use the proper syntax e.g. 1d (d (days), m (minutes), h (hours), ms (milliseconds) or w (weeks)).'));
}
}