diff options
31 files changed, 80 insertions, 93 deletions
diff --git a/app/Fact.php b/app/Fact.php index 866cdc5400..d9683f7bde 100644 --- a/app/Fact.php +++ b/app/Fact.php @@ -415,7 +415,7 @@ class Fact */ public function tag(): string { - return $this->record::RECORD_TYPE . ':' . $this->tag; + return $this->record->tag() . ':' . $this->tag; } /** @@ -477,7 +477,7 @@ class Fact } } - return GedcomTag::getLabel($this->record::RECORD_TYPE . ':' . $this->tag); + return GedcomTag::getLabel($this->record->tag() . ':' . $this->tag); } /** diff --git a/app/Functions/FunctionsEdit.php b/app/Functions/FunctionsEdit.php index dec082d232..19750280ad 100644 --- a/app/Functions/FunctionsEdit.php +++ b/app/Functions/FunctionsEdit.php @@ -717,7 +717,7 @@ class FunctionsEdit self::$tags = []; - $level0type = $record::RECORD_TYPE; + $level0type = $record->tag(); $level1type = $fact->getTag(); // List of tags we would expect at the next level @@ -736,12 +736,12 @@ class FunctionsEdit ], ]; - if ($record::RECORD_TYPE !== 'SOUR') { + if ($record->tag() !== 'SOUR') { //source citations within other records, i.e. n SOUR / +1 DATA / +2 TEXT $expected_subtags['DATA'][] = 'TEXT'; } //else: source records themselves, i.e. 0 SOUR / 1 DATA don't get a 2 TEXT! - if ($record::RECORD_TYPE === 'SOUR') { + if ($record->tag() === 'SOUR') { //source records themselves, i.e. 0 SOUR / 1 DATA / 2 EVEN get a 3 DATE and a 3 PLAC $expected_subtags['EVEN'][] = 'DATE'; $expected_subtags['EVEN'][] = 'PLAC'; @@ -750,7 +750,7 @@ class FunctionsEdit if ($record->tree()->getPreference('FULL_SOURCES')) { $expected_subtags['SOUR'][] = 'QUAY'; - if ($record::RECORD_TYPE !== 'SOUR') { + if ($record->tag() !== 'SOUR') { //source citations within other records, i.e. n SOUR / +1 DATA / +2 DATE $expected_subtags['DATA'][] = 'DATE'; } //else: source records themselves, i.e. 0 SOUR / 1 DATA don't get a 2 DATE! @@ -844,7 +844,7 @@ class FunctionsEdit if ($level1type !== '_PRIM') { //0 SOUR / 1 DATA doesn't get a 2 DATE! //0 SOUR / 1 DATA doesn't get a 2 EVEN here either, we rather handle this via cards/add-sour-data-even - if ($record::RECORD_TYPE !== 'SOUR') { + if ($record->tag() !== 'SOUR') { self::insertMissingSubtags($tree, $level1type, $add_date); } } diff --git a/app/Functions/FunctionsPrint.php b/app/Functions/FunctionsPrint.php index c3dae1429a..2fdeb42adf 100644 --- a/app/Functions/FunctionsPrint.php +++ b/app/Functions/FunctionsPrint.php @@ -558,7 +558,7 @@ class FunctionsPrint $quickfacts = array_intersect($quickfacts, $addfacts); $translated_addfacts = []; foreach ($addfacts as $addfact) { - $translated_addfacts[$addfact] = GedcomTag::getLabel($record::RECORD_TYPE . ':' . $addfact); + $translated_addfacts[$addfact] = GedcomTag::getLabel($record->tag() . ':' . $addfact); } uasort($translated_addfacts, static function (string $x, string $y): int { return I18N::strcasecmp(I18N::translate($x), I18N::translate($y)); diff --git a/app/Functions/FunctionsPrintFacts.php b/app/Functions/FunctionsPrintFacts.php index 8e9296996e..654ad67e9b 100644 --- a/app/Functions/FunctionsPrintFacts.php +++ b/app/Functions/FunctionsPrintFacts.php @@ -340,7 +340,7 @@ class FunctionsPrintFacts $addr = $fact->attribute('ADDR'); if ($addr !== '') { - echo GedcomTag::getLabelValue($record::RECORD_TYPE . ':' . $fact->getTag() . ':ADDR', $addr); + echo GedcomTag::getLabelValue($record->tag() . ':' . $fact->getTag() . ':ADDR', $addr); } // Print the associates of this fact/event diff --git a/app/GedcomRecord.php b/app/GedcomRecord.php index b94d30163f..4b6075cdc2 100644 --- a/app/GedcomRecord.php +++ b/app/GedcomRecord.php @@ -191,6 +191,18 @@ class GedcomRecord } /** + * Get the GEDCOM tag for this record. + * + * @return string + */ + public function tag(): string + { + preg_match('/^0 @[^@]*@ (\w+)/', $this->gedcom(), $match); + + return $match[1] ?? static::RECORD_TYPE; + } + + /** * Get the XREF for this record * * @return string diff --git a/app/Header.php b/app/Header.php index 7018acf8a3..0794689801 100644 --- a/app/Header.php +++ b/app/Header.php @@ -85,7 +85,7 @@ class Header extends GedcomRecord public function extractNames(): void { $this->getAllNames[] = [ - 'type' => self::RECORD_TYPE, + 'type' => static::RECORD_TYPE, 'sort' => I18N::translate('Header'), 'full' => I18N::translate('Header'), 'fullNN' => I18N::translate('Header'), diff --git a/app/Http/RequestHandlers/AddNewFact.php b/app/Http/RequestHandlers/AddNewFact.php index 1ed20d031a..9a89c5ffa3 100644 --- a/app/Http/RequestHandlers/AddNewFact.php +++ b/app/Http/RequestHandlers/AddNewFact.php @@ -56,7 +56,7 @@ class AddNewFact implements RequestHandlerInterface $record = Factory::gedcomRecord()->make($xref, $tree); $record = Auth::checkRecordAccess($record, true); - $title = $record->fullName() . ' - ' . GedcomTag::getLabel($record::RECORD_TYPE . ':' . $fact); + $title = $record->fullName() . ' - ' . GedcomTag::getLabel($record->tag() . ':' . $fact); return $this->viewResponse('edit/add-fact', [ 'fact' => $fact, diff --git a/app/Http/RequestHandlers/EditRawRecordAction.php b/app/Http/RequestHandlers/EditRawRecordAction.php index 75b5124e0c..ef23180a5e 100644 --- a/app/Http/RequestHandlers/EditRawRecordAction.php +++ b/app/Http/RequestHandlers/EditRawRecordAction.php @@ -59,7 +59,7 @@ class EditRawRecordAction implements RequestHandlerInterface $fact_ids = $params['fact_id'] ?? []; // Generate the level-0 line for the record. - switch ($record::RECORD_TYPE) { + switch ($record->tag()) { case GedcomRecord::RECORD_TYPE: // Unknown type? - copy the existing data. $gedcom = explode("\n", $record->gedcom(), 2)[0]; @@ -68,7 +68,7 @@ class EditRawRecordAction implements RequestHandlerInterface $gedcom = '0 HEAD'; break; default: - $gedcom = '0 @' . $xref . '@ ' . $record::RECORD_TYPE; + $gedcom = '0 @' . $xref . '@ ' . $record->tag(); } // Retain any private facts diff --git a/app/Http/RequestHandlers/GedcomRecordPage.php b/app/Http/RequestHandlers/GedcomRecordPage.php index 787a1aa815..73b587b399 100644 --- a/app/Http/RequestHandlers/GedcomRecordPage.php +++ b/app/Http/RequestHandlers/GedcomRecordPage.php @@ -84,13 +84,7 @@ class GedcomRecordPage implements RequestHandlerInterface return redirect($record->url()); } - if (preg_match('/^0 @' . Gedcom::REGEX_XREF . '@ ([_A-Z0-9]+)/', $record->gedcom(), $match)) { - $record_type = $match[1]; - } elseif (preg_match('/^0 ([_A-Z0-9]+)/', $record->gedcom(), $match)) { - $record_type = $match[1]; - } else { - $record_type = $record::RECORD_TYPE; - } + $record_type = $record->tag(); return $this->viewResponse('gedcom-record-page', [ 'facts' => $record->facts(), diff --git a/app/Http/RequestHandlers/MergeFactsAction.php b/app/Http/RequestHandlers/MergeFactsAction.php index 220268610d..0e74610a04 100644 --- a/app/Http/RequestHandlers/MergeFactsAction.php +++ b/app/Http/RequestHandlers/MergeFactsAction.php @@ -70,7 +70,7 @@ class MergeFactsAction implements RequestHandlerInterface $record1 === null || $record2 === null || $record1 === $record2 || - $record1::RECORD_TYPE !== $record2::RECORD_TYPE || + $record1->tag() !== $record2->tag() || $record1->isPendingDeletion() || $record2->isPendingDeletion() ) { @@ -136,7 +136,7 @@ class MergeFactsAction implements RequestHandlerInterface ->where('page_parameter', '=', $xref2) ->delete(); - $gedcom = '0 @' . $record1->xref() . '@ ' . $record1::RECORD_TYPE; + $gedcom = '0 @' . $record1->xref() . '@ ' . $record1->tag(); foreach ($record1->facts() as $fact) { if (in_array($fact->id(), $keep1, true)) { diff --git a/app/Http/RequestHandlers/MergeFactsPage.php b/app/Http/RequestHandlers/MergeFactsPage.php index a37981d8f9..edcc28ff46 100644 --- a/app/Http/RequestHandlers/MergeFactsPage.php +++ b/app/Http/RequestHandlers/MergeFactsPage.php @@ -63,7 +63,7 @@ class MergeFactsPage implements RequestHandlerInterface $record1 === null || $record2 === null || $record1 === $record2 || - $record1::RECORD_TYPE !== $record2::RECORD_TYPE || + $record1->tag() !== $record2->tag() || $record1->isPendingDeletion() || $record2->isPendingDeletion() ) { diff --git a/app/Http/RequestHandlers/MergeRecordsAction.php b/app/Http/RequestHandlers/MergeRecordsAction.php index 10ac6283fd..c6d796d59d 100644 --- a/app/Http/RequestHandlers/MergeRecordsAction.php +++ b/app/Http/RequestHandlers/MergeRecordsAction.php @@ -57,7 +57,7 @@ class MergeRecordsAction implements RequestHandlerInterface $record1 === null || $record2 === null || $record1 === $record2 || - $record1::RECORD_TYPE !== $record2::RECORD_TYPE || + $record1->tag() !== $record2->tag() || $record1->isPendingDeletion() || $record2->isPendingDeletion() ) { diff --git a/app/Module/ClippingsCartModule.php b/app/Module/ClippingsCartModule.php index e58155f652..330bb4c159 100644 --- a/app/Module/ClippingsCartModule.php +++ b/app/Module/ClippingsCartModule.php @@ -1039,7 +1039,7 @@ class ClippingsCartModule extends AbstractModule implements ModuleMenuInterface // Group and sort. uasort($records, static function (GedcomRecord $x, GedcomRecord $y): int { - return $x::RECORD_TYPE <=> $y::RECORD_TYPE ?: GedcomRecord::nameComparator()($x, $y); + return $x->tag() <=> $y->tag() ?: GedcomRecord::nameComparator()($x, $y); }); return $records; diff --git a/app/Module/FamilyTreeFavoritesModule.php b/app/Module/FamilyTreeFavoritesModule.php index 2e25229778..8e617f3bb0 100644 --- a/app/Module/FamilyTreeFavoritesModule.php +++ b/app/Module/FamilyTreeFavoritesModule.php @@ -247,7 +247,7 @@ class FamilyTreeFavoritesModule extends AbstractModule implements ModuleBlockInt 'user_id' => null, 'xref' => $record->xref(), ], [ - 'favorite_type' => $record::RECORD_TYPE, + 'favorite_type' => $record->tag(), 'note' => $note, ]); } diff --git a/app/Module/UserFavoritesModule.php b/app/Module/UserFavoritesModule.php index dd74818e3d..eee4e00682 100644 --- a/app/Module/UserFavoritesModule.php +++ b/app/Module/UserFavoritesModule.php @@ -251,7 +251,7 @@ class UserFavoritesModule extends AbstractModule implements ModuleBlockInterface 'user_id' => $user->id(), 'xref' => $record->xref(), ], [ - 'favorite_type' => $record::RECORD_TYPE, + 'favorite_type' => $record->tag(), 'note' => $note, ]); } diff --git a/app/Services/ClipboardService.php b/app/Services/ClipboardService.php index d9e0652959..a391187128 100644 --- a/app/Services/ClipboardService.php +++ b/app/Services/ClipboardService.php @@ -40,7 +40,7 @@ class ClipboardService public function copyFact(Fact $fact): void { $clipboard = Session::get('clipboard', []); - $record_type = $fact->record()::RECORD_TYPE; + $record_type = $fact->record()->tag(); $fact_id = $fact->id(); // If we are copying the same fact twice, make sure the new one is at the end. @@ -69,7 +69,7 @@ class ClipboardService { $clipboard = Session::get('clipboard'); - $record_type = $record::RECORD_TYPE; + $record_type = $record->tag(); if (isset($clipboard[$record_type][$fact_id])) { $record->createFact($clipboard[$record_type][$fact_id]['factrec'], true); @@ -91,7 +91,7 @@ class ClipboardService public function pastableFacts(GedcomRecord $record, Collection $exclude_types): Collection { // The facts are stored in the session. - return (new Collection(Session::get('clipboard', [])[$record::RECORD_TYPE] ?? [])) + return (new Collection(Session::get('clipboard', [])[$record->tag()] ?? [])) // Put the most recently copied fact at the top of the list. ->reverse() // Create facts for the record. diff --git a/app/Submission.php b/app/Submission.php index 88475f8f49..08f8975b90 100644 --- a/app/Submission.php +++ b/app/Submission.php @@ -79,7 +79,7 @@ class Submission extends GedcomRecord return DB::table('other') ->where('o_id', '=', $xref) ->where('o_file', '=', $tree_id) - ->where('o_type', '=', self::RECORD_TYPE) + ->where('o_type', '=', static::RECORD_TYPE) ->value('o_gedcom'); } @@ -102,7 +102,7 @@ class Submission extends GedcomRecord public function extractNames(): void { $this->getAllNames[] = [ - 'type' => self::RECORD_TYPE, + 'type' => static::RECORD_TYPE, 'sort' => I18N::translate('Submission'), 'full' => I18N::translate('Submission'), 'fullNN' => I18N::translate('Submission'), diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e606224ac9..fa51a25fad 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -61,11 +61,6 @@ parameters: path: app/Functions/Functions.php - - message: "#^Strict comparison using \\=\\=\\= between 'UNKNOWN' and 'SOUR' will always evaluate to false\\.$#" - count: 1 - path: app/Functions/FunctionsEdit.php - - - message: "#^Argument of an invalid type array\\<int, string\\>\\|false supplied for foreach, only iterables are supported\\.$#" count: 1 path: app/Functions/FunctionsExport.php @@ -701,26 +696,11 @@ parameters: path: app/Http/RequestHandlers/IndividualPage.php - - message: "#^Strict comparison using \\!\\=\\= between 'UNKNOWN' and 'UNKNOWN' will always evaluate to false\\.$#" - count: 1 - path: app/Http/RequestHandlers/MergeFactsAction.php - - - message: "#^Parameter \\#1 \\$gedcom of method Fisharebest\\\\Webtrees\\\\GedcomRecord\\:\\:updateRecord\\(\\) expects string, string\\|null given\\.$#" count: 1 path: app/Http/RequestHandlers/MergeFactsAction.php - - message: "#^Strict comparison using \\!\\=\\= between 'UNKNOWN' and 'UNKNOWN' will always evaluate to false\\.$#" - count: 1 - path: app/Http/RequestHandlers/MergeFactsPage.php - - - - message: "#^Strict comparison using \\!\\=\\= between 'UNKNOWN' and 'UNKNOWN' will always evaluate to false\\.$#" - count: 1 - path: app/Http/RequestHandlers/MergeRecordsAction.php - - - message: "#^Parameter \\#1 \\$function of function call_user_func expects callable\\(\\)\\: mixed, array\\(Fisharebest\\\\Webtrees\\\\Module\\\\ModuleInterface, string\\) given\\.$#" count: 1 path: app/Http/RequestHandlers/ModuleAction.php @@ -896,11 +876,6 @@ parameters: path: app/Module/ClippingsCartModule.php - - message: "#^Ternary operator condition is always false\\.$#" - count: 1 - path: app/Module/ClippingsCartModule.php - - - message: "#^Cannot access property \\$body on object\\|null\\.$#" count: 1 path: app/Module/FamilyTreeNewsModule.php @@ -1093,27 +1068,27 @@ parameters: - message: "#^Parameter \\#1 \\$string of function strlen expects string, string\\|false given\\.$#" count: 1 - path: modules_v4/example.disable/module.php + path: modules_v4/example-report.disable/module.php - message: "#^Parameter \\#1 \\$string of function strlen expects string, string\\|false given\\.$#" count: 1 - path: modules_v4/example-theme.disable/module.php + path: modules_v4/example.disable/module.php - message: "#^Parameter \\#1 \\$string of function strlen expects string, string\\|false given\\.$#" count: 1 - path: modules_v4/example-footer.disable/module.php + path: modules_v4/example-middleware.disable/module.php - message: "#^Parameter \\#1 \\$string of function strlen expects string, string\\|false given\\.$#" count: 1 - path: modules_v4/example-report.disable/module.php + path: modules_v4/example-footer.disable/module.php - message: "#^Parameter \\#1 \\$string of function strlen expects string, string\\|false given\\.$#" count: 1 - path: modules_v4/example-middleware.disable/module.php + path: modules_v4/example-theme.disable/module.php - message: "#^Parameter \\#1 \\$string of function strlen expects string, string\\|false given\\.$#" diff --git a/resources/views/edit/add-fact-row.phtml b/resources/views/edit/add-fact-row.phtml index cec1c029d9..e2b2533644 100644 --- a/resources/views/edit/add-fact-row.phtml +++ b/resources/views/edit/add-fact-row.phtml @@ -34,7 +34,7 @@ use Fisharebest\Webtrees\Individual; <?php foreach ($add_facts as $fact => $fact_name) : ?> <option value="<?= $fact ?>"><?= $fact_name ?></option> <?php endforeach ?> - <?php if ($record::RECORD_TYPE === Individual::RECORD_TYPE || $record::RECORD_TYPE === Family::RECORD_TYPE) : ?> + <?php if ($record->tag() === Individual::RECORD_TYPE || $record->tag() === Family::RECORD_TYPE) : ?> <option value="FACT"> <?= I18N::translate('Custom fact') ?> </option> @@ -58,7 +58,7 @@ use Fisharebest\Webtrees\Individual; 'xref' => $record->xref(), 'tree' => $tree->name(), ])) ?>"> - <?= GedcomTag::getLabel($record::RECORD_TYPE . ':' . $fact) ?> + <?= GedcomTag::getLabel($record->tag() . ':' . $fact) ?> </a> <?php endforeach ?> </div> diff --git a/resources/views/edit/add-fact.phtml b/resources/views/edit/add-fact.phtml index e4ff68b890..d509d560f0 100644 --- a/resources/views/edit/add-fact.phtml +++ b/resources/views/edit/add-fact.phtml @@ -17,12 +17,12 @@ use Ramsey\Uuid\Uuid; <?php FunctionsEdit::createAddForm($tree, $fact) ?> - <?php if ($record::RECORD_TYPE === 'SOUR' && $fact === 'DATA') : ?> + <?php if ($record->tag() === 'SOUR' && $fact === 'DATA') : ?> <?= view('cards/add-note', ['level' => 2, 'tree' => $tree]) ?> <?= view('cards/add-shared-note', ['level' => 2, 'tree' => $tree]) ?> <?php endif ?> - <?php if (($record::RECORD_TYPE === 'INDI' || $record::RECORD_TYPE === 'FAM') && $fact !== 'OBJE' && $fact !== 'NOTE' && $fact !== 'SHARED_NOTE' && $fact !== 'REPO' && $fact !== 'SOUR' && $fact !== 'SUBM' && $fact !== 'ASSO' && $fact !== 'ALIA' && $fact !== 'SEX') : ?> + <?php if (($record->tag() === 'INDI' || $record->tag() === 'FAM') && $fact !== 'OBJE' && $fact !== 'NOTE' && $fact !== 'SHARED_NOTE' && $fact !== 'REPO' && $fact !== 'SOUR' && $fact !== 'SUBM' && $fact !== 'ASSO' && $fact !== 'ALIA' && $fact !== 'SEX') : ?> <?= view('cards/add-source-citation', [ 'level' => 2, 'full_citations' => $tree->getPreference('FULL_SOURCES'), diff --git a/resources/views/edit/edit-fact.phtml b/resources/views/edit/edit-fact.phtml index 86e87ff323..366f8f251c 100644 --- a/resources/views/edit/edit-fact.phtml +++ b/resources/views/edit/edit-fact.phtml @@ -21,7 +21,7 @@ use Ramsey\Uuid\Uuid; <?php $level1type = $edit_fact->getTag(); - switch ($record::RECORD_TYPE) { + switch ($record->tag()) { case 'SOUR': if ($level1type === 'DATA') { // SOUR:DATA facts may take a NOTE (but the SOUR record may not). diff --git a/resources/views/family-page.phtml b/resources/views/family-page.phtml index 79b31d5dfd..37566991c1 100644 --- a/resources/views/family-page.phtml +++ b/resources/views/family-page.phtml @@ -1,6 +1,7 @@ <?php use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\Family; use Fisharebest\Webtrees\Functions\FunctionsPrint; use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact; @@ -65,7 +66,7 @@ use Fisharebest\Webtrees\View; <?php if (Auth::isEditor($record->tree())) : ?> <?= view('edit/paste-fact-row', ['record' => $record, 'facts' => $clipboard_facts]) ?> - <?php FunctionsPrint::printAddNewFact($record, $facts, 'FAM') ?> + <?php FunctionsPrint::printAddNewFact($record, $facts, Family::RECORD_TYPE) ?> <tr> <th scope="row"> <?= I18N::translate('Note') ?> diff --git a/resources/views/gedcom-record-page.phtml b/resources/views/gedcom-record-page.phtml index b9e3e87ed2..516d28d507 100644 --- a/resources/views/gedcom-record-page.phtml +++ b/resources/views/gedcom-record-page.phtml @@ -114,7 +114,7 @@ use Illuminate\Support\Collection; <?php endforeach ?> <?php if ($record->canEdit()) : ?> - <?php FunctionsPrint::printAddNewFact($record, $facts, $record::RECORD_TYPE) ?> + <?php FunctionsPrint::printAddNewFact($record, $facts, $record->tag()) ?> <?php endif ?> </table> </div> diff --git a/resources/views/icons/record.phtml b/resources/views/icons/record.phtml index dac68cf43b..f16efa80e5 100644 --- a/resources/views/icons/record.phtml +++ b/resources/views/icons/record.phtml @@ -13,18 +13,18 @@ use Fisharebest\Webtrees\Submitter; * @var GedcomRecord $record */ ?> -<?php if ($record::RECORD_TYPE === Individual::RECORD_TYPE) : ?> +<?php if ($record->tag() === Individual::RECORD_TYPE) : ?> <?= view('icons/individual') ?> -<?php elseif ($record::RECORD_TYPE === Family::RECORD_TYPE) : ?> +<?php elseif ($record->tag() === Family::RECORD_TYPE) : ?> <?= view('icons/family') ?> -<?php elseif ($record::RECORD_TYPE === Source::RECORD_TYPE) : ?> +<?php elseif ($record->tag() === Source::RECORD_TYPE) : ?> <?= view('icons/source') ?> -<?php elseif ($record::RECORD_TYPE === Repository::RECORD_TYPE) : ?> +<?php elseif ($record->tag() === Repository::RECORD_TYPE) : ?> <?= view('icons/repository') ?> -<?php elseif ($record::RECORD_TYPE === Note::RECORD_TYPE) : ?> +<?php elseif ($record->tag() === Note::RECORD_TYPE) : ?> <?= view('icons/note') ?> -<?php elseif ($record::RECORD_TYPE === Media::RECORD_TYPE) : ?> +<?php elseif ($record->tag() === Media::RECORD_TYPE) : ?> <?= view('icons/media') ?> -<?php elseif ($record::RECORD_TYPE === Submitter::RECORD_TYPE) : ?> +<?php elseif ($record->tag() === Submitter::RECORD_TYPE) : ?> <?= view('icons/submitter') ?> <?php endif; diff --git a/resources/views/media-page.phtml b/resources/views/media-page.phtml index c619454c02..24e9b2a6c8 100644 --- a/resources/views/media-page.phtml +++ b/resources/views/media-page.phtml @@ -159,7 +159,7 @@ use Illuminate\Support\Collection; <?php if ($media->canEdit()) : ?> <?= view('edit/paste-fact-row', ['record' => $media, 'facts' => $clipboard_facts]) ?> - <?php FunctionsPrint::printAddNewFact($media, $facts, 'OBJE') ?> + <?php FunctionsPrint::printAddNewFact($media, $facts, Media::RECORD_TYPE) ?> <tr> <th> <?= I18N::translate('Source') ?> diff --git a/resources/views/modules/personal_facts/tab.phtml b/resources/views/modules/personal_facts/tab.phtml index f2f055c748..e78dae4bd7 100644 --- a/resources/views/modules/personal_facts/tab.phtml +++ b/resources/views/modules/personal_facts/tab.phtml @@ -1,11 +1,12 @@ <?php use Fisharebest\Webtrees\Functions\FunctionsPrint; +use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Individual; +use Fisharebest\Webtrees\View; ?> -<?php use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; ?> -<?php use Fisharebest\Webtrees\I18N; ?> -<?php use Fisharebest\Webtrees\View; ?> <div class="wt-tab-facts py-4"> <table class="table wt-facts-table"> @@ -40,7 +41,7 @@ use Fisharebest\Webtrees\Functions\FunctionsPrint; <?php if ($individual->canEdit()) : ?> <?= view('edit/paste-fact-row', ['record' => $individual, 'facts' => $clipboard_facts]) ?> - <?php FunctionsPrint::printAddNewFact($individual, $facts, 'INDI') ?> + <?php FunctionsPrint::printAddNewFact($individual, $facts, Individual::RECORD_TYPE) ?> <?php endif ?> </tbody> </table> diff --git a/resources/views/modules/recent_changes/changes-table.phtml b/resources/views/modules/recent_changes/changes-table.phtml index 1226841250..aad30bbef5 100644 --- a/resources/views/modules/recent_changes/changes-table.phtml +++ b/resources/views/modules/recent_changes/changes-table.phtml @@ -53,26 +53,26 @@ use Illuminate\Support\Collection; <tbody> <?php foreach ($rows as $row) : ?> <tr> - <td data-sort="<?= $row->record::RECORD_TYPE ?>" class="text-centre wt-side-block-optional"> - <?php if ($row->record::RECORD_TYPE === Individual::RECORD_TYPE) : ?> + <td data-sort="<?= $row->record->tag() ?>" class="text-centre wt-side-block-optional"> + <?php if ($row->record->tag() === Individual::RECORD_TYPE) : ?> <?= view('icons/individual') ?> <span class="sr-only"><?= I18N::translate('Individual') ?></span> - <?php elseif ($row->record::RECORD_TYPE === Family::RECORD_TYPE) : ?> + <?php elseif ($row->record->tag() === Family::RECORD_TYPE) : ?> <?= view('icons/family') ?> <span class="sr-only"><?= I18N::translate('Family') ?></span> - <?php elseif ($row->record::RECORD_TYPE === Media::RECORD_TYPE) : ?> + <?php elseif ($row->record->tag() === Media::RECORD_TYPE) : ?> <?= view('icons/media') ?> <span class="sr-only"><?= I18N::translate('Media') ?></span> - <?php elseif ($row->record::RECORD_TYPE === Note::RECORD_TYPE) : ?> + <?php elseif ($row->record->tag() === Note::RECORD_TYPE) : ?> <?= view('icons/note') ?> <span class="sr-only"><?= I18N::translate('Note') ?></span> - <?php elseif ($row->record::RECORD_TYPE === Source::RECORD_TYPE) : ?> + <?php elseif ($row->record->tag() === Source::RECORD_TYPE) : ?> <?= view('icons/source') ?> <span class="sr-only"><?= I18N::translate('Source') ?></span> - <?php elseif ($row->record::RECORD_TYPE === Submitter::RECORD_TYPE) : ?> + <?php elseif ($row->record->tag() === Submitter::RECORD_TYPE) : ?> <?= view('icons/submitter') ?> <span class="sr-only"><?= I18N::translate('Submitter') ?></span> - <?php elseif ($row->record::RECORD_TYPE === Repository::RECORD_TYPE) : ?> + <?php elseif ($row->record->tag() === Repository::RECORD_TYPE) : ?> <?= view('icons/repository') ?> <span class="sr-only"><?= I18N::translate('Repository') ?></span> <?php endif ?> diff --git a/resources/views/note-page.phtml b/resources/views/note-page.phtml index 0563481bb2..778a40cdb6 100644 --- a/resources/views/note-page.phtml +++ b/resources/views/note-page.phtml @@ -6,6 +6,7 @@ use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord; use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord; use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Note; ?> @@ -102,7 +103,7 @@ use Fisharebest\Webtrees\I18N; <?php if ($note->canEdit()) : ?> <?= view('edit/paste-fact-row', ['record' => $note, 'facts' => $clipboard_facts]) ?> - <?php FunctionsPrint::printAddNewFact($note, $facts, 'NOTE') ?> + <?php FunctionsPrint::printAddNewFact($note, $facts, Note::RECORD_TYPE) ?> <?php endif ?> </table> </div> diff --git a/resources/views/repository-page.phtml b/resources/views/repository-page.phtml index 6ffc2e78dc..b0101c9070 100644 --- a/resources/views/repository-page.phtml +++ b/resources/views/repository-page.phtml @@ -6,6 +6,7 @@ use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord; use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord; use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Repository; ?> @@ -58,7 +59,7 @@ use Fisharebest\Webtrees\I18N; <?php if ($repository->canEdit()) : ?> <?= view('edit/paste-fact-row', ['record' => $repository, 'facts' => $clipboard_facts]) ?> - <?php FunctionsPrint::printAddNewFact($repository, $facts, 'REPO') ?> + <?php FunctionsPrint::printAddNewFact($repository, $facts, Repository::RECORD_TYPE) ?> <?php endif ?> </table> </div> diff --git a/resources/views/source-page.phtml b/resources/views/source-page.phtml index c9e81d2a63..b7ee0409a5 100644 --- a/resources/views/source-page.phtml +++ b/resources/views/source-page.phtml @@ -7,6 +7,7 @@ use Fisharebest\Webtrees\Http\RequestHandlers\AddNewFact; use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord; use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord; use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Source; ?> @@ -80,7 +81,7 @@ use Fisharebest\Webtrees\I18N; <?php if ($source->canEdit()) : ?> <?= view('edit/paste-fact-row', ['record' => $source, 'facts' => $clipboard_facts]) ?> - <?php FunctionsPrint::printAddNewFact($source, $facts, 'SOUR') ?> + <?php FunctionsPrint::printAddNewFact($source, $facts, Source::RECORD_TYPE) ?> <?php if ($source->tree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($source->tree())) : ?> <tr> diff --git a/resources/views/submitter-page.phtml b/resources/views/submitter-page.phtml index bde828f4cf..b1cc935fb4 100644 --- a/resources/views/submitter-page.phtml +++ b/resources/views/submitter-page.phtml @@ -6,6 +6,7 @@ use Fisharebest\Webtrees\Functions\FunctionsPrintFacts; use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesAcceptRecord; use Fisharebest\Webtrees\Http\RequestHandlers\PendingChangesRejectRecord; use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Submitter; ?> @@ -63,7 +64,7 @@ use Fisharebest\Webtrees\I18N; <?php endforeach ?> <?php if ($submitter->canEdit()) : ?> - <?php FunctionsPrint::printAddNewFact($submitter, $facts, $submitter::RECORD_TYPE) ?> + <?php FunctionsPrint::printAddNewFact($submitter, $facts, Submitter::RECORD_TYPE) ?> <?php endif ?> </table> </div> |
