Add FAQ Help#84
Merged
Merged
Conversation
Signed-off-by: Matt Friedman <maf675@gmail.com>
rxu
reviewed
Oct 18, 2024
Comment on lines
+289
to
+320
| public function wpn_faq($event) | ||
| { | ||
| if ($event['block_name'] === 'HELP_FAQ_BLOCK_ATTACHMENTS') | ||
| { | ||
| $this->language->add_lang('webpushnotifications_faq', 'phpbb/webpushnotifications'); | ||
|
|
||
| $this->template->assign_block_vars('faq_block', [ | ||
| 'BLOCK_TITLE' => $this->language->lang('HELP_FAQ_WPN'), | ||
| 'SWITCH_COLUMN' => false, | ||
| ]); | ||
|
|
||
| $questions = [ | ||
| 'HELP_FAQ_WPN_WHAT_QUESTION' => 'HELP_FAQ_WPN_WHAT_ANSWER', | ||
| 'HELP_FAQ_WPN_HOW_QUESTION' => 'HELP_FAQ_WPN_HOW_ANSWER', | ||
| 'HELP_FAQ_WPN_IOS_QUESTION' => 'HELP_FAQ_WPN_IOS_ANSWER', | ||
| 'HELP_FAQ_WPN_SESSION_QUESTION' => 'HELP_FAQ_WPN_SESSION_ANSWER', | ||
| 'HELP_FAQ_WPN_SUBBING_QUESTION' => 'HELP_FAQ_WPN_SUBBING_ANSWER', | ||
| 'HELP_FAQ_WPN_GENERAL_QUESTION' => 'HELP_FAQ_WPN_GENERAL_ANSWER', | ||
| ]; | ||
|
|
||
| $faq_rows = []; | ||
| foreach ($questions as $question => $answer) | ||
| { | ||
| $faq_rows[] = [ | ||
| 'FAQ_QUESTION' => $this->language->lang($question), | ||
| 'FAQ_ANSWER' => $this->language->lang($answer), | ||
| ]; | ||
| } | ||
|
|
||
| $this->template->assign_block_vars_array('faq_block.faq_row', $faq_rows); | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
I feel like we're duplicating the code from the help manager here. Instead we could just inject the manager service and use it like f.e.
$this->language->add_lang('webpushnotifications_faq', 'phpbb/webpushnotifications');
$questions = [
'HELP_FAQ_WPN_WHAT_QUESTION' => 'HELP_FAQ_WPN_WHAT_ANSWER',
'HELP_FAQ_WPN_HOW_QUESTION' => 'HELP_FAQ_WPN_HOW_ANSWER',
'HELP_FAQ_WPN_IOS_QUESTION' => 'HELP_FAQ_WPN_IOS_ANSWER',
'HELP_FAQ_WPN_SESSION_QUESTION' => 'HELP_FAQ_WPN_SESSION_ANSWER',
'HELP_FAQ_WPN_SUBBING_QUESTION' => 'HELP_FAQ_WPN_SUBBING_ANSWER',
'HELP_FAQ_WPN_GENERAL_QUESTION' => 'HELP_FAQ_WPN_GENERAL_ANSWER',
];
$this->help_manager->add_block('HELP_FAQ_WPN', false, $questions);
Contributor
There was a problem hiding this comment.
Or will it make an endless loop, hmm.
Contributor
Author
There was a problem hiding this comment.
Yeah but I dont want to write the tests for that just to eliminate a few lines of code in here
Signed-off-by: Matt Friedman <maf675@gmail.com>
Signed-off-by: Matt Friedman <maf675@gmail.com>
Signed-off-by: Matt Friedman <maf675@gmail.com>
Signed-off-by: Matt Friedman <maf675@gmail.com>
Signed-off-by: Matt Friedman <maf675@gmail.com>
rxu
approved these changes
Oct 19, 2024
Contributor
Author
|
@marc1706 do you think this is worth adding to the core too? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.