function StringBase::getLocations

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

Overrides StringInterface::getLocations

1 call to StringBase::getLocations()
StringBase::hasLocation in core/modules/locale/src/StringBase.php
Checks whether the string has a given location.

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.