diff --git a/src/addons/addons.module.ts b/src/addons/addons.module.ts
index 66777ebfa..98845ab4a 100644
--- a/src/addons/addons.module.ts
+++ b/src/addons/addons.module.ts
@@ -16,11 +16,13 @@ import { NgModule } from '@angular/core';
import { AddonPrivateFilesModule } from './privatefiles/privatefiles.module';
import { AddonFilterModule } from './filter/filter.module';
+import { AddonUserProfileFieldModule } from './userprofilefield/userprofilefield.module';
@NgModule({
imports: [
AddonPrivateFilesModule,
AddonFilterModule,
+ AddonUserProfileFieldModule,
],
})
export class AddonsModule {}
diff --git a/src/addons/userprofilefield/checkbox/checkbox.module.ts b/src/addons/userprofilefield/checkbox/checkbox.module.ts
new file mode 100644
index 000000000..d6134503c
--- /dev/null
+++ b/src/addons/userprofilefield/checkbox/checkbox.module.ts
@@ -0,0 +1,56 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { APP_INITIALIZER, NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { IonicModule } from '@ionic/angular';
+import { TranslateModule } from '@ngx-translate/core';
+
+import { AddonUserProfileFieldCheckboxHandler } from './services/handlers/checkbox';
+import { CoreUserProfileFieldDelegate } from '@features/user/services/user-profile-field-delegate';
+import { AddonUserProfileFieldCheckboxComponent } from './component/checkbox';
+import { CoreComponentsModule } from '@components/components.module';
+
+@NgModule({
+ declarations: [
+ AddonUserProfileFieldCheckboxComponent,
+ ],
+ imports: [
+ CommonModule,
+ IonicModule.forRoot(),
+ TranslateModule.forChild(),
+ FormsModule,
+ ReactiveFormsModule,
+ CoreComponentsModule,
+ ],
+ providers: [
+ {
+ provide: APP_INITIALIZER,
+ multi: true,
+ deps: [CoreUserProfileFieldDelegate, AddonUserProfileFieldCheckboxHandler],
+ useFactory: (
+ userProfileFieldDelegate: CoreUserProfileFieldDelegate,
+ handler: AddonUserProfileFieldCheckboxHandler,
+ ) => () => userProfileFieldDelegate.registerHandler(handler),
+ },
+ ],
+ exports: [
+ AddonUserProfileFieldCheckboxComponent,
+ ],
+ entryComponents: [
+ AddonUserProfileFieldCheckboxComponent,
+ ],
+})
+export class AddonUserProfileFieldCheckboxModule {}
diff --git a/src/addons/userprofilefield/checkbox/component/addon-user-profile-field-checkbox.html b/src/addons/userprofilefield/checkbox/component/addon-user-profile-field-checkbox.html
new file mode 100644
index 000000000..eaa9ec043
--- /dev/null
+++ b/src/addons/userprofilefield/checkbox/component/addon-user-profile-field-checkbox.html
@@ -0,0 +1,22 @@
+
+
+
+
{{ field.name }}
+
+ {{ 'core.yes' | translate }}
+
+
+ {{ 'core.no' | translate }}
+
+
+
+
+
+
+
+ {{ field.name }}
+
+
+
+
+
\ No newline at end of file
diff --git a/src/addons/userprofilefield/checkbox/component/checkbox.ts b/src/addons/userprofilefield/checkbox/component/checkbox.ts
new file mode 100644
index 000000000..672307930
--- /dev/null
+++ b/src/addons/userprofilefield/checkbox/component/checkbox.ts
@@ -0,0 +1,45 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { Component } from '@angular/core';
+import { Validators, FormControl } from '@angular/forms';
+
+import { AuthEmailSignupProfileField } from '@features/login/services/login-helper';
+import { CoreUserProfileFieldBaseComponent } from '@features/user/classes/base-profilefield-component';
+import { CoreUtils } from '@services/utils/utils';
+
+/**
+ * Directive to render a checkbox user profile field.
+ */
+@Component({
+ selector: 'addon-user-profile-field-checkbox',
+ templateUrl: 'addon-user-profile-field-checkbox.html',
+})
+export class AddonUserProfileFieldCheckboxComponent extends CoreUserProfileFieldBaseComponent {
+
+ /**
+ * Create the Form control.
+ *
+ * @return Form control.
+ */
+ protected createFormControl(field: AuthEmailSignupProfileField): FormControl {
+ const formData = {
+ value: CoreUtils.instance.isTrueOrOne(field.defaultdata),
+ disabled: this.disabled,
+ };
+
+ return new FormControl(formData, this.required && !field.locked ? Validators.requiredTrue : null);
+ }
+
+}
diff --git a/src/addons/userprofilefield/checkbox/services/handlers/checkbox.ts b/src/addons/userprofilefield/checkbox/services/handlers/checkbox.ts
new file mode 100644
index 000000000..02d31fd4e
--- /dev/null
+++ b/src/addons/userprofilefield/checkbox/services/handlers/checkbox.ts
@@ -0,0 +1,76 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { Injectable, Type } from '@angular/core';
+
+import { AuthEmailSignupProfileField } from '@features/login/services/login-helper';
+import { CoreUserProfileField } from '@features/user/services/user';
+import { CoreUserProfileFieldHandler, CoreUserProfileFieldHandlerData } from '@features/user/services/user-profile-field-delegate';
+import { AddonUserProfileFieldCheckboxComponent } from '../../component/checkbox';
+
+/**
+ * Checkbox user profile field handlers.
+ */
+@Injectable({ providedIn: 'root' })
+export class AddonUserProfileFieldCheckboxHandler implements CoreUserProfileFieldHandler {
+
+ name = 'AddonUserProfileFieldCheckbox';
+ type = 'checkbox';
+
+ /**
+ * Whether or not the handler is enabled on a site level.
+ *
+ * @return Promise resolved with true if enabled.
+ */
+ async isEnabled(): Promise {
+ return true;
+ }
+
+ /**
+ * Get the data to send for the field based on the input data.
+ *
+ * @param field User field to get the data for.
+ * @param signup True if user is in signup page.
+ * @param registerAuth Register auth method. E.g. 'email'.
+ * @param formValues Form Values.
+ * @return Data to send for the field.
+ */
+ async getData(
+ field: AuthEmailSignupProfileField | CoreUserProfileField,
+ signup: boolean,
+ registerAuth: string,
+ formValues: Record,
+ ): Promise {
+ const name = 'profile_field_' + field.shortname;
+
+ if (typeof formValues[name] != 'undefined') {
+ return {
+ type: 'checkbox',
+ name: name,
+ value: formValues[name] ? 1 : 0,
+ };
+ }
+ }
+
+ /**
+ * Return the Component to use to display the user profile field.
+ * It's recommended to return the class of the component, but you can also return an instance of the component.
+ *
+ * @return The component (or promise resolved with component) to use, undefined if not found.
+ */
+ getComponent(): Type | Promise> {
+ return AddonUserProfileFieldCheckboxComponent;
+ }
+
+}
diff --git a/src/addons/userprofilefield/datetime/component/addon-user-profile-field-datetime.html b/src/addons/userprofilefield/datetime/component/addon-user-profile-field-datetime.html
new file mode 100644
index 000000000..7d75067a0
--- /dev/null
+++ b/src/addons/userprofilefield/datetime/component/addon-user-profile-field-datetime.html
@@ -0,0 +1,18 @@
+
+
+
+
{{ field.name }}
+
{{ valueNumber * 1000 | coreFormatDate }}
+
+
+
+
+
+
+ {{ field.name }}
+
+
+
+
+
\ No newline at end of file
diff --git a/src/addons/userprofilefield/datetime/component/datetime.ts b/src/addons/userprofilefield/datetime/component/datetime.ts
new file mode 100644
index 000000000..3deb698d2
--- /dev/null
+++ b/src/addons/userprofilefield/datetime/component/datetime.ts
@@ -0,0 +1,95 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { FormControl, Validators } from '@angular/forms';
+import { Component } from '@angular/core';
+
+import { CoreTimeUtils } from '@services/utils/time';
+import { CoreUtils } from '@services/utils/utils';
+import { AuthEmailSignupProfileField } from '@features/login/services/login-helper';
+import { CoreUserProfileField } from '@features/user/services/user';
+import { Translate } from '@singletons';
+import { CoreUserProfileFieldBaseComponent } from '@features/user/classes/base-profilefield-component';
+
+/**
+ * Directive to render a datetime user profile field.
+ */
+@Component({
+ selector: 'addon-user-profile-field-datetime',
+ templateUrl: 'addon-user-profile-field-datetime.html',
+})
+export class AddonUserProfileFieldDatetimeComponent extends CoreUserProfileFieldBaseComponent {
+
+ format?: string;
+ min?: number;
+ max?: number;
+ valueNumber = 0;
+
+ /**
+ * Init the data when the field is meant to be displayed without editing.
+ *
+ * @param field Field to render.
+ */
+ protected initForNonEdit(field: CoreUserProfileField): void {
+ this.valueNumber = Number(field.value);
+ }
+
+ /**
+ * Init the data when the field is meant to be displayed for editing.
+ *
+ * @param field Field to render.
+ */
+ protected initForEdit(field: AuthEmailSignupProfileField): void {
+ super.initForEdit(field);
+
+ // Check if it's only date or it has time too.
+ const hasTime = CoreUtils.instance.isTrueOrOne(field.param3);
+
+ // Calculate format to use.
+ this.format = CoreTimeUtils.instance.fixFormatForDatetime(CoreTimeUtils.instance.convertPHPToMoment(
+ Translate.instance.instant('core.' + (hasTime ? 'strftimedatetime' : 'strftimedate')),
+ ));
+
+ // Check min value.
+ if (field.param1) {
+ const year = parseInt(field.param1, 10);
+ if (year) {
+ this.min = year;
+ }
+ }
+
+ // Check max value.
+ if (field.param2) {
+ const year = parseInt(field.param2, 10);
+ if (year) {
+ this.max = year;
+ }
+ }
+ }
+
+ /**
+ * Create the Form control.
+ *
+ * @return Form control.
+ */
+ protected createFormControl(field: AuthEmailSignupProfileField): FormControl {
+ const formData = {
+ value: field.defaultdata != '0' ? field.defaultdata : undefined,
+ disabled: this.disabled,
+ };
+
+ return new FormControl(formData, this.required && !field.locked ? Validators.required : null);
+ }
+
+}
diff --git a/src/addons/userprofilefield/datetime/datetime.module.ts b/src/addons/userprofilefield/datetime/datetime.module.ts
new file mode 100644
index 000000000..02cd226f4
--- /dev/null
+++ b/src/addons/userprofilefield/datetime/datetime.module.ts
@@ -0,0 +1,58 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { APP_INITIALIZER, NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { IonicModule } from '@ionic/angular';
+import { TranslateModule } from '@ngx-translate/core';
+
+import { AddonUserProfileFieldDatetimeHandler } from './services/handlers/datetime';
+import { CoreUserProfileFieldDelegate } from '@features/user/services/user-profile-field-delegate';
+import { AddonUserProfileFieldDatetimeComponent } from './component/datetime';
+import { CoreComponentsModule } from '@components/components.module';
+import { CorePipesModule } from '@pipes/pipes.module';
+
+@NgModule({
+ declarations: [
+ AddonUserProfileFieldDatetimeComponent,
+ ],
+ imports: [
+ CommonModule,
+ IonicModule.forRoot(),
+ TranslateModule.forChild(),
+ FormsModule,
+ ReactiveFormsModule,
+ CoreComponentsModule,
+ CorePipesModule,
+ ],
+ providers: [
+ {
+ provide: APP_INITIALIZER,
+ multi: true,
+ deps: [CoreUserProfileFieldDelegate, AddonUserProfileFieldDatetimeHandler],
+ useFactory: (
+ userProfileFieldDelegate: CoreUserProfileFieldDelegate,
+ handler: AddonUserProfileFieldDatetimeHandler,
+ ) => () => userProfileFieldDelegate.registerHandler(handler),
+ },
+ ],
+ exports: [
+ AddonUserProfileFieldDatetimeComponent,
+ ],
+ entryComponents: [
+ AddonUserProfileFieldDatetimeComponent,
+ ],
+})
+export class AddonUserProfileFieldDatetimeModule {}
diff --git a/src/addons/userprofilefield/datetime/services/handlers/datetime.ts b/src/addons/userprofilefield/datetime/services/handlers/datetime.ts
new file mode 100644
index 000000000..b35feb867
--- /dev/null
+++ b/src/addons/userprofilefield/datetime/services/handlers/datetime.ts
@@ -0,0 +1,78 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { Injectable, Type } from '@angular/core';
+
+import { AuthEmailSignupProfileField } from '@features/login/services/login-helper';
+import { CoreUserProfileField } from '@features/user/services/user';
+import { CoreUserProfileFieldHandler, CoreUserProfileFieldHandlerData } from '@features/user/services/user-profile-field-delegate';
+import { CoreTimeUtils } from '@services/utils/time';
+import { AddonUserProfileFieldDatetimeComponent } from '../../component/datetime';
+
+/**
+ * Datetime user profile field handlers.
+ */
+@Injectable({ providedIn: 'root' })
+export class AddonUserProfileFieldDatetimeHandler implements CoreUserProfileFieldHandler {
+
+ name = 'AddonUserProfileFieldDatetime';
+ type = 'datetime';
+
+ /**
+ * Whether or not the handler is enabled on a site level.
+ *
+ * @return Promise resolved with true if enabled.
+ */
+ async isEnabled(): Promise {
+ return true;
+ }
+
+ /**
+ * Get the data to send for the field based on the input data.
+ *
+ * @param field User field to get the data for.
+ * @param signup True if user is in signup page.
+ * @param registerAuth Register auth method. E.g. 'email'.
+ * @param formValues Form Values.
+ * @return Data to send for the field.
+ */
+ async getData(
+ field: AuthEmailSignupProfileField | CoreUserProfileField,
+ signup: boolean,
+ registerAuth: string,
+ formValues: Record,
+ ): Promise {
+ const name = 'profile_field_' + field.shortname;
+
+ if (formValues[name]) {
+ return {
+ type: 'datetime',
+ name: 'profile_field_' + field.shortname,
+ value: CoreTimeUtils.instance.convertToTimestamp( formValues[name]),
+ };
+ }
+ }
+
+ /**
+ * Return the Component to use to display the user profile field.
+ * It's recommended to return the class of the component, but you can also return an instance of the component.
+ *
+ * @param injector Injector.
+ * @return The component (or promise resolved with component) to use, undefined if not found.
+ */
+ getComponent(): Type | Promise> {
+ return AddonUserProfileFieldDatetimeComponent;
+ }
+
+}
diff --git a/src/addons/userprofilefield/menu/component/addon-user-profile-field-menu.html b/src/addons/userprofilefield/menu/component/addon-user-profile-field-menu.html
new file mode 100644
index 000000000..ce2e84f68
--- /dev/null
+++ b/src/addons/userprofilefield/menu/component/addon-user-profile-field-menu.html
@@ -0,0 +1,21 @@
+
+
+
+
{{ field.name }}
+
+
+
+
+
+
+
+
+ {{ field.name }}
+
+
+ {{ 'core.choosedots' | translate }}
+ {{option}}
+
+
+
diff --git a/src/addons/userprofilefield/menu/component/menu.ts b/src/addons/userprofilefield/menu/component/menu.ts
new file mode 100644
index 000000000..b497b69de
--- /dev/null
+++ b/src/addons/userprofilefield/menu/component/menu.ts
@@ -0,0 +1,47 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { Component } from '@angular/core';
+
+import { AuthEmailSignupProfileField } from '@features/login/services/login-helper';
+import { CoreUserProfileFieldBaseComponent } from '@features/user/classes/base-profilefield-component';
+
+/**
+ * Directive to render a menu user profile field.
+ */
+@Component({
+ selector: 'addon-user-profile-field-menu',
+ templateUrl: 'addon-user-profile-field-menu.html',
+})
+export class AddonUserProfileFieldMenuComponent extends CoreUserProfileFieldBaseComponent {
+
+ options?: string[];
+
+ /**
+ * Init the data when the field is meant to be displayed for editing.
+ *
+ * @param field Field to render.
+ */
+ protected initForEdit(field: AuthEmailSignupProfileField): void {
+ super.initForEdit(field);
+
+ // Parse options.
+ if (field.param1) {
+ this.options = field.param1.split(/\r\n|\r|\n/g);
+ } else {
+ this.options = [];
+ }
+ }
+
+}
diff --git a/src/addons/userprofilefield/menu/menu.module.ts b/src/addons/userprofilefield/menu/menu.module.ts
new file mode 100644
index 000000000..e91183197
--- /dev/null
+++ b/src/addons/userprofilefield/menu/menu.module.ts
@@ -0,0 +1,58 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { APP_INITIALIZER, NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { IonicModule } from '@ionic/angular';
+import { TranslateModule } from '@ngx-translate/core';
+
+import { AddonUserProfileFieldMenuHandler } from './services/handlers/menu';
+import { CoreUserProfileFieldDelegate } from '@features/user/services/user-profile-field-delegate';
+import { AddonUserProfileFieldMenuComponent } from './component/menu';
+import { CoreComponentsModule } from '@components/components.module';
+import { CoreDirectivesModule } from '@directives/directives.module';
+
+@NgModule({
+ declarations: [
+ AddonUserProfileFieldMenuComponent,
+ ],
+ imports: [
+ CommonModule,
+ IonicModule.forRoot(),
+ TranslateModule.forChild(),
+ FormsModule,
+ ReactiveFormsModule,
+ CoreComponentsModule,
+ CoreDirectivesModule,
+ ],
+ providers: [
+ {
+ provide: APP_INITIALIZER,
+ multi: true,
+ deps: [CoreUserProfileFieldDelegate, AddonUserProfileFieldMenuHandler],
+ useFactory: (
+ userProfileFieldDelegate: CoreUserProfileFieldDelegate,
+ handler: AddonUserProfileFieldMenuHandler,
+ ) => () => userProfileFieldDelegate.registerHandler(handler),
+ },
+ ],
+ exports: [
+ AddonUserProfileFieldMenuComponent,
+ ],
+ entryComponents: [
+ AddonUserProfileFieldMenuComponent,
+ ],
+})
+export class AddonUserProfileFieldMenuModule {}
diff --git a/src/addons/userprofilefield/menu/services/handlers/menu.ts b/src/addons/userprofilefield/menu/services/handlers/menu.ts
new file mode 100644
index 000000000..d40444adf
--- /dev/null
+++ b/src/addons/userprofilefield/menu/services/handlers/menu.ts
@@ -0,0 +1,76 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { Injectable, Type } from '@angular/core';
+
+import { AuthEmailSignupProfileField } from '@features/login/services/login-helper';
+import { CoreUserProfileField } from '@features/user/services/user';
+import { CoreUserProfileFieldHandler, CoreUserProfileFieldHandlerData } from '@features/user/services/user-profile-field-delegate';
+import { AddonUserProfileFieldMenuComponent } from '../../component/menu';
+
+/**
+ * Menu user profile field handlers.
+ */
+@Injectable({ providedIn: 'root' })
+export class AddonUserProfileFieldMenuHandler implements CoreUserProfileFieldHandler {
+
+ name = 'AddonUserProfileFieldMenu';
+ type = 'menu';
+
+ /**
+ * Whether or not the handler is enabled on a site level.
+ *
+ * @return Promise resolved with true if enabled.
+ */
+ async isEnabled(): Promise {
+ return true;
+ }
+
+ /**
+ * Get the data to send for the field based on the input data.
+ *
+ * @param field User field to get the data for.
+ * @param signup True if user is in signup page.
+ * @param registerAuth Register auth method. E.g. 'email'.
+ * @param formValues Form Values.
+ * @return Data to send for the field.
+ */
+ async getData(
+ field: AuthEmailSignupProfileField | CoreUserProfileField,
+ signup: boolean,
+ registerAuth: string,
+ formValues: Record,
+ ): Promise {
+ const name = 'profile_field_' + field.shortname;
+
+ if (formValues[name]) {
+ return {
+ type: 'menu',
+ name: name,
+ value: formValues[name],
+ };
+ }
+ }
+
+ /**
+ * Return the Component to use to display the user profile field.
+ * It's recommended to return the class of the component, but you can also return an instance of the component.
+ *
+ * @return The component (or promise resolved with component) to use, undefined if not found.
+ */
+ getComponent(): Type | Promise> {
+ return AddonUserProfileFieldMenuComponent;
+ }
+
+}
diff --git a/src/addons/userprofilefield/text/component/addon-user-profile-field-text.html b/src/addons/userprofilefield/text/component/addon-user-profile-field-text.html
new file mode 100644
index 000000000..51d52320d
--- /dev/null
+++ b/src/addons/userprofilefield/text/component/addon-user-profile-field-text.html
@@ -0,0 +1,18 @@
+
+
+
+
{{ field.name }}
+
+
+
+
+
+
+
+
+ {{ field.name }}
+
+
+
+
diff --git a/src/addons/userprofilefield/text/component/text.ts b/src/addons/userprofilefield/text/component/text.ts
new file mode 100644
index 000000000..3b7f42030
--- /dev/null
+++ b/src/addons/userprofilefield/text/component/text.ts
@@ -0,0 +1,50 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { Component } from '@angular/core';
+
+import { AuthEmailSignupProfileField } from '@features/login/services/login-helper';
+import { CoreUserProfileFieldBaseComponent } from '@features/user/classes/base-profilefield-component';
+import { CoreUtils } from '@services/utils/utils';
+
+/**
+ * Directive to render a text user profile field.
+ */
+@Component({
+ selector: 'addon-user-profile-field-text',
+ templateUrl: 'addon-user-profile-field-text.html',
+})
+export class AddonUserProfileFieldTextComponent extends CoreUserProfileFieldBaseComponent {
+
+ inputType?: string;
+ maxLength?: number;
+
+ /**
+ * Init the data when the field is meant to be displayed for editing.
+ *
+ * @param field Field to render.
+ */
+ protected initForEdit(field: AuthEmailSignupProfileField): void {
+ super.initForEdit(field);
+
+ // Check max length.
+ if (field.param2) {
+ this.maxLength = parseInt(field.param2, 10) || Number.MAX_VALUE;
+ }
+
+ // Check if it's a password or text.
+ this.inputType = CoreUtils.instance.isTrueOrOne(field.param3) ? 'password' : 'text';
+ }
+
+}
diff --git a/src/addons/userprofilefield/text/services/handlers/text.ts b/src/addons/userprofilefield/text/services/handlers/text.ts
new file mode 100644
index 000000000..11abe2c18
--- /dev/null
+++ b/src/addons/userprofilefield/text/services/handlers/text.ts
@@ -0,0 +1,75 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { Injectable, Type } from '@angular/core';
+
+import { CoreUserProfileFieldHandler, CoreUserProfileFieldHandlerData } from '@features/user/services/user-profile-field-delegate';
+import { AddonUserProfileFieldTextComponent } from '../../component/text';
+import { CoreTextUtils } from '@services/utils/text';
+import { AuthEmailSignupProfileField } from '@features/login/services/login-helper';
+import { CoreUserProfileField } from '@features/user/services/user';
+
+/**
+ * Text user profile field handlers.
+ */
+@Injectable({ providedIn: 'root' })
+export class AddonUserProfileFieldTextHandler implements CoreUserProfileFieldHandler {
+
+ name = 'AddonUserProfileFieldText';
+ type = 'text';
+
+ /**
+ * Whether or not the handler is enabled on a site level.
+ *
+ * @return True or promise resolved with true if enabled.
+ */
+ async isEnabled(): Promise {
+ return true;
+ }
+
+ /**
+ * Get the data to send for the field based on the input data.
+ *
+ * @param field User field to get the data for.
+ * @param signup True if user is in signup page.
+ * @param registerAuth Register auth method. E.g. 'email'.
+ * @param formValues Form Values.
+ * @return Data to send for the field.
+ */
+ async getData(
+ field: AuthEmailSignupProfileField | CoreUserProfileField,
+ signup: boolean,
+ registerAuth: string,
+ formValues: Record,
+ ): Promise {
+ const name = 'profile_field_' + field.shortname;
+
+ return {
+ type: 'text',
+ name: name,
+ value: CoreTextUtils.instance.cleanTags( formValues[name]),
+ };
+ }
+
+ /**
+ * Return the Component to use to display the user profile field.
+ * It's recommended to return the class of the component, but you can also return an instance of the component.
+ *
+ * @return The component (or promise resolved with component) to use, undefined if not found.
+ */
+ getComponent(): Type | Promise> {
+ return AddonUserProfileFieldTextComponent;
+ }
+
+}
diff --git a/src/addons/userprofilefield/text/text.module.ts b/src/addons/userprofilefield/text/text.module.ts
new file mode 100644
index 000000000..7287868ae
--- /dev/null
+++ b/src/addons/userprofilefield/text/text.module.ts
@@ -0,0 +1,58 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { APP_INITIALIZER, NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { IonicModule } from '@ionic/angular';
+import { TranslateModule } from '@ngx-translate/core';
+
+import { AddonUserProfileFieldTextHandler } from './services/handlers/text';
+import { CoreUserProfileFieldDelegate } from '@features/user/services/user-profile-field-delegate';
+import { AddonUserProfileFieldTextComponent } from './component/text';
+import { CoreComponentsModule } from '@components/components.module';
+import { CoreDirectivesModule } from '@directives/directives.module';
+
+@NgModule({
+ declarations: [
+ AddonUserProfileFieldTextComponent,
+ ],
+ imports: [
+ CommonModule,
+ IonicModule.forRoot(),
+ TranslateModule.forChild(),
+ FormsModule,
+ ReactiveFormsModule,
+ CoreComponentsModule,
+ CoreDirectivesModule,
+ ],
+ providers: [
+ {
+ provide: APP_INITIALIZER,
+ multi: true,
+ deps: [CoreUserProfileFieldDelegate, AddonUserProfileFieldTextHandler],
+ useFactory: (
+ userProfileFieldDelegate: CoreUserProfileFieldDelegate,
+ handler: AddonUserProfileFieldTextHandler,
+ ) => () => userProfileFieldDelegate.registerHandler(handler),
+ },
+ ],
+ exports: [
+ AddonUserProfileFieldTextComponent,
+ ],
+ entryComponents: [
+ AddonUserProfileFieldTextComponent,
+ ],
+})
+export class AddonUserProfileFieldTextModule {}
diff --git a/src/addons/userprofilefield/textarea/component/addon-user-profile-field-textarea.html b/src/addons/userprofilefield/textarea/component/addon-user-profile-field-textarea.html
new file mode 100644
index 000000000..49011943d
--- /dev/null
+++ b/src/addons/userprofilefield/textarea/component/addon-user-profile-field-textarea.html
@@ -0,0 +1,20 @@
+
+
+
+
{{ field.name }}
+
+
+
+
+
+
+
+
+ {{ field.name }}
+
+
+
+
\ No newline at end of file
diff --git a/src/addons/userprofilefield/textarea/component/textarea.ts b/src/addons/userprofilefield/textarea/component/textarea.ts
new file mode 100644
index 000000000..affe2f616
--- /dev/null
+++ b/src/addons/userprofilefield/textarea/component/textarea.ts
@@ -0,0 +1,26 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { Component } from '@angular/core';
+
+import { CoreUserProfileFieldBaseComponent } from '@features/user/classes/base-profilefield-component';
+
+/**
+ * Directive to render a textarea user profile field.
+ */
+@Component({
+ selector: 'addon-user-profile-field-textarea',
+ templateUrl: 'addon-user-profile-field-textarea.html',
+})
+export class AddonUserProfileFieldTextareaComponent extends CoreUserProfileFieldBaseComponent {}
diff --git a/src/addons/userprofilefield/textarea/services/handlers/textarea.ts b/src/addons/userprofilefield/textarea/services/handlers/textarea.ts
new file mode 100644
index 000000000..56ed58bcd
--- /dev/null
+++ b/src/addons/userprofilefield/textarea/services/handlers/textarea.ts
@@ -0,0 +1,85 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { Injectable, Type } from '@angular/core';
+
+import { CoreUserProfileFieldHandler, CoreUserProfileFieldHandlerData } from '@features/user/services/user-profile-field-delegate';
+import { AddonUserProfileFieldTextareaComponent } from '../../component/textarea';
+import { CoreTextUtils } from '@services/utils/text';
+import { AuthEmailSignupProfileField } from '@features/login/services/login-helper';
+import { CoreUserProfileField } from '@features/user/services/user';
+
+/**
+ * Textarea user profile field handlers.
+ */
+@Injectable({ providedIn: 'root' })
+export class AddonUserProfileFieldTextareaHandler implements CoreUserProfileFieldHandler {
+
+ name = 'AddonUserProfileFieldTextarea';
+ type = 'textarea';
+
+ /**
+ * Whether or not the handler is enabled on a site level.
+ *
+ * @return True or promise resolved with true if enabled.
+ */
+ async isEnabled(): Promise {
+ return true;
+ }
+
+ /**
+ * Get the data to send for the field based on the input data.
+ *
+ * @param field User field to get the data for.
+ * @param signup True if user is in signup page.
+ * @param registerAuth Register auth method. E.g. 'email'.
+ * @param formValues Form Values.
+ * @return Data to send for the field.
+ */
+ async getData(
+ field: AuthEmailSignupProfileField | CoreUserProfileField,
+ signup: boolean,
+ registerAuth: string,
+ formValues: Record,
+ ): Promise {
+ const name = 'profile_field_' + field.shortname;
+
+ if (formValues[name]) {
+ let text = formValues[name] || '';
+ // Add some HTML to the message in case the user edited with textarea.
+ text = CoreTextUtils.instance.formatHtmlLines(text);
+
+ return {
+ type: 'textarea',
+ name: name,
+ value: JSON.stringify({
+ text: text,
+ format: 1, // Always send this format.
+ }),
+ };
+ }
+ }
+
+ /**
+ * Return the Component to use to display the user profile field.
+ * It's recommended to return the class of the component, but you can also return an instance of the component.
+ *
+ * @param injector Injector.
+ * @return The component (or promise resolved with component) to use, undefined if not found.
+ */
+ getComponent(): Type | Promise> {
+ return AddonUserProfileFieldTextareaComponent;
+ }
+
+}
diff --git a/src/addons/userprofilefield/textarea/textarea.module.ts b/src/addons/userprofilefield/textarea/textarea.module.ts
new file mode 100644
index 000000000..a3352bc9d
--- /dev/null
+++ b/src/addons/userprofilefield/textarea/textarea.module.ts
@@ -0,0 +1,60 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { APP_INITIALIZER, NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule, ReactiveFormsModule } from '@angular/forms';
+import { IonicModule } from '@ionic/angular';
+import { TranslateModule } from '@ngx-translate/core';
+
+import { AddonUserProfileFieldTextareaHandler } from './services/handlers/textarea';
+import { CoreUserProfileFieldDelegate } from '@features/user/services/user-profile-field-delegate';
+import { AddonUserProfileFieldTextareaComponent } from './component/textarea';
+import { CoreComponentsModule } from '@components/components.module';
+import { CoreDirectivesModule } from '@directives/directives.module';
+// @todo import { CoreEditorComponentsModule } from '@core/editor/components/components.module';
+
+@NgModule({
+ declarations: [
+ AddonUserProfileFieldTextareaComponent,
+ ],
+ imports: [
+ CommonModule,
+ IonicModule.forRoot(),
+ TranslateModule.forChild(),
+ FormsModule,
+ ReactiveFormsModule,
+ CoreComponentsModule,
+ CoreDirectivesModule,
+ // CoreEditorComponentsModule,
+ ],
+ providers: [
+ {
+ provide: APP_INITIALIZER,
+ multi: true,
+ deps: [CoreUserProfileFieldDelegate, AddonUserProfileFieldTextareaHandler],
+ useFactory: (
+ userProfileFieldDelegate: CoreUserProfileFieldDelegate,
+ handler: AddonUserProfileFieldTextareaHandler,
+ ) => () => userProfileFieldDelegate.registerHandler(handler),
+ },
+ ],
+ exports: [
+ AddonUserProfileFieldTextareaComponent,
+ ],
+ entryComponents: [
+ AddonUserProfileFieldTextareaComponent,
+ ],
+})
+export class AddonUserProfileFieldTextareaModule {}
diff --git a/src/addons/userprofilefield/userprofilefield.module.ts b/src/addons/userprofilefield/userprofilefield.module.ts
new file mode 100644
index 000000000..50910d3a2
--- /dev/null
+++ b/src/addons/userprofilefield/userprofilefield.module.ts
@@ -0,0 +1,33 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { NgModule } from '@angular/core';
+
+import { AddonUserProfileFieldCheckboxModule } from './checkbox/checkbox.module';
+import { AddonUserProfileFieldDatetimeModule } from './datetime/datetime.module';
+import { AddonUserProfileFieldMenuModule } from './menu/menu.module';
+import { AddonUserProfileFieldTextModule } from './text/text.module';
+import { AddonUserProfileFieldTextareaModule } from './textarea/textarea.module';
+
+@NgModule({
+ declarations: [],
+ imports: [
+ AddonUserProfileFieldCheckboxModule,
+ AddonUserProfileFieldDatetimeModule,
+ AddonUserProfileFieldMenuModule,
+ AddonUserProfileFieldTextModule,
+ AddonUserProfileFieldTextareaModule,
+ ],
+ exports: [],
+})
+export class AddonUserProfileFieldModule { }
diff --git a/src/core/features/mainmenu/pages/more/more.html b/src/core/features/mainmenu/pages/more/more.html
index 84dee2d54..0661d0347 100644
--- a/src/core/features/mainmenu/pages/more/more.html
+++ b/src/core/features/mainmenu/pages/more/more.html
@@ -9,7 +9,7 @@
-
+
{{siteInfo.fullname}}
diff --git a/src/core/features/user/classes/base-profilefield-component.ts b/src/core/features/user/classes/base-profilefield-component.ts
new file mode 100644
index 000000000..4d3a6d830
--- /dev/null
+++ b/src/core/features/user/classes/base-profilefield-component.ts
@@ -0,0 +1,100 @@
+// (C) Copyright 2015 Moodle Pty Ltd.
+//
+// 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 { Component, Input, OnInit } from '@angular/core';
+import { FormGroup, Validators, FormControl } from '@angular/forms';
+
+import { AuthEmailSignupProfileField } from '@features/login/services/login-helper';
+import { CoreUserProfileField } from '@features/user/services/user';
+
+/**
+ * Base class for components to render a user profile field.
+ */
+@Component({
+ template: '',
+})
+export class CoreUserProfileFieldBaseComponent implements OnInit {
+
+ @Input() field?: AuthEmailSignupProfileField | CoreUserProfileField; // The profile field to be rendered.
+ @Input() edit = false; // True if editing the field. Defaults to false.
+ @Input() disabled = false; // True if disabled. Defaults to false.
+ @Input() form?: FormGroup; // Form where to add the form control.
+ @Input() contextLevel?: string; // The context level.
+ @Input() contextInstanceId?: number; // The instance ID related to the context.
+ @Input() courseId?: number; // The course the field belongs to (if any).
+
+ control?: FormControl;
+ modelName = '';
+ value?: string;
+ required?: boolean;
+
+ /**
+ * Component being initialized.
+ */
+ ngOnInit(): void {
+ if (!this.field) {
+ return;
+ }
+
+ if (!this.edit && 'value' in this.field) {
+ this.initForNonEdit(this.field);
+
+ return;
+ }
+
+ if (this.edit && 'required' in this.field) {
+ this.initForEdit(this.field);
+
+ return;
+ }
+
+ }
+
+ /**
+ * Init the data when the field is meant to be displayed without editing.
+ *
+ * @param field Field to render.
+ */
+ protected initForNonEdit(field: CoreUserProfileField): void {
+ this.value = field.value;
+ }
+
+ /**
+ * Init the data when the field is meant to be displayed for editing.
+ *
+ * @param field Field to render.
+ */
+ protected initForEdit(field: AuthEmailSignupProfileField): void {
+ this.modelName = 'profile_field_' + field.shortname;
+ this.required = !!field.required;
+
+ this.control = this.createFormControl(field);
+ this.form?.addControl(this.modelName, this.control);
+ }
+
+ /**
+ * Create the Form control.
+ *
+ * @return Form control.
+ */
+ protected createFormControl(field: AuthEmailSignupProfileField): FormControl {
+ const formData = {
+ value: field.defaultdata,
+ disabled: this.disabled,
+ };
+
+ return new FormControl(formData, this.required && !field.locked ? Validators.required : null);
+ }
+
+}
diff --git a/src/core/features/user/components/user-profile-field/user-profile-field.ts b/src/core/features/user/components/user-profile-field/user-profile-field.ts
index 6a4aae6c5..6bccb4b92 100644
--- a/src/core/features/user/components/user-profile-field/user-profile-field.ts
+++ b/src/core/features/user/components/user-profile-field/user-profile-field.ts
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import { Component, Input, OnInit, Injector, Type } from '@angular/core';
+import { Component, Input, OnInit, Type } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { AuthEmailSignupProfileField } from '@features/login/services/login-helper';
@@ -42,7 +42,6 @@ export class CoreUserProfileFieldComponent implements OnInit {
constructor(
protected userProfileFieldsDelegate: CoreUserProfileFieldDelegate,
- protected injector: Injector,
) { }
/**
@@ -53,7 +52,7 @@ export class CoreUserProfileFieldComponent implements OnInit {
return;
}
- this.componentClass = await this.userProfileFieldsDelegate.getComponent(this.injector, this.field, this.signup);
+ this.componentClass = await this.userProfileFieldsDelegate.getComponent(this.field, this.signup);
this.data.field = this.field;
this.data.edit = CoreUtils.instance.isTrueOrOne(this.edit);
diff --git a/src/core/features/user/pages/about/about.html b/src/core/features/user/pages/about/about.html
index 633ecd788..c2a48db58 100644
--- a/src/core/features/user/pages/about/about.html
+++ b/src/core/features/user/pages/about/about.html
@@ -75,9 +75,9 @@
{{ user.interests }}
-
+
{{ 'core.user.description' | translate}}
diff --git a/src/core/features/user/pages/about/about.page.ts b/src/core/features/user/pages/about/about.page.ts
index 816081331..bd2dd5c8b 100644
--- a/src/core/features/user/pages/about/about.page.ts
+++ b/src/core/features/user/pages/about/about.page.ts
@@ -34,10 +34,10 @@ import { CoreUserHelper } from '@features/user/services/user-helper';
})
export class CoreUserAboutPage implements OnInit {
- protected courseId!: number;
protected userId!: number;
protected siteId: string;
+ courseId!: number;
userLoaded = false;
hasContact = false;
hasDetails = false;
diff --git a/src/core/features/user/services/user-profile-field-delegate.ts b/src/core/features/user/services/user-profile-field-delegate.ts
index 6ec0e6e3d..3f1ec6436 100644
--- a/src/core/features/user/services/user-profile-field-delegate.ts
+++ b/src/core/features/user/services/user-profile-field-delegate.ts
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import { Injectable, Injector, Type } from '@angular/core';
+import { Injectable, Type } from '@angular/core';
import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate';
import { CoreError } from '@classes/errors/error';
@@ -32,10 +32,9 @@ export interface CoreUserProfileFieldHandler extends CoreDelegateHandler {
* Return the Component to use to display the user profile field.
* It's recommended to return the class of the component, but you can also return an instance of the component.
*
- * @param injector Injector.
* @return The component (or promise resolved with component) to use, undefined if not found.
*/
- getComponent(injector: Injector): Type | Promise>;
+ getComponent(): Type | Promise>;
/**
* Get the data to send for the field based on the input data.
@@ -51,7 +50,7 @@ export interface CoreUserProfileFieldHandler extends CoreDelegateHandler {
signup: boolean,
registerAuth: string,
formValues: Record,
- ): Promise;
+ ): Promise;
}
export interface CoreUserProfileFieldHandlerData {
@@ -104,7 +103,6 @@ export class CoreUserProfileFieldDelegate extends CoreDelegate | undefined> {
@@ -112,9 +110,9 @@ export class CoreUserProfileFieldDelegate extends CoreDelegate,
- ): Promise {
+ ): Promise {
const type = this.getType(field);
const handler = this.getHandler(type, !signup);