diff options
author | Mario <mario@mariovavti.com> | 2024-04-30 06:59:20 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-04-30 06:59:20 +0000 |
commit | ce15852b9a57a6c77531186ed24a389ebce8524e (patch) | |
tree | ad04cef0d545c5e5e24e76060b6c32d65363d48e /Zotlabs/Widget/Helpindex.php | |
parent | 48cec945051d259a06871d937ad998a1bd3e22ec (diff) | |
parent | 7c34a3676d294c9a1acc69f71ab3061074509160 (diff) | |
download | volse-hubzilla-ce15852b9a57a6c77531186ed24a389ebce8524e.tar.gz volse-hubzilla-ce15852b9a57a6c77531186ed24a389ebce8524e.tar.bz2 volse-hubzilla-ce15852b9a57a6c77531186ed24a389ebce8524e.zip |
Merge branch 'rework-help-module' into 'dev'
Rework Help module + begin tests for Setup module
See merge request hubzilla/core!2120
Diffstat (limited to 'Zotlabs/Widget/Helpindex.php')
-rw-r--r-- | Zotlabs/Widget/Helpindex.php | 63 |
1 files changed, 20 insertions, 43 deletions
diff --git a/Zotlabs/Widget/Helpindex.php b/Zotlabs/Widget/Helpindex.php index 63e686d3a..a7120b47f 100644 --- a/Zotlabs/Widget/Helpindex.php +++ b/Zotlabs/Widget/Helpindex.php @@ -1,6 +1,9 @@ <?php - /** + * Widget to show the help index. + * + * By default used by the left sidebar by the help module. + * * * Name: Help index * * Description: Help pages index */ @@ -9,54 +12,28 @@ namespace Zotlabs\Widget; class Helpindex { - function widget($arr) { - - require_once('include/help.php'); - - $o = '<div class="widget">'; - - $level_0 = get_help_content('sitetoc'); - if(! $level_0) { - $path = 'toc'; - $x = determine_help_language(); - $lang = $x['language']; - if($lang !== 'en') { - $path = $lang . '/toc'; - } - $level_0 = get_help_content($path); - } + use \Zotlabs\Lib\Traits\HelpHelper; - $level_0 = preg_replace('/\<ul(.*?)\>/','<ul class="nav nav-pills flex-column">',$level_0); + private string $contents = ''; - $levels = array(); + function widget() { + $this->determine_help_language(); + $this->find_help_file('toc', $this->lang['language']); - // TODO: Implement support for translations in hierarchical table of content files - /* - if(argc() > 2) { - $path = ''; - for($x = 1; $x < argc(); $x ++) { - $path .= argv($x) . '/'; - $y = get_help_content($path . 'sitetoc'); - if(! $y) - $y = get_help_content($path . 'toc'); - if($y) - $levels[] = preg_replace('/\<ul(.*?)\>/','<ul class="nav nav-pills flex-column">',$y); - } - } - */ - - if($level_0) - $o .= $level_0; - if($levels) { - foreach($levels as $l) { - $o .= '<br /><br />'; - $o .= $l; - } + if (! empty($this->file_name)) { + $this->contents = file_get_contents($this->file_name); } - $o .= '</div>'; + $tpl = get_markup_template('widget.tpl'); + return replace_macros($tpl, [ '$widget' => $this ]); + } + + public function title(): string { + return t('Help Contents'); + } - return $o; + public function contents(): string { + return $this->contents; } } |