Hi, I am using OA and the last CT Plus. I've tried to localize the Status values by changing the CCK field (modifying and adding new values), but now, when I add a new task I get errors like this one:

"Illegal choice Duplicate in field_ct_plus_status_value_many_to_one element."

Looking at sources I see:

'field_ct_plus_status_value_many_to_one' => array(
'operator' => 'or',
'value' => array(
'Open' => 'Open',
'Resolved' => 'Resolved',
'Deferred' => 'Deferred',
'Duplicate' => 'Duplicate',
),

Does it mean I can not localize the Status field? Or add more values, without changing the sources?

Comments

danepowell’s picture

The first thing that we need to determine here is where the error is coming from. It looks like it's actually coming from Views, not from CCK- do you have any thoughts on that?

Some more info that might help: is the node still successfully created? What "sources" are you referring to (where you see 'field_ct_plus_status_value_many_to_one' => array(...)?

Generally speaking, when overriding a Feature, it's best to do so through code hooks rather than through the GUI. This obviates the need to fork the feature code ("changing the sources" as you describe), and makes upgrading to newer version of the feature much easier.

In concrete terms, that means that the best way to achieve what you want is to write a small module that implements a hook that will modify the CCK values as you wish, but without making any actual changes to the ct-plus-task content type or the CT Plus feature. I'll try to find or write a small tutorial on how to accomplish this.

danepowell’s picture

Here we go- I think that you'll want to create a new module, named ct_plus_custom for instance. Then use hook_content_default_fields_alter(&$fields) like so:

<?php
function ct_plus_custom_content_default_fields_alter(&$fields) {
  dpm($fields);
}

This will print out the $fields variable, which will include the ct_plus_task-field_ct_plus_status field. You should be able to modify the allowed fields in this array to your heart's content :)

Of course this still might not explain the source of your error.

danepowell’s picture

I've also placed a section on the project page that describes and links to resources that might help you in the customization process.

carlos.macao’s picture

Hi, thank you for your fast answer.

After I rolled back my changes, done in CCK fields on the original values (Open Resolved....Bug, Feature Request, General Task) the error disappeared.

I will implement your hook solution.

danepowell’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

tazus’s picture

I am sorry, but I can't find the page that describe the customization for localized status/type and priority? Thanks.

danepowell’s picture

Look at the project page, specifically the link to the "guide to customizing atrium"