Hi guys,
I am wanting to add the parameter map functionality to a trigger that does not currently have it, so I figured it would be a good programing exercise.
Looking through other triggers the parameter map code is kind of inconsistent in how it is used, so I am having a really hard time understanding how to get it working. I want to add this to the Add Design action.
Currently I have the parameter map added, and it shows in the trigger action, but choosing one of the two options (Design ID and Asset id) does not save them.
Here is what I have done:
Added to top of file:
require_once SQ_SYSTEM_ROOT.'/core/attributes/parameter_map/parameter_map.inc';
Added to getInterface function:
$new_prefix = ereg_replace('\[', '_', ereg_replace('\]', '_', $prefix)); hidden_field($prefix.'[new_prefix]', $new_prefix); $param_map_value = array_get_index($settings, 'value_map', serialize(Array())); $param_map_attr = new Asset_Attribute_Parameter_Map(0, $param_map_value); $param_map_attr->setParameter('asset_id', 'Asset ID'); $param_map_attr->setParameter('design_id', 'Design'); $settings['value_map'] = $param_map_attr->value; echo $param_map_attr->paint($new_prefix.'_parameter_map');
Added to execute function:
$value_map = array_get_index($settings, 'value_map', serialize(Array())); $param_map_attr = new Asset_Attribute_Parameter_Map(0, $value_map); $param_map_design_id = $param_map_attr->getParameterValue('design_id'); $param_map_asset_id = $param_map_attr->getParameterValue('asset_id');
Is there another trigger, asset or an example that can let me better understand how to get the parameter functionality working? Right now it is a little fuzzy.
Thanks.