field_id; $user_contact = "user/" . $node->uid . "/contact"; $item_content = '' . t('Send e-mail to user') . '
' ; $item_content .= t('A link to your contact form will be inserted'); $output = form_item($field->label,$item_content); $output .= form_hidden($fieldname, $user_contact); return $output; } function flexinode_field_contact_db_select($field) { $fieldname = 'flexinode_'. $field->field_id; return $fieldname .'.textual_data AS '. $fieldname; } function flexinode_field_contact_db_sort_column($field) { return 'flexinode_'. $field->field_id .'.textual_data'; } function flexinode_field_contact_insert($field, $node) { $fieldname = 'flexinode_'. $field->field_id; db_query("INSERT INTO {flexinode_data} (nid, field_id, textual_data) VALUES (%d, %d, '%s')", $node->nid, $field->field_id, $node->$fieldname); } function flexinode_field_contact_validate($field, $node) { $fieldname = 'flexinode_'. $field->field_id; // If the URL is empty, or it validates as an absolute URL, or it validates // as a relative URL, the URL is considered valid. if (empty($node->$fieldname) || valid_url($node->$fieldname, true) || valid_url($node->$fieldname)) { return array('value' => $node->$fieldname); } // If none of the above was true, the URL is invalid. return array('value' => $node->$fieldname, 'error' => t('The contact link is not valid.')); } function flexinode_field_contact_format($field, $node, $brief = 0) { if (module_exist('contact')) { $fieldname = 'flexinode_'. $field->field_id; $output = check_plain($node->$fieldname); return $output ? ''. t("Send e-mail to user") .'' : ''; } } /** * @addtogroup themeable * @{ */ /** * Format a single-line text field for display in a node. * * @param field_id * Which field is being displayed (useful when overriding this function * if you want to style one particular field differently). * @param label * The label for the field as displayed on the node form. * @param value * The value that the user entered for the field. * @param formatted_value * The value that the user entered for the field as pre-formatted by the module. */ function theme_flexinode_contact($field_id, $label, $value, $formatted_value) { return theme('form_element', $label, $formatted_value); } /** @} End of addtogroup themeable */ ?>