mambax7/smartfaq

View on GitHub
blocks/faqs_random_diduno.php

Summary

Maintainability
A
1 hr
Test Coverage
<?php declare(strict_types=1);

/**
 * Module: SmartFAQ
 * Author: The SmartFactory <www.smartfactory.ca>
 * Licence: GNU
 */

use XoopsModules\Smartfaq\Constants;
use XoopsModules\Smartfaq\Helper;

/**
 * @return array
 */
function b_faqs_random_diduno_show()
{
    //    require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';

    $block = [];

    // Creating the faq handler object
    /** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */
    $faqHandler = Helper::getInstance()->getHandler('Faq');

    // creating the FAQ object
    $faqsObj = $faqHandler->getRandomFaq('diduno', [Constants::SF_STATUS_PUBLISHED, Constants::SF_STATUS_NEW_ANSWER]);

    if ($faqsObj) {
        $block['content']     = $faqsObj->diduno();
        $block['id']          = $faqsObj->faqid();
        $block['lang_answer'] = _MB_SF_MOREDETAILS;
    }

    return $block;
}