It would be really useful if the BackReference settings could be either exported in Features along with the relevant CCK field (so it displays in hook_content_default_fields), or if it was selectable as a component to be manually exported; in the interest of simplicity I think the former approach would be best.

Comments

damienmckenna’s picture

Title: Features support » Features / CTools Export support
Status: Active » Needs review
StatusFileSize
new2.91 KB

How's about this? I tried to take simple approach - it uses the CTools export functionality, the 'field_left' field is used as the primary key, and the list of items on the components page is provided as "$field_left -> $field_right". Good enough for now?

damienmckenna’s picture

StatusFileSize
new2.24 KB

Had accidentally included some unnecessary example code in the last patch.

damienmckenna’s picture

StatusFileSize
new2.21 KB

Here's a better patch that fixes a bug in backreference_backreference_field_symmetry_list() (no arguments are needed when overriding the default hook_[table]_list() call) and cleans up the export strings.

damienmckenna’s picture

StatusFileSize
new2.21 KB

A slight tweak to the patch to change the list row name to the format "[left] to [right]".

damienmckenna’s picture

StatusFileSize
new2.21 KB

Forgot to update a comment.

aron novak’s picture

Title: Features / CTools Export support » Better CTools Export support
Category: feature » task
Status: Needs review » Needs work

Thanks, I committed it to the 6.x branch, i tested and works fine. It's really important to be able to put config in code for all modules, very valuable effort!

I'd see one thing to improve: do you think it's possible to somehow make a dependency between the content-type and the backreference configuration? So when a user selects a content type for export what contains a backreference setting, that setting is automatically added without the need of selecting it manually. Do you think it makes sense?

aron novak’s picture

Status: Needs work » Active
damienmckenna’s picture

Thanks Aron.

I haven't looked into Features' APIs that much, but I think it'd be better to have it automatically attach to the fields rather than the content type.

aron novak’s picture

Right, i think for the perfect solution, we need to achieve automatic attach to the proper field.
Do you know any good documentation on CTools Export API? I haven't found anything yet. Of course it's always possible to read the source, but maybe there is some pre-processed knowledge somewhere :)