You are here

public function PantheonSolrConnector::findSchemaFiles in Search API Pantheon 8

Find schema files that can be posted to the Solr server.

Return value

array The returned array will be used by Form API.

1 call to PantheonSolrConnector::findSchemaFiles()
PantheonSolrConnector::buildConfigurationForm in src/Plugin/SolrConnector/PantheonSolrConnector.php

File

src/Plugin/SolrConnector/PantheonSolrConnector.php, line 100
Provide a connection to Pantheon's Solr instance.

Class

PantheonSolrConnector
Standard Solr connector.

Namespace

Drupal\search_api_pantheon\Plugin\SolrConnector

Code

public function findSchemaFiles() {
  $return = [];
  $directory = new RecursiveDirectoryIterator('modules');
  $flattened = new RecursiveIteratorIterator($directory);
  $files = new RegexIterator($flattened, '/schema.xml$/');
  foreach ($files as $file) {
    $relative_path = str_replace(DRUPAL_ROOT . '/', '', $file
      ->getRealPath());
    $return[$relative_path] = $relative_path;
  }
  return $return;
}