function StringBase::getLocations

Same name and namespace in other branches
  1. 10 core/modules/locale/src/StringBase.php \Drupal\locale\StringBase::getLocations()
  2. 11.x core/modules/locale/src/StringBase.php \Drupal\locale\StringBase::getLocations()
  3. 8.9.x core/modules/locale/src/StringBase.php \Drupal\locale\StringBase::getLocations()

File

core/modules/locale/src/StringBase.php, line 154

Class

StringBase
Defines the locale string base class.

Namespace

Drupal\locale

Code

public function getLocations($check_only = FALSE) {
  if (!isset($this->locations) && !$check_only) {
    $this->locations = [];
    foreach ($this->getStorage()
      ->getLocations([
      'sid' => $this->getId(),
    ]) as $location) {
      $this->locations[$location->type][$location->name] = $location->lid;
    }
  }
  return $this->locations ?? [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.