1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- /**
- * This file is part of the sfSearch package.
- * (c) Carl Vondrick <carl.vondrick@symfony-project.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- /**
- * A retort to generate a route.
- *
- * @package sfSearch
- * @subpackage Result
- * @author Carl Vondrick
- */
- final class xfRetortDirectRoute implements xfRetort {
- /**
- * The method bound to
- *
- * @var string
- */
- private $method = 'getRoute';
- /**
- * Constructor
- *
- * @param string $template The route template
- */
- public function __construct()
- {
- }
- /**
- * The method to accept
- *
- * @param string $method
- */
- public function setMethod($method)
- {
- $this->method = $method;
- }
- /**
- *
- * @see xfRetort
- */
- public function can(xfDocumentHit $hit, $method, array $args = array())
- {
- return $this->method == $method;
- }
- /**
- *
- * @see xfRetort
- */
- public function respond(xfDocumentHit $hit, $method, array $args = array())
- {
- $ContentTree = ContentTree::instance();
- $ContentTree->build();
- // $ContentTreeNode = $ContentTree->getContentTreeNodeById($hit->getDocument()->getField('id')->getValue());
- $ContentTreeNode = $ContentTree->getContentTreeNodeById($hit->getDocument()->getField('node_id')->getValue());
- return $ContentTreeNode->getUrl();
- }
- }
|