code: private function fetchTemplatesFromThemes($templateBaseName)
      {
          $allTemplates = [];
          $themes       = $this
              ->database
              ->createQueryBuilder()
              ->select('id,name,templates')
              ->from('tl_theme')
              ->execute()
              ->fetchAll(\PDO::FETCH_ASSOC);
  
          // Add all the theme templates folders.
          foreach ($themes as $theme) {
              $templateDir = $theme['templates'];
              $themeName   = $theme['name'];
              if ($templateDir != '') {
                  $allTemplates = array_replace_recursive(
                      $allTemplates,
                      $this->getTemplatesForBaseFrom(
                          $templateBaseName,
                          $this->rootDir . '/' . $templateDir,
                          $themeName
                      )
                  );
              }
          }
  
          return $allTemplates;
      }
docs: Fetch the templates from TL_ROOT/templates/.
  
  @param string $templateBaseName The base name for the templates to retrieve.
  
  @return array