setXDefault() public method

Sets if this localization is the x-default one.
public setXDefault ( boolean $xDefault )
$xDefault boolean
示例#1
0
 /**
  * Generates a localization from the given node.
  *
  * @param \DOMElement|\DOMNode $localizationNode
  * @param bool $flat
  * @param null $parent
  *
  * @return Localization
  */
 protected function generateLocalizationFromNode(\DOMElement $localizationNode, $flat = false, $parent = null)
 {
     $localization = new Localization();
     $localization->setLanguage($localizationNode->attributes->getNamedItem('language')->nodeValue);
     // set parent if given
     if ($parent) {
         $localization->setParent($parent);
     }
     // set optional nodes
     $countryNode = $localizationNode->attributes->getNamedItem('country');
     if ($countryNode) {
         $localization->setCountry($countryNode->nodeValue);
     }
     $shadowNode = $localizationNode->attributes->getNamedItem('shadow');
     if ($shadowNode) {
         $localization->setShadow($shadowNode->nodeValue);
     }
     $defaultNode = $localizationNode->attributes->getNamedItem('default');
     if ($defaultNode) {
         $localization->setDefault($defaultNode->nodeValue == 'true');
     } else {
         $localization->setDefault(false);
     }
     $xDefaultNode = $localizationNode->attributes->getNamedItem('x-default');
     if ($xDefaultNode) {
         $localization->setXDefault($xDefaultNode->nodeValue == 'true');
     } else {
         $localization->setXDefault(false);
     }
     // set child nodes
     if (!$flat) {
         foreach ($this->xpath->query('x:localization', $localizationNode) as $childNode) {
             $localization->addChild($this->generateLocalizationFromNode($childNode, $flat, $localization));
         }
     }
     return $localization;
 }