function template_preprocess_crop_crop_summary in Crop API 8
Same name and namespace in other branches
- 8.2 crop.module \template_preprocess_crop_crop_summary()
 
Prepares variables for crop_crop summary template.
Default template: crop-crop-summary.twig.html.
File
- ./
crop.module, line 76  - The Crop API Drupal module.
 
Code
function template_preprocess_crop_crop_summary(&$variables) {
  if (!empty($variables['data']['crop_type'])) {
    $type = \Drupal::entityTypeManager()
      ->getStorage('crop_type')
      ->load($variables['data']['crop_type']);
    $variables['data']['crop_type'] = $type
      ->label();
  }
}