/**
 * Implements hook_field_info_max_weight().
 */
function {{ machine_name }}_field_info_max_weight($entity_type, $bundle, $context, $context_mode) {
  $weights = [];

  foreach (my_module_entity_additions($entity_type, $bundle, $context, $context_mode) as $addition) {
    $weights[] = $addition['weight'];
  }

  return $weights ? max($weights) : NULL;
}
