You are here

function view_custom_table_custom_tables_views in Views Custom Table 7

Function to display all views used by a custom table.

1 string reference to 'view_custom_table_custom_tables_views'
view_custom_table_menu in ./view_custom_table.module
Implements hook_menu().

File

./view_custom_table.admin.inc, line 461
File for administrative functions.

Code

function view_custom_table_custom_tables_views($table_id = NULL) {
  $table_info = view_custom_table_load_table($table_id);
  $views_info = view_custom_table_load_custom_table_views($table_info->table_name);
  if (!empty($views_info)) {
    foreach ($views_info as $item) {
      $rows[] = array(
        'id' => $item->vid,
        'name' => $item->human_name . '(' . $item->name . ')',
        'description' => $item->description,
        'link' => l(t('View'), 'admin/structure/views/view/' . $item->name . '/edit'),
      );
    }
    $headers = array(
      "Id",
      "Name",
      "Description",
      "Link",
    );
    $output = l(t('Return to list'), 'admin/structure/views/custom_table');
    $output .= '<p></p>';
    $output .= theme('table', array(
      'header' => $headers,
      'rows' => $rows,
    ));
    return $output;
  }
  else {
    $output = '<h3>' . t('No views created by using @table_name.', array(
      '@table_name' => $table_info->table_name,
    )) . '</h3>';
    return $output;
  }
}