Skip to content

Commit b7c5314

Browse files
committed
Add support for | in _img type
* Use a | for defining your own title. Can be set via postfix of typealias as well. * Only | without a title will automatically use the full mediaid without prefixing with column key. For more see https://forum.dokuwiki.org/post/46608 Possible regression: external url which already contain a | char.
1 parent e618631 commit b7c5314

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

helper.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,17 @@ function _formatData($column, $value, Doku_Renderer_xhtml $R) {
322322
$width = 40;
323323
}
324324

325-
$title = $column['key'] . ': ' . basename(str_replace(':', '/', $val));
325+
list($mediaid, $title) = explode('|', $val, 2);
326+
if($title === null) {
327+
$title = $column['key'] . ': ' . basename(str_replace(':', '/', $mediaid));
328+
} else {
329+
$title = trim($title);
330+
}
326331

327332
if(media_isexternal($val)) {
328-
$html = $R->externalmedia($val, $title, $align = null, $width, $height = null, $cache = null, $linking = 'direct', true);
333+
$html = $R->externalmedia($mediaid, $title, $align = null, $width, $height = null, $cache = null, $linking = 'direct', true);
329334
} else {
330-
$html = $R->internalmedia($val, $title, $align = null, $width, $height = null, $cache = null, $linking = 'direct', true);
335+
$html = $R->internalmedia($mediaid, $title, $align = null, $width, $height = null, $cache = null, $linking = 'direct', true);
331336
}
332337
if(strpos($html, 'mediafile') === false) {
333338
$html = str_replace('href', 'rel="lightbox" href', $html);

0 commit comments

Comments
 (0)