getElement() публичный Метод

Get an element with the given key/name
public getElement ( string $name ) : Tag
$name string
Результат Tag
Пример #1
0
 /**
  * @param string $name
  * @return Model\Document\Tag
  */
 public function getElement($name)
 {
     // check if a persona is requested for this page, if yes deliver a different version of the element (prefixed)
     if ($this->getUsePersona()) {
         $personaName = $this->getPersonaElementName($name);
         if ($this->hasElement($personaName)) {
             $name = $personaName;
         } else {
             // if there's no dedicated content for this persona, inherit from the "original" content (unprefixed)
             // and mark it as inherited so it is clear in the ui that the content is not specific to the selected persona
             // replace all occurrences of the persona prefix, this is needed because of block-prefixes
             $inheritedName = str_replace($this->getPersonaElementPrefix(), "", $name);
             $inheritedElement = parent::getElement($inheritedName);
             if ($inheritedElement) {
                 $inheritedElement = clone $inheritedElement;
                 $inheritedElement->setResource(null);
                 $inheritedElement->setName($personaName);
                 $inheritedElement->setInherited(true);
                 $this->setElement($personaName, $inheritedElement);
                 return $inheritedElement;
             }
         }
     }
     // delegate to default
     return parent::getElement($name);
 }