You are here

function context_condition_menu::condition_form in Context 7.3

Same name and namespace in other branches
  1. 6.3 plugins/context_condition_menu.inc \context_condition_menu::condition_form()
  2. 6 plugins/context_condition_menu.inc \context_condition_menu::condition_form()

Override of condition_form(). Use multiselect widget.

Overrides context_condition::condition_form

File

plugins/context_condition_menu.inc, line 42

Class

context_condition_menu
Expose menu items as a context condition.

Code

function condition_form($context) {
  $form = parent::condition_form($context);
  $menu_count = count($form['#options'], COUNT_RECURSIVE);
  $form['#type'] = 'select';
  $form['#multiple'] = TRUE;
  $form['#attributes'] = array(
    'size' => $menu_count > 20 ? 20 : $menu_count,
  );
  return $form;
}