field['field_name']; $field_type = $this->field['type']; $field_table = $this->field['settings']['chado_table']; $field_column = $this->field['settings']['chado_column']; $widget['value'] = array( '#type' => 'value', '#value' => array_key_exists($delta, $items) ? $items[$delta]['value'] : '', ); $widget['chado-feature__seqlen'] = array( '#type' => 'value', '#value' => 0, '#title' => $element['#title'], '#description' => $element['#description'], '#weight' => isset($element['#weight']) ? $element['#weight'] : 0, '#delta' => $delta, ); } /** * Performs validation of the widgetForm. * * Use this validate to ensure that form values are entered correctly. Note * this is different from the validate() function which ensures that the * field data meets expectations. * * @param $form * @param $form_state */ public function validate($form, &$form_state, $entity_type, $entity, $langcode, $delta) { } /** * * @see TripalFieldWidget::submit() */ public function submit($form, &$form_state, $entity_type, $entity, $langcode, $delta) { $field_name = $this->field['field_name']; $field_type = $this->field['type']; $field_table = $this->field['settings']['chado_table']; $field_column = $this->field['settings']['chado_column']; // Get the residues so we can calculate teh length. $residues = $form_state['values']['feature__residues']['und'][0]['chado-feature__residues']; // Remove any white spaces. if ($residues) { $residues = preg_replace('/\s/', '', $residues); $form_state['values']['feature__residues']['und'][0]['chado-feature__residues'] = $residues; $items[0]['chado-feature__seqlen'] = strlen($residues); } else { $items[0]['chado-feature__seqlen'] = '__NULL__'; } } }