eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway::getLocationContentMainLanguageId PHP Method

getLocationContentMainLanguageId() abstract public method

Returns main language ID of the Content on the Location with given $locationId.
abstract public getLocationContentMainLanguageId ( integer $locationId ) : integer
$locationId integer
return integer
    public abstract function getLocationContentMainLanguageId($locationId);

Usage Example

Beispiel #1
0
 public function locationSwapped($location1Id, $location1ParentId, $location2Id, $location2ParentId)
 {
     $location1Entries = $this->gateway->loadLocationEntries($location1Id);
     $location2Entries = $this->gateway->loadLocationEntries($location2Id);
     $location1MainLanguageId = $this->gateway->getLocationContentMainLanguageId($location1Id);
     $location2MainLanguageId = $this->gateway->getLocationContentMainLanguageId($location2Id);
     // Load autogenerated entries to find alias ID
     $autoLocation1 = $this->gateway->loadAutogeneratedEntry("eznode:{$location1Id}");
     $autoLocation2 = $this->gateway->loadAutogeneratedEntry("eznode:{$location2Id}");
     // Historize everything first to avoid name conflicts in case swapped Locations are siblings
     $this->historizeBeforeSwap($location1Entries, $location2Entries);
     foreach ($location2Entries as $row) {
         $alwaysAvailable = (bool) ($row['lang_mask'] & 1);
         $languageIds = $this->extractLanguageIdsFromMask($row['lang_mask']);
         foreach ($languageIds as $languageId) {
             $isMainLanguage = $languageId == $location2MainLanguageId;
             $this->internalPublishUrlAliasForLocation($location1Id, $location1ParentId, $row['text'], $languageId, $isMainLanguage && $alwaysAvailable, $isMainLanguage, $autoLocation1['id']);
         }
     }
     foreach ($location1Entries as $row) {
         $alwaysAvailable = (bool) ($row['lang_mask'] & 1);
         $languageIds = $this->extractLanguageIdsFromMask($row['lang_mask']);
         foreach ($languageIds as $languageId) {
             $isMainLanguage = $languageId == $location1MainLanguageId;
             $this->internalPublishUrlAliasForLocation($location2Id, $location2ParentId, $row['text'], $languageId, $isMainLanguage && $alwaysAvailable, $isMainLanguage, $autoLocation2['id']);
         }
     }
 }
All Usage Examples Of eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway::getLocationContentMainLanguageId