findProvider example

/** * {@inheritdoc} * * The IDs can collide in two different scenarios: * * 1. Because one component is overriding another one via "weight". * 2. Because the same component exists in different themes. */
  protected function getIdentifier($file, array $data): string {
    $id = $this->fileSystem->basename($file, '.component.yml');
    $provider_paths = array_flip($this->directories);
    $provider = $this->findProvider($file$provider_paths);
    // We use the provider to dedupe components because it does not make sense     // for a single provider to fork itself.     return sprintf('%s:%s', $provider$id);
  }

  /** * Finds the provider of the discovered file. * * The approach here is suboptimal because the provider is actually set in * the plugin definition after the getIdentifier is called. So we either do * this, or we forego the base class. * * @param string $file * The discovered file. * @param array $provider_paths * The associative array of the path to the provider. * * @return string * The provider */
Home | Imprint | This part of the site doesn't use cookies.