| Conditions | 4 |
| Paths | 4 |
| Total Lines | 31 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 12 | function b_faqs_context_show($options) |
||
| 13 | { |
||
| 14 | // require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
||
| 15 | |||
| 16 | $block = []; |
||
| 17 | |||
| 18 | if (0 == $options[0]) { |
||
| 19 | $categoryid = -1; |
||
|
|
|||
| 20 | } else { |
||
| 21 | $categoryid = $options[0]; |
||
| 22 | } |
||
| 23 | |||
| 24 | $limit = $options[0]; |
||
| 25 | |||
| 26 | // Creating the faq handler object |
||
| 27 | /** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */ |
||
| 28 | $faqHandler = Helper::getInstance()->getHandler('Faq'); |
||
| 29 | |||
| 30 | // creating the FAQ objects that belong to the selected category |
||
| 31 | $faqsObj = $faqHandler->getContextualFaqs($limit); |
||
| 32 | |||
| 33 | if ($faqsObj) { |
||
| 34 | foreach ($faqsObj as $iValue) { |
||
| 35 | $faq = []; |
||
| 36 | $faq['id'] = $iValue->faqid(); |
||
| 37 | $faq['question'] = $iValue->question(); |
||
| 38 | $block['faqs'][] = $faq; |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | return $block; |
||
| 43 | } |
||
| 56 |