예제 #1
0
 /**
  * Returns the list of site IDs of the whole tree.
  *
  * @param \Aimeos\MShop\Locale\Item\Site\Iface $item Locale item, maybe with children
  * @return array List of site IDs
  */
 private function getSiteIdsFromTree(\Aimeos\MShop\Locale\Item\Site\Iface $item)
 {
     $list = array($item->getId());
     foreach ($item->getChildren() as $child) {
         $list = array_merge($list, $this->getSiteIdsFromTree($child));
     }
     return $list;
 }
예제 #2
0
 /**
  * Returns the locale item for the given site code, language code and currency code.
  *
  * If the locale item is inherited from a parent site, the site ID of this locale item
  * is changed to the site ID of the actual site. This ensures that items assigned to
  * the same site as the site item are still used.
  *
  * @param string $site Site code
  * @param string $lang Language code
  * @param string $currency Currency code
  * @param boolean $active Flag to get only active items
  * @param \Aimeos\MShop\Locale\Item\Site\Iface Site item
  * @param array $sitePath List of site IDs up to the root site
  * @param array $siteSubTree List of site IDs below and including the current site
  * @return \Aimeos\MShop\Locale\Item\Iface Locale item for the given parameters
  * @throws \Aimeos\MShop\Locale\Exception If no locale item is found
  */
 protected function bootstrapBase($site, $lang, $currency, $active, \Aimeos\MShop\Locale\Item\Site\Iface $siteItem, array $sitePath, array $siteSubTree)
 {
     $siteId = $siteItem->getId();
     $result = $this->bootstrapMatch($siteId, $lang, $currency, $active, $siteItem, $sitePath, $siteSubTree);
     if ($result !== false) {
         return $result;
     }
     $result = $this->bootstrapClosest($siteId, $lang, $active, $siteItem, $sitePath, $siteSubTree);
     if ($result !== false) {
         return $result;
     }
     throw new \Aimeos\MShop\Locale\Exception(sprintf('Locale item for site "%1$s" not found', $site));
 }