app/Module/ModuleThemeTrait.php
public function individualBoxFacts(Individual $individual): string
    {
        $html = '';

        $opt_tags = preg_split('/\W/', $individual->tree()->getPreference('CHART_BOX_TAGS'), 0, PREG_SPLIT_NO_EMPTY);
        // Show BIRT or equivalent event
        foreach (Gedcom::BIRTH_EVENTS as $birttag) {
            if (!in_array($birttag, $opt_tags, true)) {
                $event = $individual->facts([$birttag])->first();
                if ($event instanceof Fact) {
                    $html .= $event->summary();
                    break;
                }
            }
        }
        // Show optional events (before death)
        foreach ($opt_tags as $key => $tag) {
            if (!in_array($tag, Gedcom::DEATH_EVENTS, true)) {
                $event = $individual->facts([$tag])->first();
                if ($event instanceof Fact) {
                    $html .= $event->summary();
                    unset($opt_tags[$key]);
                }
            }
        }
        // Show DEAT or equivalent event
        foreach (Gedcom::DEATH_EVENTS as $deattag) {
            $event = $individual->facts([$deattag])->first();
            if ($event instanceof Fact) {
                $html .= $event->summary();
                if (in_array($deattag, $opt_tags, true)) {
                    unset($opt_tags[array_search($deattag, $opt_tags, true)]);
                }
                break;
            }
        }
        // Show remaining optional events (after death)
        foreach ($opt_tags as $tag) {
            $event = $individual->facts([$tag])->first();
            if ($event instanceof Fact) {
                $html .= $event->summary();
            }
        }

        return $html;
    }
public function individualBoxFacts(Individual $individual): string
    {
        $html = '';

        $opt_tags = preg_split('/\W/', $individual->tree()->getPreference('CHART_BOX_TAGS'), 0, PREG_SPLIT_NO_EMPTY);
        // Show BIRT or equivalent event
        foreach (Gedcom::BIRTH_EVENTS as $birttag) {
            if (!in_array($birttag, $opt_tags, true)) {
                $event = $individual->facts([$birttag])->first();
                if ($event instanceof Fact) {
                    $html .= $event->summary();
                    break;
                }
            }
        }
        // Show optional events (before death)
        foreach ($opt_tags as $key => $tag) {
            if (!in_array($tag, Gedcom::DEATH_EVENTS, true)) {
                $event = $individual->facts([$tag])->first();
                if ($event instanceof Fact) {
                    $html .= $event->summary();
                    unset($opt_tags[$key]);
                }
            }
        }
        // Show DEAT or equivalent event
        foreach (Gedcom::DEATH_EVENTS as $deattag) {
            $event = $individual->facts([$deattag])->first();
            if ($event instanceof Fact) {
                $html .= $event->summary();
                if (in_array($deattag, $opt_tags, true)) {
                    unset($opt_tags[array_search($deattag, $opt_tags, true)]);
                }
                break;
            }
        }
        // Show remaining optional events (after death)
        foreach ($opt_tags as $tag) {
            $event = $individual->facts([$tag])->first();
            if ($event instanceof Fact) {
                $html .= $event->summary();
            }
        }

        return $html;
    }
public function individualBoxFacts ( Individual $ individual ) : string { $ html = '' ; $ opt_tags = preg_split ( '/\W/' , $ individual -> tree ( ) -> getPreference ( 'CHART_BOX_TAGS' ) , 0 , PREG_SPLIT_NO_EMPTY ) ; // Show BIRT or equivalent event foreach ( Gedcom :: BIRTH_EVENTS as $ birttag ) { if ( ! in_array ( $ birttag , $ opt_tags , true ) ) { $ event = $ individual -> facts ( [ $ birttag ] ) -> first ( ) ; if ( $ event instanceof Fact ) { $ html .= $ event -> summary ( ) ; break ; } } } // Show optional events (before death) foreach ( $ opt_tags as $ key => $ tag ) { if ( ! in_array ( $ tag , Gedcom :: DEATH_EVENTS , true ) ) { $ event = $ individual -> facts ( [ $ tag ] ) -> first ( ) ; if ( $ event instanceof Fact ) { $ html .= $ event -> summary ( ) ; unset ( $ opt_tags [ $ key ] ) ; } } } // Show DEAT or equivalent event foreach ( Gedcom :: DEATH_EVENTS as $ deattag ) { $ event = $ individual -> facts ( [ $ deattag ] ) -> first ( ) ; if ( $ event instanceof Fact ) { $ html .= $ event -> summary ( ) ; if ( in_array ( $ deattag , $ opt_tags , true ) ) { unset ( $ opt_tags [ array_search ( $ deattag , $ opt_tags , true ) ] ) ; } break ; } } // Show remaining optional events (after death) foreach ( $ opt_tags as $ tag ) { $ event = $ individual -> facts ( [ $ tag ] ) -> first ( ) ; if ( $ event instanceof Fact ) { $ html .= $ event -> summary ( ) ; } } return $ html ; }
Generate the facts, for display in charts.

@param Individual $individual

@return string
Generate the facts for display in charts .