+sub convertible_to_filter {
+ my ($class, $key, $unit_name, $prefix) = @_;
+
+ return () unless $unit_name;
+
+ $prefix //= '';
+
+ my $unit = $class->find_by(name => $unit_name);
+ if (!$unit) {
+ $::lxdebug->warn("Unit manager: No unit with name $unit_name");
+ return ();
+ }
+
+ return ("${prefix}name" => [ map { $_->name } @{ $unit->convertible_units } ]);
+}
+
+sub all_units {
+ my ($class) = @_;
+ $::request->cache('all_units')->{sorted} //= $class->get_all_sorted;
+}
+
+sub find_h_unit {
+ my ($class) = @_;
+
+ return $::request->cache('unit_manager')->{h_unit} //= first { $_->name =~ m{^(?: Std | h | Stunde )$}x } @{ $class->all_units };
+}
+
+sub time_based_units {
+ my ($class) = @_;
+
+ my $h_unit = $class->find_h_unit;
+ return [] if !$h_unit;
+ return $::request->cache('unit_manager')->{units} //= $h_unit->convertible_units;
+}
+