Paginate options in checkbox of a form field I have a custom form with a field of type checkboxes,options for which I am getting from another function which takes an array as input, do some theming on options value and return options back to form,

Here is how my another function looks like

function mymodule_twitter_accounts_as_options($twitter_accounts) {
  $options = array();
  if (is_array($twitter_accounts)) {
    foreach ($twitter_accounts as $twitter_account) {
      $key = $twitter_account-&gt;twitter_id;
      $options[$key] = theme('image', array('path' =&gt; $twitter_account-&gt;profile_image_url)) . mymodule_twitter_account_basic_info_block1($twitter_account) . mymodule_twitter_account_basic_info_block2($twitter_account);
    }
  } return $options;
}


The array $twitter_accounts is coming from a database query, which is extending drupal pagination but I do not think the extended pagination will be helpful here as I need to show a global pagination for all the options rendered in the form later.

Edit:

The reason I am using a form is only because of the reason that once user checks checkboxes and submit the form, I am doing some operations using checkboxes key values, If there is an alternate to use of custom form that will be good too.
Might be no one will land up here,still adding the answer and foolish doubts I had

The pagination done for query to get options works! .

The reason I was in doubt before was because of using the query results as option of checkbox field, the time I added themed the pager while rendering the form, I got the pager which worked out of the box!

How I figured out if pagination working with the query was by adding ?page=1 in the url manually which changed the checkboxes , it ensured me I just have to theme the global pager :) .