2

I am developing a custom field type which needs to display fields from two different channels in the CP Edit and Publish pages. Users of this field type will need to edit the data from those different channels.

When the data is from a text field it is relatively easy to display it and allow users to edit. However this gets more difficult if I need to display data from a relationship field.

I have read through the developer add-on docs but can't figure out a method of displaying data using another field type within my own. Is there a way of displaying another field type within my custom one?

1 Answer 1

3

Each field type stores it's data differently, some custom add-ons will create one or more extra tables to store fieldtype data for entries. For instance, Matrix will create a table: exp_matrix_cols and exp_matrix_data to store column settings and data that will populate those columns.

Relationships (I'm assuming you're talking about stock EE) are in the exp_relationships table and the data stored in the rel_data column is actually a serialized channel entry object (yuck).

Playa in contrast, uses an association table that will link entries to other entries in a table called exp_playa_relationships.

As far as I know, there's no easy API to get a complete entry and all of its custom field data. So you'll have to target in advance the field types you want to support and investigate how each field type stores the data. Then your add-on logic will have to detect the fieldtype and run custom logic to pull the data specific to the field type.

2
  • Yes, I was going down the route of adding my own custom logic to detect field types and pull in the data. Just couldn't help thinking here was easier way! Thanks for your answer though - I think it confirms that I was doing the right thing after all and there isn't an API for this. Feb 18, 2013 at 19:42
  • Thanks for accepting the answer Anthony! Good luck, it sounds like an interesting add-on! Hope to see it on Devot:ee :) Feb 20, 2013 at 15:52

Your Answer

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

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