public function getLocales()
{
// If it's owner locale property is set, just return that
if ($this->ownerLocale) {
return [$this->ownerLocale];
}
$owner = $this->getOwner();
// Otherwise, if we at least know the owner element, then search that for locales
if ($owner) {
$localeIds = [];
foreach ($owner->getLocales() as $localeId => $localeInfo) {
if (is_numeric($localeId) && is_string($localeInfo)) {
$localeIds[] = $localeInfo;
} else {
$localeIds[] = $localeId;
}
}
return $localeIds;
}
// Otherwise it's probably just available in the default site locale
return [craft()->i18n->getPrimarySiteLocaleId()];
}