1) { return ''; } } function balsami_checkbox($variables) { // return theme('form_element', $element, $checkbox); $element = $variables['element']; $t = get_t(); $element['#attributes']['type'] = 'checkbox'; element_set_attributes($element, array('id', 'name','#return_value' => 'value')); // Unchecked checkbox has #value of integer 0. if (!empty($element['#checked'])) { $element['#attributes']['checked'] = 'checked'; } _form_set_class($element, array('form-checkbox')); return ''; } function balsami_radio($element) { _form_set_class($element, array('form-radio')); $output = ''; if (!is_null($element['#title'])) { $output = '' . $output; } unset($element['#title']); return theme('form_element', $element, $output); } // function balsami_select($variables) { // $element = $variables['element']; // $select = ''; // $size = !empty($element['#size']) ? ' size="' . $element['#size'] . '"' : ''; // _form_set_class($element, array('form-select')); // $multiple = $element['#multiple']; // //return theme('form_element', $element, ''); // return ''; // } function balsami_button($element) { if (!empty($element['element'])) { return balsami_button($element['element']); } // Make sure not to overwrite classes. if (isset($element['#attributes']['class'])) { $element['#attributes']['class'] = 'form-' . $element['#button_type'] . ' ' . $element['#attributes']['class']; } else { $element['#attributes']['class'] = 'form-' . $element['#button_type']; } return '\n"; } function balsami_password($variables) { $element = $variables['element']; $size = !empty($element['#size']) ? ' size="' . $element['#size'] . '" ' : ''; $maxlength = $element['#maxlength'] ? ' maxlength="' . $element['#maxlength'] . '" ' : ''; _form_set_class($element, array('form-text')); $output = ''; return $output; //return theme('form_element', $element, $output); } function balsami_textfield($variables) { $element = $variables['element']; $element['#attributes']['type'] = 'text'; element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength')); _form_set_class($element, array('form-text')); $extra = ''; if ($element['#autocomplete_path'] && drupal_valid_path($element['#autocomplete_path'])) { drupal_add_library('system', 'drupal.autocomplete'); $element['#attributes']['class'][] = 'form-autocomplete'; $attributes = array(); $attributes['type'] = 'hidden'; $attributes['id'] = $element['#attributes']['id'] . '-autocomplete'; $attributes['value'] = url($element['#autocomplete_path'], array('absolute' => TRUE)); $attributes['disabled'] = 'disabled'; $attributes['class'][] = 'autocomplete'; $extra = ''; } $output = ''; return '' . $output . $extra . ''; } function balsami_file($element) { _form_set_class($element, array('form-file')); return theme('form_element', $element, '
'."\n".'\n"); } function ns() { $args = func_get_args(); $default = array_shift($args); // Get the type of class, i.e., 'grid', 'pull', 'push', etc. // Also get the default unit for the type to be procesed and returned. list($type, $return_unit) = explode('-', $default); // Process the conditions. $flip_states = array('var' => 'int', 'int' => 'var'); $state = 'var'; foreach ($args as $arg) { if ($state == 'var') { $var_state = !empty($arg); } elseif ($var_state) { $return_unit = $return_unit - $arg; } $state = $flip_states[$state]; } $output = ''; // Anything below a value of 1 is not needed. if ($return_unit > 0) { $output = $type . '-' . $return_unit; } return $output; } function balsami_admin_block($block) { // Don't display the block if it has no content to display. if (empty($block['content'])) { return ''; } $output = <<< EOT

$block[title]

$block[description]

$block[content]
EOT; return $output; }