webtrees icon indicating copy to clipboard operation
webtrees copied to clipboard

GedcomRecord format: Replace HTML in class by view

Open jon48 opened this issue 2 years ago • 3 comments

This is a proposal to replace the HTML hardcoded in the GedcomRecord class for the formatList by a view. I think this is going in the global direction of managing HTML output by views (and overwriting in subclasses is still possible), and more selfishly, that would allow modules to overwrite the display of this element.

As usual, this is only a proposal, feel free to close it or amend it.

jon48 avatar Dec 13 '22 20:12 jon48

Codecov Report

Merging #4660 (fef9c8e) into main (a046a25) will increase coverage by 0.00%. The diff coverage is 0.00%.

@@            Coverage Diff            @@
##               main    #4660   +/-   ##
=========================================
  Coverage     31.65%   31.65%           
  Complexity    11365    11365           
=========================================
  Files          1163     1163           
  Lines         39520    39516    -4     
=========================================
  Hits          12509    12509           
+ Misses        27011    27007    -4     
Impacted Files Coverage Δ
app/GedcomRecord.php 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Dec 13 '22 20:12 codecov[bot]

As far as I can tell, this function is only used by the statistics.

Since it doesn't use any private functions/data of the GedcomRecord object, I don't think it belongs here.

Are you using it in your own code/modules?

fisharebest avatar Dec 22 '22 12:12 fisharebest

I am not calling the method itself in my modules. The only interaction I have with it in in my fork, where I am modifying its body to inject some icons. To improve the compabitility of my modules with the mainstream webtrees, I am looking to move away from those core code modifications, and replace it with the native views overwrite mechanism, and this piece of code is the only one I cannot overwrite (that is why this PR is quite selfish…).

But I agree with you, the method probably does not belong to that class (likely a legacy to old times when a lot of formatting was done in those model classes), and feel free to refactor as you wish, I will adapt to the outcome.

jon48 avatar Dec 23 '22 13:12 jon48