我正在尝试让#states在drupal上工作,我有一个选择字段,例如:
$form['options'][$default_set_id]['none']['order_fields'][$field_name] = array(
'#type' => $widget_types[$order_field['widget']['type']],
'#suffix' => '<div class="field-description">' . $order_field['description'] . '</div>',
'#title' => $order_field['label'],
'#default_value' => '',
'#options' => field_info_field($field_name)['settings']['allowed_values']
);
和我需要#states的字段:
$form['options'][$default_set_id]['none']['order_fields'][$field_name] = array(
'#type' => $widget_types[$order_field['widget']['type']],
'#suffix' => '<div class="field-description">' . $order_field['description'] . '</div>',
'#title' => $order_field['label'],
'#default_value' => isset($current_options['order_fields'][$field_name]) ? $current_options['order_fields'][$field_name] : '',
'#states' => array(
'visible' => array(
':select[name="field_transport_rdv"]' => array('value' => 'autre'),
)
)
);
我正在做所有事情,就像在Internet上找到的文档和示例中一样,但似乎行不通,任何人都有想法吗?