Wp gf field update (WP-CLI)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
$ wp help gf field update

NAME

  wp gf field update

DESCRIPTION

  Updates a field.  If it doesn't exist, creates it.

SYNOPSIS

  wp gf field update <form-id> <field-id> [--<field>=<value>] [--field-json=<field-json>]

Voorbeeld (1)

$ wp gf field list 2 # See fields of form with ID=2

+----+------------+-------------------------+
| id | type       | label                   |
+----+------------+-------------------------+
| 2  | text       | Naam                    |
| 5  | email      | E-mailadres             |
| 16 | text       | Telefoonnummer          |
| 11 | textarea   | Vraag of opmerking      |
+----+------------+-------------------------+


$ wp gf field update 2 2 --label="Name"

Success: Field ID: 2 updated


$ wp gf field list 2

+----+------------+-------------------------+
| id | type       | label                   |
+----+------------+-------------------------+
| 2  | text       | Name                    |
| 5  | email      | E-mailadres             |
| 16 | text       | Telefoonnummer          |
| 11 | textarea   | Vraag of opmerking      |
+----+------------+-------------------------+

Voorbeeld (2)

$ wp gf field list 2

+----+------------+-------------------------+
| id | type       | label                   |
+----+------------+-------------------------+
| 2  | text       | Name                    |
| 5  | email      | E-mailadres             |
| 16 | text       | Telefoonnummer          |
| 11 | textarea   | Vraag of opmerking      |
+----+------------+-------------------------+

$ wp gf field get 2 2   # Layout reply door mij aangepast!

{
        "type":"text",
	"id":2,
	"label":"Name",
	"adminLabel":"",
	"isRequired":false,
	"size":"medium",
	"errorMessage":"",
	"visibility":"visible",
	"inputs":null,
	"formId":2,
	"description":"",
	"allowsPrepopulate":false,
	"inputMask":false,
	"inputMaskValue":"",
	"inputMaskIsCustom":false,
	"maxLength":"",
	"inputType":"",
	"labelPlacement":"",
	"descriptionPlacement":"",
	"subLabelPlacement":"",
	"placeholder":"",
	"cssClass":"field-33 field-left",
	"inputName":"",
	"noDuplicates":false,
	"defaultValue":"",
	"choices":"",
	"conditionalLogic":"",
	"productField":"",
	"enablePasswordInput":"",
	"multipleFiles":false,
	"maxFiles":"",
	"calculationFormula":"",
	"calculationRounding":"",
	"enableCalculation":"",
	"disableQuantity":false,
	"displayAllCategories":false,
	"useRichTextEditor":false,
	"pageNumber":1,
	"fields":"",
	"displayOnly":""
}

$ wp gf field update 2 2 --description="Updated description!"

$ wp gf field get 2 2

{
	"type":"text",
	"id":2,
	"label":"Name",
	"adminLabel":"",
	"isRequired":false,
	"size":"medium",
	"errorMessage":"",
	"visibility":"visible",
	"inputs":null,
	"formId":2,
	"description":"Updated description!",
	"allowsPrepopulate":false,
	"inputMask":false,
	"inputMaskValue":"",
	"inputMaskIsCustom":false,
	"maxLength":"",
	"inputType":"",
	"labelPlacement":"",
	"descriptionPlacement":"",
	"subLabelPlacement":"",
	"placeholder":"",
	"cssClass":"field-33 field-left",
	"inputName":"",
	"noDuplicates":false,
	"defaultValue":"",
	"choices":"",
	"conditionalLogic":"",
	"productField":"",
	"enablePasswordInput":"",
	"multipleFiles":false,
	"maxFiles":"",
	"calculationFormula":"",
	"calculationRounding":"",
	"enableCalculation":"",
	"disableQuantity":false,
	"displayAllCategories":false,
	"useRichTextEditor":false,
	"pageNumber":1,
	"fields":"",
	"displayOnly":""
}