<div *ngIf="form" [formGroup]="form">
  <label *ngIf="setting.label && setting.type !== 'input-checkbox'" [attr.for]="setting.name" [innerHTML]="setting.label"></label>

  <my-peertube-checkbox
    *ngIf="setting.type === 'input-checkbox'"
    [inputName]="setting.name"
    [formControlName]="setting.name"
    [labelInnerHTML]="setting.label"
  ></my-peertube-checkbox>

  <div *ngIf="setting.descriptionHTML" class="label-small-info" [innerHTML]="setting.descriptionHTML"></div>

  <input *ngIf="setting.type === 'input'" type="text" [id]="setting.name" [formControlName]="setting.name" />

  <div *ngIf="setting.type === 'select'" class="peertube-select-container">
    <select  [id]="setting.name" [formControlName]="setting.name" class="form-control">
      <option *ngFor="let option of setting.options" [value]="option.value">{{ option.label }}</option>
    </select>
  </div>

  <my-input-text *ngIf="setting.type === 'input-password'" [formError]="formErrors['settings.name']" [formControlName]="setting.name" [inputId]="setting.name"></my-input-text>

  <textarea *ngIf="setting.type === 'input-textarea'" type="text" [id]="setting.name" [formControlName]="setting.name"></textarea>

  <my-help *ngIf="setting.type === 'markdown-text'" helpType="markdownText"></my-help>

  <my-help *ngIf="setting.type === 'markdown-enhanced'" helpType="markdownEnhanced"></my-help>

  <my-markdown-textarea
    *ngIf="setting.type === 'markdown-text'"
    markdownType="text" [id]="setting.name" [formControlName]="setting.name"
    [formError]="formErrors['settings.name']"
  ></my-markdown-textarea>

  <my-markdown-textarea
    *ngIf="setting.type === 'markdown-enhanced'"
    markdownType="enhanced" [id]="setting.name" [formControlName]="setting.name"
    [formError]="formErrors['settings.name']"
  ></my-markdown-textarea>

  <div *ngIf="setting.type === 'html'" [innerHTML]="setting.html"></div>

  <div *ngIf="hasDedicatedFormError() && formErrors[setting.name]" class="form-error" role="alert">
    {{ formErrors[setting.name] }}
  </div>

</div>
