I am trying to create a related field on the Users module that allows you to select a location. Here is my custom vardef code:
$dictionary['User']['fields']['building_id'] = array (
'name' => 'building_id',
'vname' => 'LBL_BUILDING_ID',
'type' => 'id',
'required' => false,
);
$dictionary['User']['fields']['building_name'] = array (
'source' => 'non-db',
'name' => 'building_name',
'vname' => 'LBL_BUILDING',
'type' => 'relate',
'inline_edit' => true,
'reportable' => true,
'id_name' => 'building_id',
'module' => 'FP_Event_Locations',
'table' => 'fp_event_locations',
'rname' => 'name',
'studio' => 'visible',
'link' => 'building_link',
'source' => 'non-db',
'side' => 'right',
);
$dictionary['User']['fields']['building_link'] = array (
'source' => 'non-db',
'name' => 'building_link',
'vname' => 'LBL_BUILDING',
'type' => 'link',
'link_type' => 'one',
'side' => 'right',
'relationship' => 'user_building',
'bean_name' => 'FP_Event_Locations',
'module' => 'FP_Event_Locations',
'id_name' => 'building_id',
);
$dictionary['User']['relationships']['user_building'] = array(
'lhs_module' => 'Users',
'lhs_table' => 'users',
'lhs_key' => 'building_id',
'rhs_module' => 'FP_Event_Locations',
'rhs_table' => 'fp_event_locations',
'rhs_key' => 'id',
'relationship_type' => 'one-to-many',
);
The building_name field is added to both my edit and detail views.
After doing a rebuild, the field appears, and I am able to select a location, but after saving, the building_id field in the users table ends up being the user id. Can anyone see the problem?
Using 7.11.4