40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
// (C) Copyright 2015 Martin Dougiamas
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
import { Injector } from '@angular/core';
|
|
import { CoreQuestionBaseHandler } from '@core/question/classes/base-question-handler';
|
|
import { CoreSitePluginsQuestionComponent } from '../../components/question/question';
|
|
|
|
/**
|
|
* Handler to display a question site plugin.
|
|
*/
|
|
export class CoreSitePluginsQuestionHandler extends CoreQuestionBaseHandler {
|
|
|
|
constructor(public name: string, public type: string) {
|
|
super();
|
|
}
|
|
|
|
/**
|
|
* Return the Component to use to display the question.
|
|
* It's recommended to return the class of the component, but you can also return an instance of the component.
|
|
*
|
|
* @param {Injector} injector Injector.
|
|
* @param {any} question The question to render.
|
|
* @return {any|Promise<any>} The component (or promise resolved with component) to use, undefined if not found.
|
|
*/
|
|
getComponent(injector: Injector): any | Promise<any> {
|
|
return CoreSitePluginsQuestionComponent;
|
|
}
|
|
}
|