getElement() public method

public getElement ( string $name ) : Tag
$name string
return Tag
Example #1
0
 /**
  * @param $name
  *
  * @return Model\Document\Page
  */
 public function getElement($name)
 {
     $id = sprintf('%s%s%d', $name, $this->name, $this->index);
     $element = $this->doc->getElement($id);
     $element->suffixes = array($this->name);
     return $element;
 }
Example #2
0
 /**
  * @param $name
  *
  * @return Model\Document\Tag
  */
 public function getElement($name)
 {
     $root = $name . implode('_', $this->suffixes);
     foreach ($this->suffixes as $item) {
         if (preg_match('#[^\\d]{1}(?<index>[\\d]+)$#i', $item, $match)) {
             $root .= $match['index'] . '_';
         }
     }
     $root .= $this->index;
     $id = $root;
     $element = $this->doc->getElement($id);
     if ($element) {
         $element->suffixes = $this->suffixes;
     }
     return $element;
 }