. */ 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; } /** * Where are our CSS, JS and other assets? * * @deprecated - use the constant directly * @return string A relative path, such as "themes/foo/" */ public function assetUrl(): string { return self::ASSET_DIR; } /** * 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. * * @param Fact $fact * * @return string */ public function icon(Fact $fact): string { $icon = 'images/facts/' . $fact->getTag() . '.png'; if (file_exists(self::ASSET_DIR . $icon)) { return ''; } if (file_exists(self::ASSET_DIR . 'images/facts/NULL.png')) { // Spacer image - for alignment - until we move to a sprite. 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 . '' . '