/** * getNodeRelativePath * * @param array $node Node array * @return string relative node path */ protected function _getNodeRelativePath($node) { return Croogo::getRelativePath(array('plugin' => 'nodes', 'admin' => false, 'controller' => 'nodes', 'action' => 'view', 'type' => $this->_getType($node), 'slug' => $node[$this->alias]['slug'])); }
/** * Admin update paths * * @return void * @access public */ public function admin_update_paths() { $types = $this->Node->Taxonomy->Vocabulary->Type->find('list', array('fields' => array('Type.id', 'Type.alias'))); $typesAlias = array_values($types); $nodes = $this->Node->find('all', array('conditions' => array('Node.type' => $typesAlias), 'fields' => array('Node.id', 'Node.slug', 'Node.type', 'Node.path'), 'recursive' => '-1')); foreach ($nodes as $node) { $node['Node']['path'] = Croogo::getRelativePath(array('admin' => false, 'controller' => 'nodes', 'action' => 'view', 'type' => $node['Node']['type'], 'slug' => $node['Node']['slug'])); $this->Node->id = false; $this->Node->save($node); } $this->Session->setFlash(__('Paths updated.'), 'default', array('class' => 'success')); $this->redirect(array('action' => 'index')); }
/** * Get URL relative to the app * * @param array $url * @return array * @deprecated Use Croogo::getRelativePath */ public function getRelativePath($url = '/') { return Croogo::getRelativePath($url); }