You are here

function filebrowser_form_actions in Filebrowser 7.3

Same name and namespace in other branches
  1. 8 filebrowser.module \filebrowser_form_actions()
  2. 6.2 filebrowser.form.actions.inc \filebrowser_form_actions()
  3. 7.4 filebrowser.module \filebrowser_form_actions()
  4. 7.2 filebrowser.module \filebrowser_form_actions()
1 string reference to 'filebrowser_form_actions'
theme_dir_listing_list_view in ./filebrowser.theme.inc
Theming function for list view.

File

./filebrowser.module, line 740

Code

function filebrowser_form_actions($form, &$form_state, $header, $options, $actions, $node) {

  // debug($header);
  $form = array();
  $form['#node'] = $node;
  $form['table'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options,
    '#multiple' => TRUE,
  );

  // search $options array to find the "Up Dir" line and de-activate the checkbox
  foreach ($options as $key => $option) {
    if (!$option['fid']) {
      $form['table'][$key]['#disabled'] = true;
    }
  }

  //if (isset($form['table'][]))

  // Normally the checkboxes are created by form_process_tableselect(). They are created manually here
  // to have the checkboxes behave the way we want it for filebrowser.

  /*  foreach ($options as $key => $data) {
      $form['table'][$key] = array(
        '#type' => 'checkbox',
        '#title' => $data['fid'],
        //'#title_display' => 'invisible',
        //'#return_value' =>  'foop',
        '#default_value' => 0,
        // disable the checkbox and hide it if this item has no fid (is not a selectable item)
        '#disabled' => empty($data['fid']) ? TRUE : FALSE,
        '#attributes' => empty($data['fid']) ? array('style' => 'display:none;') : '',
        );
    }*/
  $fb_options = array(
    '' => t('choose an action'),
  );
  foreach ($actions as $action) {
    $fb_options[$action['operation']] = $action['title'];
  }
  $form['action'] = array(
    '#prefix' => '<br/><div class="container-inline">',
    '#title' => t('actions'),
    '#type' => 'select',
    '#options' => $fb_options,
  );
  $form['submit'] = array(
    '#value' => t('Process'),
    '#type' => 'submit',
    '#suffix' => '</div><br/>',
  );
  return $form;
}