/** * Creates a sorting page element * * @param string $sort current sort * * @return DOMDocument sort navigation */ public function sortDisplay($sort) { $sort_options = $this->config->sortOptions(); if (count($sort_options) == 0) { return null; } $xml = Parser::convertToDOMDocument("<sort_display />"); $x = 1; foreach ($sort_options as $id) { $here = $xml->createElement('option'); $here->setAttribute('id', $id); if ($id == $sort) { $here->setAttribute('active', 'true'); } else { $params = $this->sortLinkParams(); $params['sort'] = $id; $here->setAttribute('active', 'false'); $here->setAttribute('link', $this->request->url_for($params)); } $xml->documentElement->appendChild($here); $x++; } return $xml; }