You are here

function _oa_subspaces_add_checkbox in Open Atrium Subspaces 7.2

Helper to add a checkbox to the exposed filter

2 calls to _oa_subspaces_add_checkbox()
_oa_subspaces_add_element_all in ./oa_subspaces.module
Helper to add the 'Show subspace content' checkbox at same place as group ref.
_oa_subspaces_add_element_parent in ./oa_subspaces.module
Helper to add the 'Show parent content' checkbox at same place as group ref.

File

./oa_subspaces.module, line 196

Code

function _oa_subspaces_add_checkbox(&$element, $id, $title, &$form_state, $settings, $parents = array()) {
  $parents[] = $id;
  $value = $settings[$id];
  $element[$id] = array(
    '#title' => t($title),
    '#type' => 'checkbox',
    '#default_value' => $value,
    '#parents' => $parents,
  );

  // Unchecked checkboxes need to have a NULL input or else it is still
  // considered to be a checked box
  // see form.inc form_type_checkbox_value
  if (empty($value) && isset($form_state['input'][$id])) {
    unset($form_state['input'][$id]);
  }
}