Piranha.core: Default values for field

Created on 12 Jan 2019  路  3Comments  路  Source: PiranhaCMS/piranha.core

I want to create a new field (checkbox) for all my pages and to be able to disable something. but the field content shouldn't be "disable", thats why i need a default value. Is this possible?

I tried with

[Field(Title = "Feature Enabled", Options = Piranha.Models.FieldOption.HalfWidth)]
public Piranha.Extend.Fields.CheckBoxField Enabled { get; set; } = true;

Any suggestion or do i need to introduce the negative field like "disable"?

duplicate request

Most helpful comment

Since the Create() method

  1. Creates the model
  2. Creates all fields for the model

we would need to introduce a DefaultValue properties on the FieldAttribute

All 3 comments

Since the Create() method

  1. Creates the model
  2. Creates all fields for the model

we would need to introduce a DefaultValue properties on the FieldAttribute

I also have the same requirement so this would be useful.

Closing this in favor of #1233 which would enable this functionality.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aneff-official picture aneff-official  路  6Comments

OmidID picture OmidID  路  3Comments

gerardvanderkruijs picture gerardvanderkruijs  路  4Comments

baibhavs picture baibhavs  路  3Comments

SamBray picture SamBray  路  3Comments