示例#1
0
/**
 * Get complete click type HTML
 *
 * @since 0.0.6
 *
 * @param int $id Group ID
 *
 * @return string
 */
function ingot_click_test($id)
{
    $html = '';
    if (!is_array($id)) {
        $group = \ingot\testing\crud\group::read($id);
    } else {
        $group = $id;
    }
    if (!is_array($group) || 'click' !== $group['type']) {
        return $html;
    }
    $type = $group['sub_type'];
    if (in_array($type, \ingot\testing\types::allowed_click_types())) {
        switch ($type) {
            case in_array($type, \ingot\testing\types::internal_click_types()):
                $html = ingot_click_html_link($type, $group);
                break;
            case is_callable($type):
                $html = call_user_func($type, $group);
                break;
            default:
                $html = '';
        }
    }
    return $html;
}