Skip to content
hertsch edited this page Jul 7, 2014 · 1 revision
  1. Introduction
  2. field section

##Introduction

All Contact forms are flexible and can be adapted to your needs, so you can add or remove fields, change the order and properties of the fields.

Contact is storing the definition for the contact forms in

/kit2/extension/phpmanufaktur/phpManufaktur/Contact/config.contact.json

this configuration file will be created at the first call of Contact. If you are updating Contact the configuration file will be extended and changed if needed but your settings will be never overwritten.

The field settings for the contact dialog in the Contact backend are stored in the sections

"dialog": {
  "contact": {
    "person": {
      "field": {
        ...
      }
    }
  }
}

and

"dialog": {
  "contact": {
    "company": {
      "field": {
        ...
      }
    }
  }
}

for the both contact types PERSON and COMPANY. The field section which contains the field definition is described in the next chapter.

For the registering of public contacts the settings are also stored in the config.contact.json but in the section:

"command": {
  "register": {
    "field": {
      ...
    }
  }
}

the register dialog cover both contact types PERSON and COMPANY.

The configuration file is formatted in JSON Data Interchange Standard.

You can also change Contact forms which are embedded in other extensions, just look where the extension is storing the Contact field definition.

##field section

The field section is the parent for the following sections:

the special section is optional, all other sections must exists and be defined as array, also if they don't contain any values.

###predefined

The predefined section tell the dialog that the fields which are defined there must always exists and the data array which is submitted to the dialog must contain valid values for the defined fields.

The dialog to register public contacts is using this section:

"predefined": [
  "contact_type",
  "category_id"
],

this mean that the dialog expect a valid contact_type (PERSON or COMPANY) and a valid category_id.

###visible

All fields you are specifying in this section will be visible in the dialog. The order of the fields is also the order in which the fields are shown in the dialog.

You can specify all available fields in this section.

"visible": [
  "person_gender",
  "person_first_name",
  "person_last_name",
  "company_name",
  "company_department",
  "communication_email",
  "communication_url",
  "address_street",
  "address_zip",
  "address_city",
  "address_country_code"
],

In a dialog for the contact type PERSON the dialog will show the following fields:

  • person_gender
  • person_first_name
  • person_last_name
  • communication_email
  • communication_url
  • address_street
  • address_zip
  • address_city
  • address_country_code

and in a dialog for the contact type COMPANY the dialog will show the following fields:

  • company_name
  • company_deparment
  • communication_email
  • communication_url
  • address_street
  • address_zip
  • address_city
  • address_country_code

###required

Fields which are listed in the section required and also exists in the section visible will be marked in the dialog as required, which mean that they will be marked with an additional asterisk *, the dialog will also lock if there is missing a valid input for the desired field.

"required": [
  "person_gender",
  "person_last_name",
  "company_name"
],

will mark the fields

  • person_gender
  • person_last_name
  • company_name

as required.

The fields communication_email and contact_login will be automatically marked as required because they are always needed.

###hidden

Fields which are listed in the section hidden will be placed as hidden fields in the dialog and are not visible for the visitor.

"hidden": [
  "contact_id",
  "contact_type",
  "category_id",
  "category_type_id",
  "person_id",
  "company_id",
  "address_id"
],

most fields specified in this section will be needed for a proper execution of the dialog and will be predefined by the extension which is using this dialog.

###readonly

Fields which are listed in the section readonly and also exists in the section visible will be shown as read only which mean that the user can see but not change the value of the desired field.

"readonly": [
  "contact_status",
  "category_name"
],

will show the contact status and the category desired to the contact, but the user can not change the status and the category.

###tags

If you are using the tags field in the visible section, the selection list will show all available #tags. If you specify #tags in the section tags only these #tags will be shown in the selection list:

"tags": [
  "newsletter",
  "tipps"      
]

will only show the #tags with the name #newsletter and #tipps.

###special

Extension can use the special section to inject additional fields into the contact dialog, i.e. the register dialog for public contacts is using a special field to show a checkbox to accept the terms and conditions of the website:

"special": {
  "terms_and_conditions": {
    "enabled": true,
    "name": "special_terms",
    "type": "checkbox",
    "required": true,
    "label": "Accept our terms \u003Ca href=\"http:\/\/domain.tld\"\u003Eand\u003C\/a\u003E conditions",
    "data": false
  }
}

the settings of the special fields depends on the desired extension.