public static function create_from_question_category_instance($category, $context = null) {

        $params = ['objectid' => $category->id];

        if (!empty($category->contextid)) {
            $params['contextid'] = $category->contextid;
        }

        $params['context'] = $context;

        $event = self::create($params);
        return $event;
    }
public static function create_from_question_category_instance($category, $context = null) {

        $params = ['objectid' => $category->id];

        if (!empty($category->contextid)) {
            $params['contextid'] = $category->contextid;
        }

        $params['context'] = $context;

        $event = self::create($params);
        return $event;
    }
public static function create_from_question_category_instance ( $ category , $ context = null ) { $ params = [ 'objectid' => $ category -> id ] ; if ( ! empty ( $ category -> contextid ) ) { $ params [ 'contextid' ] = $ category -> contextid ; } $ params [ 'context' ] = $ context ; $ event = self :: create ( $ params ) ; return $ event ; }
Create a event from question category object

@param object $category
@param object|null $context
@return base
@throws \coding_exception
Create a event from question category object