Changing a form
The person says: “Add a phone number question to the application form, and look it over before it goes live.”
A form is the forms plugin’s data on the site, not theme code, and the plugin checks every change itself: its refusal comes back in its own words. In a change set the change is held with the form as it was, so it can be read before it is applied and put back after.
The loop
Section titled “The loop”Empress:site_status— the site, and an open change set to put the change in.Empress:changeset_create—titleis the person’s sentence.Empress:site_call—tool: "empress.form_get"withform(its slug) reads the fields and rules as they are; thentool: "empress.form_set"withchangeset:formandaddFields(each field aname,labelandtype,afterto place it), orfieldsfor the complete list, orsettingsfor notification emails and spam protection. With noformit creates one (name,slug,fields).tool: "empress.form_duplicate"copies one.Empress:site_status—section: "changeset"shows the held change in words and what it replaces, with the form as it is now.Empress:changeset_promote— once the person agreed;confirm: true. The plugin applies the change then.
Judgment
Section titled “Judgment”fieldsis the complete list. A field named like an existing one keeps everything you do not restate; a field left out is removed. To add one field, useaddFields; to take one away,removeFields.- Submissions are not touched. A new field is empty on the submissions already stored. Retiring a form keeps its submissions; deleting them is the console’s.
- Retire last, and not while it is on a page.
tool: "empress.form_retire"(needs the person’s yes) is refused while a published page holds the form, and inside a change set. Take the form off the page first. - Check after the yes. Read the form again with
empress.form_get: the plugin applies the change at the promote and may refuse it then, and the promote’s answer says where it stopped. - The undo is the set.
Empress:version_revertwithto: "changeset:<id>"puts the form back as it was; a form the set created is retired by it, which needs an Admin.