You are here

public function QueryPath::prepend in QueryPath 7.3

Same name and namespace in other branches
  1. 6 QueryPath/QueryPath.php \QueryPath::prepend()
  2. 7.2 QueryPath/QueryPath.php \QueryPath::prepend()

File

QueryPath/QueryPath.php, line 670

Class

QueryPath

Code

public function prepend($data) {
  $data = $this
    ->prepareInsert($data);
  if (isset($data)) {
    foreach ($this->matches as $m) {
      $ins = $data
        ->cloneNode(TRUE);
      if ($m
        ->hasChildNodes()) {
        $m
          ->insertBefore($ins, $m->childNodes
          ->item(0));
      }
      else {
        $m
          ->appendChild($ins);
      }
    }
  }
  return $this;
}