Artyom  Kondra
Artyom Kondra

Reputation: 105

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?

Upvotes: 1

Views: 679

Answers (2)

Giannis Pagonas
Giannis Pagonas

Reputation: 36

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.

Upvotes: 2

Brad Fellows
Brad Fellows

Reputation: 181

Add a content type for Channels and add your list of channels as Channel nodes.

Then you can add a Entity Reference field to the tv-rate-plus-ethernet type. Set it to reference Channel nodes only and allow multiple select. Should achieve what you are after.

Entity reference is available here for Drupal 7 https://www.drupal.org/project/entityreference

Upvotes: 0

Related Questions