code: private function findLegendForField(array &$config, string $field)
      {
          foreach ($config as $legend => $group) {
              if (\in_array($field, $group['fields'], true)) {
                  return $legend;
              }
          }
  
          return false;
      }
docs: Having the same field in multiple legends is not supported by Contao, so we don't handle that case.
  
  @return string|false