You are here

function ds_plugins_list_view in Display Suite 6.3

Callback to load an interface to view a list of plugins

Parameters

$type: The DS plugin type to load

$heading (optional): A heading to use for the table

Return value

A list of plugins, formatted as a table.

1 call to ds_plugins_list_view()
ds_plugins_page in includes/ds.admin.inc
Page callback to list installed plugins

File

includes/ds.admin.inc, line 68
General file for administrative functions.

Code

function ds_plugins_list_view($type, $heading = NULL) {
  static $module_info = array();
  $plugins = ds_get_plugins($type);
  if (isset($plugins) && !empty($plugins)) {

    // build a table
    $output = isset($heading) ? '<h3>' . check_plain($heading) . '</h3>' : '';
    $header = array(
      t('Name'),
      t('Description'),
      t('Providing module'),
      t('Status'),
    );
    $rows = array();
    foreach ($plugins as $plugin) {
      if (!isset($module_info[$plugin['module']])) {
        $path = drupal_get_path('module', $plugin['module']) . '/' . $plugin['module'] . '.info';
        $module_info[$plugin['module']] = drupal_parse_info_file($path);
      }
      $row = array();
      $row[] = array(
        'data' => $plugin['name'],
        'class' => 'title',
        'sort' => 'asc',
      );
      $row[] = array(
        'data' => $plugin['description'],
        'class' => 'description',
      );
      $row[] = array(
        'data' => $module_info[$plugin['module']]['name'],
        'class' => 'provider',
      );
      $row[] = array(
        'data' => 'Installed',
        'class' => 'status',
      );
      $rows[] = $row;
    }
    $output .= theme('table', $header, $rows);
  }
  return $output;
}