diff options
author | Jennifer Hodgdon <yahgrp@poplarware.com> | 2012-08-29 11:03:15 -0700 |
---|---|---|
committer | Jennifer Hodgdon <yahgrp@poplarware.com> | 2012-08-29 11:03:15 -0700 |
commit | 634b15e23d770a505df1b2932e1b1e7badc27a10 (patch) | |
tree | bb9edd8460499098c7395a24e7ad1bf59857570a | |
parent | ca06374dc4152349ca3033e74f2b0528421fc5b5 (diff) | |
download | brdo-634b15e23d770a505df1b2932e1b1e7badc27a10.tar.gz brdo-634b15e23d770a505df1b2932e1b1e7badc27a10.tar.bz2 |
Issue #1706926 by Ivan Zugec, eddie_c: Fix docs for theme_tableselect to have working code example
-rw-r--r-- | includes/form.inc | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/includes/form.inc b/includes/form.inc index b6ffc3ca2..f6ef79d8a 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -3254,21 +3254,6 @@ function theme_container($variables) { /** * Returns HTML for a table with radio buttons or checkboxes. * - * An example of per-row options: - * @code - * $options = array(); - * $options[0]['title'] = "A red row" - * $options[0]['#attributes'] = array ('class' => array('red-row')); - * $options[1]['title'] = "A blue row" - * $options[1]['#attributes'] = array ('class' => array('blue-row')); - * - * $form['myselector'] = array ( - * '#type' => 'tableselect', - * '#title' => 'My Selector' - * '#options' => $options, - * ); - * @endcode - * * @param $variables * An associative array containing: * - element: An associative array containing the properties and children of @@ -3276,7 +3261,35 @@ function theme_container($variables) { * and #js_select. The #options property is an array of selection options; * each array element of #options is an array of properties. These * properties can include #attributes, which is added to the - * table row's HTML attributes; see theme_table(). + * table row's HTML attributes; see theme_table(). An example of per-row + * options: + * @code + * $options = array( + * array( + * 'title' => 'How to Learn Drupal', + * 'content_type' => 'Article', + * 'status' => 'published', + * '#attributes' => array('class' => array('article-row')), + * ), + * array( + * 'title' => 'Privacy Policy', + * 'content_type' => 'Page', + * 'status' => 'published', + * '#attributes' => array('class' => array('page-row')), + * ), + * ); + * $header = array( + * 'title' => t('Title'), + * 'content_type' => t('Content type'), + * 'status' => t('Status'), + * ); + * $form['table'] = array( + * '#type' => 'tableselect', + * '#header' => $header, + * '#options' => $options, + * '#empty' => t('No content available.'), + * ); + * @endcode * * @ingroup themeable */ |