Esempio n. 1
0
 /**
  * Add additional options to the core formatFirstMajorFact function.
  * If no option is suitable, it will try returning the core function.
  *
  * Option 10 : display <i>factLabel shortFactDate shortFactPlace</i>
  *
  * @uses \MyArtJaub\Webtrees\Functions\FunctionsPrint
  * @param string $facts List of facts to find information from
  * @param int $style Style to apply to the information. Number >= 10 should be used in this function, lower number will return the core function.
  * @return string Formatted fact description
  */
 public function formatFirstMajorFact($facts, $style)
 {
     foreach ($this->gedcomrecord->getFacts($facts) as $fact) {
         // Only display if it has a date or place (or both)
         if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) {
             switch ($style) {
                 case 10:
                     return '<i>' . $fact->getLabel() . ' ' . mw\Functions\FunctionsPrint::formatFactDateShort($fact) . '&nbsp;' . mw\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') . '</i>';
                 default:
                     return $this->gedcomrecord->formatFirstMajorFact($facts, $style);
             }
         }
     }
     return '';
 }