Skip to content

Commit

Permalink
feat: add _disable parameter for disabling fields (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Feb 5, 2024
1 parent 233d6d1 commit 44f6084
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions layouts/partials/decap-cms/functions/deep-merge.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@
{{- $fieldName := .name }}
{{- $field := partial "decap-cms/functions/dict2scratch" . }}
{{- $currentWeight := $field.Get "_weight" }}
{{/* Ignore disabled field. */}}
{{- if default false ($field.Get "_disable") }}
{{- if isset $values $fieldName }}
{{- $newValues := newScratch }}
{{- $newValues.Set "v" $values }}
{{- $newValues.DeleteInMap "v" $fieldName }}
{{- $values = $newValues.Get "v" }}
{{- end }}
{{- continue }}
{{- end }}
{{- if isset $values $fieldName }}
{{- with $currentWeight }}
{{/* Override the weight if presents and belongs to the last collection. */}}
Expand Down

0 comments on commit 44f6084

Please sign in to comment.