bw_register_field( "_oik_hook_type", "select", "Hook type", array( "#options" => oiksc_hook_types()) ); bw_register_field_for_object_type( "_oik_hook_type", "oik-hook" );Each field has three basic attributes – which are passed as parameters to bw_register_field
-
name – the field name e.g. “_oik_hook_type”
type – the field type e.g. “select”
label – the field label e.g. “Hook type”
| attribute | description | default |
|---|---|---|
| #class | CSS class name(s) for the form field | |
| #extras | additional HTML parameters | |
| #form | boolean. True if the field is to be displayed on a form created by bw_new. False otherwise | true |
| #length | number of characters in a text field | 10 for numeric, 40 for text |
| #multiple | Number of rows to display in a multiple select field. Set to 0 for single select | 0 |
| #optional | boolean value. True if the field is optional, false if required. | |
| #options | array of options for a select field | none |
| #required | true if the field is required. | false |
| #theme | boolean value. True if the field may be displayed to the end user | true |
| #type | post_type or array of post_types for noderef field type | post_type to which the field is associated |
| #validate | callback function to perform field validation |
