1<?php 2/** 3 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 4 * @author Brend Wanders <b.wanders@utwente.nl> 5 */ 6// must be run within Dokuwiki 7if(!defined('DOKU_INC')) die('Meh.'); 8 9/** 10 * The reference link type. 11 */ 12class plugin_strata_type_title extends plugin_strata_type_page { 13 function __construct() { 14 $this->util =& plugin_load('helper', 'strata_util'); 15 parent::__construct(); 16 } 17 18 function render($mode, &$R, &$T, $value, $hint='') { 19 $heading = "missing"; 20 21 $titles = $T->fetchTriples($value, $this->util->getTitleKey()); 22 if($titles) { 23 $heading = $titles[0]['object']; 24 } 25 26 // render internal link 27 // (':' is prepended to make sure we use an absolute pagename, 28 // internallink resolves page names, but the name is already resolved.) 29 $R->internallink($hint.':'.$value, $heading); 30 } 31 32 function getInfo() { 33 return array( 34 'desc'=>'References another piece of data or wiki page, and creates a link named after the title of the page. The optional hint is used as namespace for the link. If the hint ends with a #, all values will be treated as fragments.', 35 'hint'=>'namespace' 36 ); 37 } 38} 39