You are here

public function StringBase::getLocations in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/locale/src/StringBase.php \Drupal\locale\StringBase::getLocations()

Gets location information for this string.

Locations are arbitrary pairs of type and name strings, used to store information about the origins of the string, like the file name it was found on, the path on which it was discovered, etc.

A string can have any number of locations since the same string may be found on different places of Drupal code and configuration.

Parameters

bool $check_only: (optional) Set to TRUE to get only new locations added during the current page request and not loading all existing locations.

Return value

array Location ids indexed by type and name.

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 157
Contains \Drupal\locale\StringBase.

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 = array();
    foreach ($this
      ->getStorage()
      ->getLocations(array(
      'sid' => $this
        ->getId(),
    )) as $location) {
      $this->locations[$location->type][$location->name] = $location->lid;
    }
  }
  return isset($this->locations) ? $this->locations : array();
}