ソースを参照

Working on View for Entity

Stephen Ficklin 9 年 前
コミット
610cefd457

+ 2 - 2
tripal_entities/includes/ChadoDataTypeUIController.inc

@@ -19,8 +19,8 @@ class ChadoDataTypeUIController extends EntityDefaultUIController {
 
     // We don't want to let the user add new Chado data types. They
     // are added automatically.
-//     unset($items[$this->path . '/add']);
-//     unset($items[$this->path . '/import']);
+     unset($items[$this->path . '/add']);
+     unset($items[$this->path . '/import']);
 
     return $items;
   }

+ 14 - 7
tripal_entities/includes/ChadoDataUIController.inc

@@ -14,20 +14,27 @@ class ChadoDataUIController extends EntityDefaultUIController {
     // Set this on the object so classes that extend hook_menu() can use it.
     $this->id_count = count(explode('/', $this->path));
     $wildcard = isset($this->entityInfo['admin ui']['menu wildcard']) ? $this->entityInfo['admin ui']['menu wildcard'] : '%entity_object';
-
+    $plural_label = isset($this->entityInfo['plural label']) ? $this->entityInfo['plural label'] : $this->entityInfo['label'] . 's';
 
     $items[$this->path] = array(
-      'title' => 'Chado Data',
-      'description' => 'Add edit and update chado data.',
-      'page callback' => 'system_admin_menu_block_page',
-      'access arguments' => array('access administration pages'),
-      'file path' => drupal_get_path('module', 'system'),
-      'file' => 'system.admin.inc',
+      'title' => $plural_label,
+      'page callback' => 'drupal_get_form',
+      'page arguments' => array($this->entityType . '_overview_form', $this->entityType),
+      'description' => 'Manage ' . $plural_label . '.',
+      'access callback' => 'entity_access',
+      'access arguments' => array('view', $this->entityType),
+      'file' => 'includes/entity.ui.inc',
     );
 
     // Change the overview menu type for the list of models.
     $items[$this->path]['type'] = MENU_LOCAL_TASK;
 
+    $items[$this->path . '/list'] = array(
+      'title' => 'List',
+      'type' => MENU_DEFAULT_LOCAL_TASK,
+      'weight' => -10,
+    );
+
     // Add an action link to the admin page for adding new data.
     $items[$this->path . '/add'] = array(
       'title' => 'Add Chado Data',

+ 9 - 1
tripal_entities/tripal_entities.module

@@ -10,6 +10,14 @@ require_once "includes/ChadoDataType.inc";
 require_once "includes/ChadoDataTypeController.inc";
 require_once "includes/ChadoDataTypeUIController.inc";
 
+/**
+ * Implements hook_views_api().
+ */
+function tripal_entities_views_api() {
+  return array(
+    'api' => 3,
+  );
+}
 
 /**
  * Implements hook_permission().
@@ -98,7 +106,7 @@ function tripal_entities_entity_info() {
   $entities['chado_data'] = array(
     // A human readable label to identify our entity.
     'label' => t('Chado Data'),
-    'plural label' => t('Vocabulary Terms'),
+    'plural label' => t('Chado Data'),
 
     // The entity class and controller class extend the classes provided by the
     // Entity API.

+ 0 - 16
tripal_entities/tripal_entities.views.inc

@@ -1,16 +0,0 @@
-<?php
-/**
- *  @file
- *  This file contains the basic functions for views integration of
- *  chado/tripal feature tables
- */
-
-/**
- * Implements hook_views_api().
- */
-function tripal_entities_views_api() {
-  return array(
-    'api' => 3,
-    'path' => drupal_get_path('module', 'tripal_entities') . '/views',
-  );
-}

+ 102 - 0
tripal_entities/tripal_entities.views_default.inc

@@ -1 +1,103 @@
 <?php
+
+function tripal_entities_views_default_views() {
+  $views = array();
+
+$view = new view();
+$view->name = 'chado_data';
+$view->description = '';
+$view->tag = 'default';
+$view->base_table = 'chado_data_type';
+$view->human_name = 'Chado Data';
+$view->core = 7;
+$view->api_version = '3.0';
+$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+/* Display: Master */
+$handler = $view->new_display('default', 'Master', 'default');
+$handler->display->display_options['title'] = 'Chado Data';
+$handler->display->display_options['use_more_always'] = FALSE;
+$handler->display->display_options['access']['type'] = 'perm';
+$handler->display->display_options['access']['perm'] = 'administer blocks';
+$handler->display->display_options['cache']['type'] = 'none';
+$handler->display->display_options['query']['type'] = 'views_query';
+$handler->display->display_options['exposed_form']['type'] = 'basic';
+$handler->display->display_options['pager']['type'] = 'full';
+$handler->display->display_options['style_plugin'] = 'table';
+$handler->display->display_options['style_options']['columns'] = array(
+  'id' => 'id',
+);
+$handler->display->display_options['style_options']['default'] = '-1';
+$handler->display->display_options['style_options']['info'] = array(
+  'id' => array(
+    'sortable' => 0,
+    'default_sort_order' => 'asc',
+    'align' => '',
+    'separator' => '',
+    'empty_column' => 0,
+  ),
+);
+/* No results behavior: Global: Text area */
+$handler->display->display_options['empty']['area']['id'] = 'area';
+$handler->display->display_options['empty']['area']['table'] = 'views';
+$handler->display->display_options['empty']['area']['field'] = 'area';
+$handler->display->display_options['empty']['area']['label'] = 'No Data';
+$handler->display->display_options['empty']['area']['empty'] = TRUE;
+$handler->display->display_options['empty']['area']['content'] = 'There is currently no data available.';
+$handler->display->display_options['empty']['area']['format'] = 'filtered_html';
+/* Field: Chado Data Type: Internal, numeric chado data type ID */
+$handler->display->display_options['fields']['id']['id'] = 'id';
+$handler->display->display_options['fields']['id']['table'] = 'chado_data_type';
+$handler->display->display_options['fields']['id']['field'] = 'id';
+$handler->display->display_options['fields']['id']['label'] = 'Data ID';
+/* Field: Chado Data Type: Label */
+$handler->display->display_options['fields']['label']['id'] = 'label';
+$handler->display->display_options['fields']['label']['table'] = 'chado_data_type';
+$handler->display->display_options['fields']['label']['field'] = 'label';
+$handler->display->display_options['fields']['label']['label'] = 'Type ID';
+/* Field: Chado Data Type: Machine-readable name */
+$handler->display->display_options['fields']['type']['id'] = 'type';
+$handler->display->display_options['fields']['type']['table'] = 'chado_data_type';
+$handler->display->display_options['fields']['type']['field'] = 'type';
+$handler->display->display_options['fields']['type']['label'] = 'Type Name';
+/* Field: Chado Data Type: Status */
+$handler->display->display_options['fields']['status']['id'] = 'status';
+$handler->display->display_options['fields']['status']['table'] = 'chado_data_type';
+$handler->display->display_options['fields']['status']['field'] = 'status';
+/* Filter criterion: Chado Data Type: Machine-readable name */
+$handler->display->display_options['filters']['type']['id'] = 'type';
+$handler->display->display_options['filters']['type']['table'] = 'chado_data_type';
+$handler->display->display_options['filters']['type']['field'] = 'type';
+$handler->display->display_options['filters']['type']['exposed'] = TRUE;
+$handler->display->display_options['filters']['type']['expose']['operator_id'] = 'type_op';
+$handler->display->display_options['filters']['type']['expose']['label'] = 'Type';
+$handler->display->display_options['filters']['type']['expose']['operator'] = 'type_op';
+$handler->display->display_options['filters']['type']['expose']['identifier'] = 'type';
+$handler->display->display_options['filters']['type']['expose']['remember_roles'] = array(
+  2 => '2',
+  1 => 0,
+  3 => 0,
+);
+$handler->display->display_options['filters']['type']['group_info']['label'] = 'Machine-readable name';
+$handler->display->display_options['filters']['type']['group_info']['identifier'] = 'type';
+$handler->display->display_options['filters']['type']['group_info']['remember'] = FALSE;
+$handler->display->display_options['filters']['type']['group_info']['group_items'] = array(
+  1 => array(),
+  2 => array(),
+  3 => array(),
+);
+
+/* Display: Page */
+$handler = $view->new_display('page', 'Page', 'data_admin_page');
+$handler->display->display_options['path'] = 'admin/content/data/list';
+$handler->display->display_options['menu']['type'] = 'default tab';
+$handler->display->display_options['menu']['title'] = 'List';
+$handler->display->display_options['menu']['weight'] = '-10';
+$handler->display->display_options['menu']['context'] = 0;
+$handler->display->display_options['menu']['context_only_inline'] = 0;
+$handler->display->display_options['tab_options']['weight'] = '0';
+
+
+  $views[] = $view;
+  return $views;
+}