Hi,
I'm new to Drupal and I'm looking to create a customized field that can plug into an existing content type. I'm basically trying to set up a list of input field rows with 3 columns and I'm encountering a few problems for little things that seem like they should be simple enough.
I have the following to implement the hook_widget() to build up my form for user editing:
<?php
function ingredients_widget($op, &$node, $field, &$items, $delta = NULL) {
switch ($op) {
case 'form':
$form = array();
$form[$field['field_name']]['#tree'] = TRUE;
$form['#attributes'] = array('class' => 'container-ingredients');
$form['#theme'] = array('ingredients_form_fieldgroup');
$form[$field['field_name']]['value'] = build_ingredient_input_fields();
$form[$field['field_name']]['#title'] = $field['widget']['label'];
return $form;
}
}
function build_ingredient_input_fields() {
$form['ingredients']['quantity'] = array(
'#type' => 'textfield',
'#title' => t('Quantity'),
'#maxlength' => 8,
'#size' => 8,
);
$form['ingredients']['units'] = array(
'#type' => 'select',
'#title' => t('Units'),
'#options' => array(0 => t('option 1'), 1 => t('option 2')),