What is the bare minimum hooks / cases to setup a custom cck field and widget? What I'm trying to do here is just a simple select list with 2 options. No validations required.
The database is created, the form field shows, however, the values doesn't get saved to db when i submit.
Any help?
<?php
function zroy_reference_widget_info() {
$option_types = array('zroy_reference');
return array(
'zroy_options_select' => array(
'label' => t('Select list'),
'field types' => $option_types,
),
);
}
function zroy_reference_widget($op, &$node, $field, &$node_field) {
switch ($op) {
case 'form':
$form = array();
$form[$field['field_name']] = array('#tree' => TRUE);
$form[$field['field_name']]['keys'] = array('#type' => 'select',
'#title' => t($field['widget']['label']),
'#multiple' => TRUE,
'#options' => array('1' => 'a', '2' => 'b'),
);
return $form;
break;
}
}
function zroy_reference_widget_settings($op, $widget) {
switch($op) {
case 'form':
$form = array();
return $form;
}
}
function zroy_reference_field_info() {
return array(