Skip to content

Commit

Permalink
Fix: fisharebest#4371 - level 1 shared notes shown only as links
Browse files Browse the repository at this point in the history
  • Loading branch information
fisharebest authored and ddrury committed Jul 16, 2023
1 parent 6e87b1a commit 486d986
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/Elements/NoteStructure.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,25 @@ public function labelValue(string $value, Tree $tree): string
$html .
'</div>';
}

/**
* Display the value of this type of element.
*
* @param string $value
* @param Tree $tree
*
* @return string
*/
public function value(string $value, Tree $tree): string
{
if (preg_match('/^@(' . Gedcom::REGEX_XREF . ')@$/', $value, $match) === 1) {
$note = Registry::noteFactory()->make($match[1], $tree);

if ($note instanceof Note) {
$value = $note->getNote();
}
}

return parent::value($value, $tree);
}
}
4 changes: 4 additions & 0 deletions app/Fact.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ public function record(): GedcomRecord
*/
public function label(): string
{
if (str_ends_with($this->tag(), ':NOTE') && preg_match('/@' . Gedcom::REGEX_XREF . '@/', $this->value())) {
return I18N::translate('Shared note');
}

// Marriages
if ($this->tag() === 'FAM:MARR') {
$element = Registry::elementFactory()->make('FAM:MARR:TYPE');
Expand Down

0 comments on commit 486d986

Please sign in to comment.