You are here

function crm_core_activity_ui_form_alter in CRM Core 7

Implements hook_form_alter().

File

modules/crm_core_activity_ui/crm_core_activity_ui.module, line 162
Provides the UI for viewing activities.

Code

function crm_core_activity_ui_form_alter(&$form, &$form_state, $form_id) {

  // Alter the operations links so they looks like CTools dropbutton.
  if ($form_id == 'crm_core_activity_type_overview_form') {
    $ops_count = $form['table']['#header'][2]['colspan'];
    $form['table']['#header'][2] = t('Operations');
    crm_core_ui_ctools_add_dropbutton_files();
    foreach ($form['table']['#rows'] as $key => $row) {
      $output = theme('crm_core_ui_ctools_dropbutton', array(
        'ops_count' => $ops_count,
        'links' => $row,
        'index' => $key,
      ));
      $form['table']['#rows'][$key] = array_merge(array_slice($row, 0, count($row) - $ops_count), array(
        $output,
      ));
    }
  }
}