diff --git a/src/addon/mod/data/fields/url/component/addon-mod-data-field-url.html b/src/addon/mod/data/fields/url/component/addon-mod-data-field-url.html
index 90283fe72..7d2c37bec 100644
--- a/src/addon/mod/data/fields/url/component/addon-mod-data-field-url.html
+++ b/src/addon/mod/data/fields/url/component/addon-mod-data-field-url.html
@@ -4,4 +4,7 @@
-{{value.content}}
\ No newline at end of file
+
+ {{ displayValue }}
+ {{ displayValue }}
+
\ No newline at end of file
diff --git a/src/addon/mod/data/fields/url/component/url.ts b/src/addon/mod/data/fields/url/component/url.ts
index 14dd7f62b..175f12096 100644
--- a/src/addon/mod/data/fields/url/component/url.ts
+++ b/src/addon/mod/data/fields/url/component/url.ts
@@ -24,6 +24,9 @@ import { AddonModDataFieldPluginComponent } from '../../../classes/field-plugin-
})
export class AddonModDataFieldUrlComponent extends AddonModDataFieldPluginComponent {
+ protected autoLink = false;
+ protected displayValue = '';
+
constructor(protected fb: FormBuilder) {
super(fb);
}
@@ -43,4 +46,36 @@ export class AddonModDataFieldUrlComponent extends AddonModDataFieldPluginCompon
this.addControl('f_' + this.field.id, value);
}
+
+ /**
+ * Calculate data for show or list mode.
+ */
+ protected calculateShowListData(): void {
+ if (!this.value || !this.value.content) {
+ return;
+ }
+
+ const url = this.value.content;
+ const text = this.field.param2 || this.value.content1; // Param2 forces the text to display.
+
+ this.autoLink = parseInt(this.field.param1, 10) === 1;
+
+ if (this.autoLink) {
+ this.displayValue = text || url;
+ } else {
+ // No auto link, always display the URL.
+ this.displayValue = url;
+ }
+ }
+
+ /**
+ * Update value being shown.
+ */
+ protected updateValue(value: any): void {
+ super.updateValue(value);
+
+ if (this.isShowOrListMode()) {
+ this.calculateShowListData();
+ }
+ }
}