2

I am developing a module that sync selected nodes with an outside site (another API on the web). I need to add some meta-data to each node:

  • Last sync time (timestamp) - Not editable through UI
  • Outside API ID for this item - Not editable through UI
  • Sync enabled for this node (yes/no) - Editable through UI

Should I have my module create a new table through the Drupal Database API to store this data, or should I use the Field API?

1 Answer 1

3

Your requirement seems pretty straight forward. If you want to save some time, I would suggest that you use the Field API. To make those fields non-editable by users and administrators, all you need to do is implement a hook_form_alter and hide the form elements. You can also implement hook_form_FORM_ID_alter, which I find more efficient.

Example. Hide the author field:

$form['author']['#access'] = FALSE;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.