preprocess field in drupal 8 code example
Example: drupal 8 preprocess field
/**
* Implement hook_preprocess_field().
*/
function MY_MODULE_preprocess_field(&$variables) {
if (!empty($variables['field_name'])) {
switch ($variables['field_name']) {
case 'created':
break;
}
}
}