Skip to content

Commit

Permalink
Minor adjustments to config panel
Browse files Browse the repository at this point in the history
  • Loading branch information
magicsunday committed Dec 27, 2023
1 parent a6f0a9b commit afb7a71
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ use MagicSunday\Webtrees\PedigreeChart\Configuration;
])
?>
</div>
</div>
</div>
11 changes: 3 additions & 8 deletions resources/views/modules/pedigree-chart/form/orientation.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,10 @@ use MagicSunday\Webtrees\PedigreeChart\Configuration;
<div class="col-sm-9 wt-page-options-value" id="layout">
<?=
view('components/radios-inline', [
'name' => 'layout',
'options' => [
Configuration::LAYOUT_RIGHTLEFT => view('icons/pedigree-left') . I18N::translate('left'),
Configuration::LAYOUT_LEFTRIGHT => view('icons/pedigree-right') . I18N::translate('right'),
Configuration::LAYOUT_BOTTOMTOP => view('icons/pedigree-up') . I18N::translate('up'),
Configuration::LAYOUT_TOPBOTTOM => view('icons/pedigree-down') . I18N::translate('down'),
],
'name' => 'layout',
'options' => $configuration->getLayouts(),
'selected' => $configuration->getLayout(),
])
?>
</div>
</div>
</div>
25 changes: 25 additions & 0 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class Configuration
* Configuration constructor.
*
* @param ServerRequestInterface $request
* @param AbstractModule $module
*/
public function __construct(ServerRequestInterface $request, AbstractModule $module)
{
Expand Down Expand Up @@ -167,4 +168,28 @@ public function getLayout(): string
)
);
}

/**
* Returns the available tree layouts.
*
* @return string[]
*/
public function getLayouts(): array
{
if (I18N::direction() === 'rtl') {
return [
self::LAYOUT_LEFTRIGHT => view('icons/pedigree-left') . I18N::translate('left'),
self::LAYOUT_RIGHTLEFT => view('icons/pedigree-right') . I18N::translate('right'),
self::LAYOUT_BOTTOMTOP => view('icons/pedigree-up') . I18N::translate('up'),
self::LAYOUT_TOPBOTTOM => view('icons/pedigree-down') . I18N::translate('down'),
];
}

return [
self::LAYOUT_RIGHTLEFT => view('icons/pedigree-left') . I18N::translate('left'),
self::LAYOUT_LEFTRIGHT => view('icons/pedigree-right') . I18N::translate('right'),
self::LAYOUT_BOTTOMTOP => view('icons/pedigree-up') . I18N::translate('up'),
self::LAYOUT_TOPBOTTOM => view('icons/pedigree-down') . I18N::translate('down'),
];
}
}
4 changes: 3 additions & 1 deletion src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,9 @@ private function getStylesheets(): array
*/
private function getExportStylesheets(): array
{
$stylesheets = app(ModuleThemeInterface::class)->stylesheets();
/** @var ModuleThemeInterface $moduleTheme */
$moduleTheme = app(ModuleThemeInterface::class);
$stylesheets = $moduleTheme->stylesheets();
$stylesheets[] = $this->assetUrl('css/svg.css');

return $stylesheets;
Expand Down

0 comments on commit afb7a71

Please sign in to comment.