. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\Fact; use Fisharebest\Webtrees\Gedcom; use Fisharebest\Webtrees\GedcomTag; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Menu; use Fisharebest\Webtrees\Services\ModuleService; use Fisharebest\Webtrees\Tree; use Symfony\Component\HttpFoundation\Request; /** * Trait ModuleThemeTrait - default implementation of ModuleThemeInterface */ trait ModuleThemeTrait { /** @var Request */ protected $request; /** @var Tree|null */ protected $tree; /** * @param Request $request * @param Tree|null $tree The current tree (if there is one). */ public function __construct(Request $request, ?Tree $tree) { $this->request = $request; $this->tree = $tree; } /** * Add markup to the secondary menu. * * @return string */ public function formatSecondaryMenu(): string { return '
'; } /** * Add markup to an item in the secondary menu. * * @param Menu $menu * * @return string */ public function formatSecondaryMenuItem(Menu $menu): string { return $menu->bootstrap4(); } /** * Display an icon for this fact. * * @TODO use CSS for this * * @param Fact $fact * * @return string */ public function icon(Fact $fact): string { $asset = 'public/css/' . $this->name() . '/images/facts/' . $fact->getTag() . '.png'; if (file_exists(WT_ROOT . 'public' . $asset)) { return ''; } // Spacer image - for alignment - until we move to a sprite. $asset = 'public/css/' . $this->name() . '/images/facts/NULL.png'; if (file_exists(WT_ROOT . 'public' . $asset)) { return ''; } return ''; } /** * Display an individual in a box - for charts, etc. * * @param Individual $individual * * @return string */ public function individualBox(Individual $individual): string { $person_box_class = self::PERSON_BOX_CLASSES[$individual->getSex()]; if ($individual->canShow() && $individual->tree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) { $thumbnail = $individual->displayImage(40, 50, 'crop', []); } else { $thumbnail = ''; } $content = '' . $individual->getFullName() . ''; $icons = ''; if ($individual->canShow()) { $content = '' . $content . '' . '