|
23 | 23 | use phpMyFAQ\Question; |
24 | 24 | use phpMyFAQ\Strings; |
25 | 25 | use phpMyFAQ\System; |
26 | | -use phpMyFAQ\Twig\TwigWrapper; |
27 | 26 | use phpMyFAQ\Translation; |
| 27 | +use phpMyFAQ\Twig\TwigWrapper; |
28 | 28 | use Symfony\Component\HttpFoundation\RedirectResponse; |
29 | 29 | use Symfony\Component\HttpFoundation\Request; |
30 | 30 | use Twig\TwigFilter; |
|
96 | 96 |
|
97 | 97 | // Twig template variables |
98 | 98 | $templateVars = [ |
99 | | - ... $templateVars, |
100 | | - 'title' => sprintf('%s - %s', Translation::get(languageKey: 'msgAddContent'), $faqConfig->getTitle()), |
101 | | - 'metaDescription' => sprintf('%s | %s', Translation::get(languageKey: 'msgNewContentHeader'), $faqConfig->getTitle()), |
102 | | - 'msgNewContentHeader' => Translation::get(languageKey: 'msgNewContentHeader'), |
103 | | - 'msgNewContentAddon' => Translation::get(languageKey: 'msgNewContentAddon'), |
| 99 | + ...$templateVars, |
| 100 | + 'title' => sprintf('%s - %s', Translation::get(key: 'msgAddContent'), $faqConfig->getTitle()), |
| 101 | + 'metaDescription' => sprintf('%s | %s', Translation::get(key: 'msgNewContentHeader'), $faqConfig->getTitle()), |
| 102 | + 'msgNewContentHeader' => Translation::get(key: 'msgNewContentHeader'), |
| 103 | + 'msgNewContentAddon' => Translation::get(key: 'msgNewContentAddon'), |
104 | 104 | 'lang' => $Language->getLanguage(), |
105 | 105 | 'openQuestionID' => $selectedQuestion, |
106 | | - 'defaultContentMail' => ($user->getUserId() > 0) ? $user->getUserData('email') : '', |
107 | | - 'defaultContentName' => ($user->getUserId() > 0) ? $user->getUserData('display_name') : '', |
108 | | - 'msgNewContentName' => Translation::get(languageKey: 'msgNewContentName'), |
109 | | - 'msgNewContentMail' => Translation::get(languageKey: 'msgNewContentMail'), |
110 | | - 'msgNewContentCategory' => Translation::get(languageKey: 'msgNewContentCategory'), |
| 106 | + 'defaultContentMail' => $user->getUserId() > 0 ? $user->getUserData('email') : '', |
| 107 | + 'defaultContentName' => $user->getUserId() > 0 ? $user->getUserData('display_name') : '', |
| 108 | + 'msgNewContentName' => Translation::get(key: 'msgNewContentName'), |
| 109 | + 'msgNewContentMail' => Translation::get(key: 'msgNewContentMail'), |
| 110 | + 'msgNewContentCategory' => Translation::get(key: 'msgNewContentCategory'), |
111 | 111 | 'selectedCategory' => $selectedCategory, |
112 | 112 | 'categories' => $category->getCategoryTree(), |
113 | | - 'msgNewContentTheme' => Translation::get(languageKey: 'msgNewContentTheme'), |
| 113 | + 'msgNewContentTheme' => Translation::get(key: 'msgNewContentTheme'), |
114 | 114 | 'readonly' => $readonly, |
115 | 115 | 'printQuestion' => $question, |
116 | | - 'msgNewContentArticle' => Translation::get(languageKey: 'msgNewContentArticle'), |
117 | | - 'msgNewContentKeywords' => Translation::get(languageKey: 'msgNewContentKeywords'), |
118 | | - 'msgNewContentLink' => Translation::get(languageKey: 'msgNewContentLink'), |
119 | | - 'captchaFieldset' => |
120 | | - $captchaHelper->renderCaptcha($captcha, 'add', Translation::get(languageKey: 'msgCaptcha'), $user->isLoggedIn()), |
121 | | - 'msgNewContentSubmit' => Translation::get(languageKey: 'msgNewContentSubmit'), |
| 116 | + 'msgNewContentArticle' => Translation::get(key: 'msgNewContentArticle'), |
| 117 | + 'msgNewContentKeywords' => Translation::get(key: 'msgNewContentKeywords'), |
| 118 | + 'msgNewContentLink' => Translation::get(key: 'msgNewContentLink'), |
| 119 | + 'captchaFieldset' => $captchaHelper->renderCaptcha( |
| 120 | + $captcha, |
| 121 | + 'add', |
| 122 | + Translation::get(key: 'msgCaptcha'), |
| 123 | + $user->isLoggedIn(), |
| 124 | + ), |
| 125 | + 'msgNewContentSubmit' => Translation::get(key: 'msgNewContentSubmit'), |
122 | 126 | 'enableWysiwygEditor' => $faqConfig->get('main.enableWysiwygEditorFrontend'), |
123 | 127 | 'currentTimestamp' => $request->server->get('REQUEST_TIME'), |
124 | | - 'msgSeparateKeywordsWithCommas' => Translation::get(languageKey: 'msgSeparateKeywordsWithCommas'), |
| 128 | + 'msgSeparateKeywordsWithCommas' => Translation::get(key: 'msgSeparateKeywordsWithCommas'), |
125 | 129 | 'noCategories' => $categories === [], |
126 | | - 'msgFormDisabledDueToMissingCategories' => Translation::get(languageKey: 'msgFormDisabledDueToMissingCategories'), |
| 130 | + 'msgFormDisabledDueToMissingCategories' => Translation::get(key: 'msgFormDisabledDueToMissingCategories'), |
127 | 131 | 'displayFullForm' => $displayFullForm, |
128 | 132 | ]; |
129 | 133 |
|
130 | 134 | // Collect data for displaying form |
131 | 135 | foreach ($formData as $input) { |
132 | | - $active = sprintf('id%d_active', (int)$input->input_id); |
133 | | - $label = sprintf('id%d_label', (int)$input->input_id); |
134 | | - $required = sprintf('id%d_required', (int)$input->input_id); |
| 136 | + $active = sprintf('id%d_active', (int) $input->input_id); |
| 137 | + $label = sprintf('id%d_label', (int) $input->input_id); |
| 138 | + $required = sprintf('id%d_required', (int) $input->input_id); |
135 | 139 | $templateVars = [ |
136 | 140 | ...$templateVars, |
137 | | - $active => (bool)$input->input_active, |
| 141 | + $active => (bool) $input->input_active, |
138 | 142 | $label => $input->input_label, |
139 | | - $required => ((int)$input->input_required !== 0) ? 'required' : '' |
| 143 | + $required => (int) $input->input_required !== 0 ? 'required' : '', |
140 | 144 | ]; |
141 | 145 | } |
142 | 146 |
|
|
0 commit comments