form_checkbox()

Главные вкладки

Аватар пользователя fl00r fl00r 23 августа 2006 в 14:49

taxonomy_menu пользует видимо давно забытую функцию form_checkbox;
<?php
$form .= form_checkbox(t('Display descendants'), 'taxonomy_menu_display_descendants', 1, variable_get('taxonomy_menu_display_descendants', 1), t('If checked, then when a term is selected all nodes belonging to subterms are also displayed.'));
?>
Сам написать не имею возможности, так как понять предназначение некоторых арументов не могу.
Но... и не надо.

вопрос такой. Какой функцией можно вручную переопределить переменную ('taxonomy_menu_display_descendants'). В базе я ее не нашел.

Комментарии

Аватар пользователя fl00r fl00r 23 августа 2006 в 15:15

ok, разобрался.
<?php
$form .= form_checkbox(t('Show "%vocab" in menu', array('%vocab' => t($vocabulary->name))), 'taxonomy_menu_show_' . $vocabulary->vid, 1, variable_get('taxonomy_menu_show_' . $vocabulary->vid, 1));
?>

переписываем как

<?php
$form['taxonomy_menu_show_' . $vocabulary->vid] = array(
'#type' => 'checkbox',
'#title' => t('Show "%vocab" in menu', array('%vocab' => t($vocabulary->name))),
'#default_value' => variable_get('taxonomy_menu_show_' . $vocabulary->vid, 1),
'#description' => t('If checked, then when a term is selected all nodes belonging to subterms are also displayed.'),
);
?>

подробности
http://drupal.org/node/37680