drupaldrupal-7drupal-nodesdrupal-content-typesdrupal-schema

Add custom field to content type


I create content type tv-rate-plus-ethernet via admin panel, now I neeed add to this content type custom field channel_reference, where channel_reference field return checkboxes list with channel data from custom table ks_channel.

Example we have list of tv channels in our cutom table in DB and we want show in content type list of this chanels with checkbox, how I can do this?


Solution

  • A direct answer to you question would be to use the Field API in order to create you custom field which will provide the specific interface (checkboxes) that you describe. Field API also provides you the means to load data to your widget from whatever database table you wish. However, the above process might be an overkill for what you need to accomplish.

    A quick workaround would be something similar to what Brad Fellows proposed. You can import your external table data as drupal nodes, via Feeds or Migrate modules. This way your data will be fully managed by Drupal and you can use the entity reference module which can be combined with a variety of multiselect widgets including the default 'checkboxes/radio buttons' which will provide what you need.