You are here

function mobile_tools_device_groups_list in Mobile Tools 7.3

Lists the existing device groups

1 string reference to 'mobile_tools_device_groups_list'
mobile_tools_menu in ./mobile_tools.module
Implements hook_menu().

File

./mobile_tools.admin.inc, line 10
Adminstrative pages for Mobile Tools

Code

function mobile_tools_device_groups_list() {
  $rows = array();
  $header = array(
    t('Name'),
    t('Machine Name'),
    t('Modifier'),
    t('Theme'),
    t('Description'),
    t('Weight'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $device_groups = mobile_tools_device_group_load_all();
  foreach ($device_groups as $device_group) {
    $is_overridden = $device_group->export_type & EXPORT_IN_CODE ? TRUE : FALSE;
    if ($device_group->theme == MOBILE_TOOLS_FLAG_DEFAULT_SITE_THEME) {
      $device_group->theme = t('Default site theme');
    }
    $rows[] = array(
      $device_group->title,
      $device_group->dgid,
      $device_group->purl_modifier,
      $device_group->theme,
      $device_group->description,
      $device_group->weight,
      // @todo Fix this. Raw user input with potential for XSS attack
      l(t('edit'), "admin/config/system/mobile-tools/edit/" . $device_group->dgid),
      !isset($optionset->in_code_only) ? l(t($is_overridden ? 'revert' : 'delete'), "admin/config/system/mobile-tools/delete/" . $device_group->dgid) : '',
    );
  }
  $build['device_groups_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No device groups available. <a href="@link">Add device group</a>.', array(
      '@link' => url('admin/config/system/mobile-tools/add'),
    )),
  );
  return $build;
}