function system_actions_manage

7.x system.admin.inc system_actions_manage()

Menu callback; Displays an overview of available and configured actions.

3 string references to 'system_actions_manage'
drupal-6.bare.database.php in drupal/modules/simpletest/tests/upgrade/drupal-6.bare.database.php
Bare installation of Drupal 6.17, for test purposes.
drupal-6.filled.database.php in drupal/modules/simpletest/tests/upgrade/drupal-6.filled.database.php
Filled installation of Drupal 6.17, for test purposes.
system_menu in drupal/modules/system/system.module
Implements hook_menu().

File

drupal/modules/system/system.admin.inc, line 2945
Admin page callbacks for the system module.

Code

function system_actions_manage() {
  actions_synchronize();
  $actions = actions_list();
  $actions_map = actions_actions_map($actions);
  $options = array();
  $unconfigurable = array();

  foreach ($actions_map as $key => $array) {
    if ($array['configurable']) {
      $options[$key] = $array['label'] . '...';
    }
    else {
      $unconfigurable[] = $array;
    }
  }

  $row = array();
  $instances_present = db_query("SELECT aid FROM {actions} WHERE parameters <> ''")->fetchField();
  $header = array(
    array(
      'data' => t('Action type'),
      'field' => 'type',
    ),
    array(
      'data' => t('Label'),
      'field' => 'label',
    ),
    array(
      'data' => $instances_present ? t('Operations') : '',
      'colspan' => '2',
    ),
  );
  $query = db_select('actions')->extend('PagerDefault')->extend('TableSort');
  $result = $query->fields('actions')->limit(50)->orderByHeader($header)->execute();

  foreach ($result as $action) {
    $row[] = array(
      array('data' => $action->type),
      array('data' => check_plain($action->label)),
      array('data' => $action->parameters ? l(t('configure'), "admin/config/system/actions/configure/$action->aid") : ''),
      array('data' => $action->parameters ? l(t('delete'), "admin/config/system/actions/delete/$action->aid") : ''),
    );
  }

  if ($row) {
    $pager = theme('pager');
    if (!empty($pager)) {
      $row[] = array(array(
        'data' => $pager,
        'colspan' => '3',
      ));
    }
    $build['system_actions_header'] = array('#markup' => '<h3>' . t('Available actions:') . '</h3>');
    $build['system_actions_table'] = array('#markup' => theme('table', array('header' => $header, 'rows' => $row)));
  }

  if ($actions_map) {
    $build['system_actions_manage_form'] = drupal_get_form('system_actions_manage_form', $options);
  }

  return $build;
}