diff --git a/wire/core/MarkupFieldtype.php b/wire/core/MarkupFieldtype.php index f8e7d47c..1c294bf5 100644 --- a/wire/core/MarkupFieldtype.php +++ b/wire/core/MarkupFieldtype.php @@ -56,7 +56,17 @@ class MarkupFieldtype extends WireData implements Module { * @var bool * */ - protected $renderIsUseless = false; + protected $renderIsUseless = false; + + /** + * Properties that are potentially linkable to source page in markup + * + * @var array + * + */ + protected $linkableProperties = array( + 'name', 'url', 'httpUrl', 'path', 'title', + ); /** * Construct the MarkupFieldtype @@ -108,8 +118,8 @@ class MarkupFieldtype extends WireData implements Module { foreach($value as $page) { $v = $page->getFormatted($property); $v = $field->type->markupValue($page, $field, $v); - if($page->viewable()) { - $a[] = "$v"; + if($this->isLinkablePageProperty($page, $property)) { + $a[] = "$property: $v"; } else { $a[] = $v; } @@ -356,6 +366,20 @@ class MarkupFieldtype extends WireData implements Module { return $out; } + /** + * Is the given page property/field name one that should be linked to the source page in output? + * + * @param Page $page + * @param $property + * @return bool + * + */ + protected function isLinkablePageProperty(Page $page, $property) { + if(!in_array($property, $this->linkableProperties)) return false; + if(!$page->viewable($property)) return false; + return true; + } + /** * The string value of a MarkupFieldtype is always the fully rendered field *