hook_preprocess_field() $variables crashing while printing I am trying to modify a file field value and add a download svg icon and then add it to a twig file by using a preprocess field.

function myfi_preprocess_field(&amp;$variables) {
  if ($variables['element']['#field_name'] == 'field_download') {
    print_r($variables);
  }
}


I am not sure what I am doing wrong here but the variable is not loading and it is timing out (memory exhaustion)
Use Devel with vardumper and dump only the $element instead of the whole $variables something like:

function myfi_preprocess_field(&amp;$variables) {
  $element = $variables['element'];
  if ($element['#field_name'] == 'field_download') {
    // Dump only the element.
    dpm($element);
  }
}