You are here

protected function IconsetFinderService::setSearchDirs in Social Media Links Block and Field 8.2

Defines a list of the locations, where icon sets are searched.

1 call to IconsetFinderService::setSearchDirs()
IconsetFinderService::__construct in src/IconsetFinderService.php
Define inital state if the service class is constructed.

File

src/IconsetFinderService.php, line 68

Class

IconsetFinderService
Service class to detect the files of the iconsets/ in various directories.

Namespace

Drupal\social_media_links

Code

protected function setSearchDirs() {

  // Similar to 'modules' and 'themes' directories inside an installation
  // profile, installation profiles may want to place libraries into a
  // 'libraries' directory.
  $profile = \Drupal::installProfile();
  if ($profile && strpos($profile, "core") === FALSE) {
    $profile_path = drupal_get_path('profile', $profile);
    $searchdirs[] = "{$profile_path}/libraries";
  }

  // Search sites/all/libraries for backwars-compatibility.
  $searchdirs[] = 'sites/all/libraries';

  // Always search the root 'libraries' directory.
  $searchdirs[] = 'libraries';

  // Also search sites/<domain>/*.
  $site_path = $this->kernel
    ->getSitePath();
  $searchdirs[] = "{$site_path}/libraries";

  // Add the social_media_links module directory.
  $searchdirs[] = drupal_get_path('module', 'social_media_links') . '/libraries';
  $this->searchDirs = $searchdirs;
}