You are here

function domain_batch_list in Domain Access 7.3

Same name and namespace in other branches
  1. 5 domain_admin.inc \domain_batch_list()
  2. 6.2 domain.admin.inc \domain_batch_list()
  3. 7.2 domain.admin.inc \domain_batch_list()

Lists available batch updates for the domain module.

Parameters

$batch: An array of batch actions, as defined by hook_domain_batch().

Return value

A themed table of links and descriptions for batch actions.

1 call to domain_batch_list()
domain_batch in ./domain.admin.inc
Allows for the batch update of certain elements.

File

./domain.admin.inc, line 730
Administration functions for the domain module.

Code

function domain_batch_list($batch) {
  $build = array();
  $header = array(
    t('Action'),
    t('Description'),
  );
  $rows = array();
  foreach ($batch as $key => $value) {
    if (!isset($value['#module'])) {
      $batch[$key]['#module'] = t('Other');
    }
  }
  uasort($batch, 'domain_batch_sort');
  $group = '';
  foreach ($batch as $key => $value) {
    $permission = isset($value['#permission']) ? $value['#permission'] : 'administer domains';
    if (!user_access($permission)) {
      continue;
    }
    if ($group != $value['#module']) {
      $rows[] = array(
        array(
          'data' => '<strong>' . t('%module options', array(
            '%module' => $value['#module'],
          )) . '</strong>',
          'colspan' => 2,
        ),
      );
      $group = $value['#module'];
    }
    $rows[] = array(
      l($value['#form']['#title'], 'admin/structure/domain/batch/' . $key),
      $value['#meta_description'],
    );
  }
  $output = '<p>' . t('Batch updates allow you to edit values for multiple domains at one time.  These functions are helpful when moving your sites from staging to production, or any time you need to make mass changes quickly.  The following batch update actions may be performed.') . '</p>';
  $output .= '<p><em>' . t('Note that you will only be shown domains on which each action may be performed.  If the module is not yet configured, some actions may be empty.') . '</em></p>';

  // Return the build array.
  $build['header'] = array(
    '#markup' => $output,
  );
  $build['content'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#attributes' => array(
      'id' => 'domain-list',
    ),
  );
  return $build;
}