Ich benutze Ctools Dependency, um ein Fieldset verdeckt zu machen. Dies ist Teil meines Code:Drupal: Wie mache ich ein Fieldset abhängig von CTools
$form['profile-status'] = array(
'#type' => 'radios',
'#title' => '',
'#options' => array(
'new' => t('Create a new profile.'),
'select' => t('Use an existing profile.'),
),
);
$form['select'] = array(
'#type' => 'select',
'#title' => t('Select a profile'),
'#options' => $options,
'#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:profile-status' => array('select')),
);
$form['profile-properties'] = array(
'#type' => 'fieldset',
'#title' => t('View the profile'),
'#process' => array('ctools_dependent_process'),
'#dependency' => array('radio:profile-status' => array('select')),
'#input' => true,
);
In Snippet oben, gibt es zwei Elemente, ein wählen und ein Fieldset. Beide haben # Prozess- und # Abhängigkeitsparameter und beide zeigen auf ein Feld für den abhängigen Wert. Problem ist, dass Elemente wie Select oder Textfield leicht versteckt werden können, aber nicht für Fieldset. In this Support-Anfrage Seite, hat CTools Creator erwähnt, dass '#input' => true
ist ein Problem. Wie Sie sehen, habe ich es dem Code hinzugefügt, aber es funktioniert nicht so gut.
Haben Sie Vorschläge?