Cakephp插件过滤器重命名选择

Cakephp插件过滤器重命名选择,php,cakephp,plugins,cakephp-2.1,Php,Cakephp,Plugins,Cakephp 2.1,我有一个插件过滤器安装从 如何重命名下拉栏中的值 现在我可以选择: [ ] [0] [1] 我需要的是: [ ] [Agent] [Investor] 在选择器类型中,我想将0重命名为Agent,将1重命名为Investor。自己查找: //插件代码------>过滤器\u表单\u字段 foreach ($viewFilterParams as $field) { // Edited on 28-03-2013 // check if option

我有一个插件过滤器安装从

如何重命名下拉栏中的值

现在我可以选择:

[ ]
[0]
[1]
我需要的是:

[ ]
[Agent]
[Investor]

在选择器类型中,我想将0重命名为Agent,将1重命名为Investor。

自己查找:

//插件代码------>过滤器\u表单\u字段

  foreach ($viewFilterParams as $field) {
        // Edited on  28-03-2013 
        // check if option type is select.
        if ($field['options']['type'] == "select") {
            // check for all option values ( 0,1,2,3,4 ect ) and rename it with optionNewValue
            foreach ($field['options']['options'] as $optionvalue) {
                $optionNewValue = $field['options']['OptionKey'][$optionvalue];
                // Rename the optionvalue
                $field['options']['options'][$optionvalue] = $optionNewValue;
            }
        }
//filtercomponent.ctp添加(插件代码)

//Optionkey提供值过滤器\表单\字段 //在控制器内部使用Optionkey=>array()重命名值 $options['OptionKey']=$settings['OptionKey']

现在你可以把控制器放进去了

'index' => array(
        'Model' => array( 
            'Model.Tablename' => array('label' => 'Find'),
            'Model.Tablename' => array(
                'label' => 'Position type',
                 'type' => 'select',
                'OptionKey' => array (
                    0 => 'agent',
                    1 => 'investor'

            )
        )
    )
);
:D:D:D:D:D

'index' => array(
        'Model' => array( 
            'Model.Tablename' => array('label' => 'Find'),
            'Model.Tablename' => array(
                'label' => 'Position type',
                 'type' => 'select',
                'OptionKey' => array (
                    0 => 'agent',
                    1 => 'investor'

            )
        )
    )
);