|
@@ -26,7 +26,26 @@ function tripal_entities_views_api() {
|
|
function tripal_entities_menu() {
|
|
function tripal_entities_menu() {
|
|
|
|
|
|
$items = array();
|
|
$items = array();
|
|
- // the administative settings menu
|
|
|
|
|
|
+
|
|
|
|
+ // The content menu.
|
|
|
|
+ $items['admin/content/tripal_data'] = array(
|
|
|
|
+ 'title' => 'Biological Data',
|
|
|
|
+ 'page callback' => 'tripal_entities_content_view',
|
|
|
|
+ 'file' => 'includes/tripal_entities.admin.inc',
|
|
|
|
+ 'access arguments' => array('administer tripal data'),
|
|
|
|
+ 'type' => MENU_LOCAL_TASK,
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $items['admin/content/tripal_data/add'] = array(
|
|
|
|
+ 'title' => 'Add Biological Data',
|
|
|
|
+ 'page callback' => 'drupal_get_form',
|
|
|
|
+ 'page arguments' => array('tripal_data_form'),
|
|
|
|
+ 'access arguments' => array('administer tripal data'),
|
|
|
|
+ 'type' => MENU_LOCAL_ACTION,
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // The administative settings menu.
|
|
$items['admin/tripal/data_types'] = array(
|
|
$items['admin/tripal/data_types'] = array(
|
|
'title' => 'Biological Data',
|
|
'title' => 'Biological Data',
|
|
'description' => 'Tools for publishing, configurating and managing biological data.',
|
|
'description' => 'Tools for publishing, configurating and managing biological data.',
|
|
@@ -35,14 +54,14 @@ function tripal_entities_menu() {
|
|
'file' => 'includes/tripal_entities.admin.inc',
|
|
'file' => 'includes/tripal_entities.admin.inc',
|
|
'type' => MENU_NORMAL_ITEM,
|
|
'type' => MENU_NORMAL_ITEM,
|
|
);
|
|
);
|
|
-
|
|
|
|
- // the default tab
|
|
|
|
|
|
+
|
|
|
|
+ // The default tab.
|
|
$items['admin/tripal/data_types/default'] = array(
|
|
$items['admin/tripal/data_types/default'] = array(
|
|
'title' => 'Biological Data',
|
|
'title' => 'Biological Data',
|
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
|
'weight' => 1,
|
|
'weight' => 1,
|
|
);
|
|
);
|
|
-
|
|
|
|
|
|
+
|
|
$items['admin/tripal/data_types/publish'] = array(
|
|
$items['admin/tripal/data_types/publish'] = array(
|
|
'title' => 'Publish',
|
|
'title' => 'Publish',
|
|
'description' => 'Publish Data',
|
|
'description' => 'Publish Data',
|
|
@@ -154,50 +173,49 @@ function tripal_entities_entity_info() {
|
|
|
|
|
|
// Get a list of published vocabularies from 'tripal_vocabulary
|
|
// Get a list of published vocabularies from 'tripal_vocabulary
|
|
$published_vocs = chado_generate_var('tripal_vocabulary', array('publish' => 1), array('return_array' => 1));
|
|
$published_vocs = chado_generate_var('tripal_vocabulary', array('publish' => 1), array('return_array' => 1));
|
|
-
|
|
|
|
|
|
+
|
|
foreach ($published_vocs as $voc) {
|
|
foreach ($published_vocs as $voc) {
|
|
$entities [$voc->db_id->name] = array (
|
|
$entities [$voc->db_id->name] = array (
|
|
// A human readable label to identify our entity.
|
|
// A human readable label to identify our entity.
|
|
'label' => $voc->db_id->name . ' (' . $voc->cv_id->name . ')',
|
|
'label' => $voc->db_id->name . ' (' . $voc->cv_id->name . ')',
|
|
'plural label' => $voc->db_id->name . ' (' . $voc->cv_id->name . ')',
|
|
'plural label' => $voc->db_id->name . ' (' . $voc->cv_id->name . ')',
|
|
-
|
|
|
|
|
|
+
|
|
// The entity class and controller class extend the classes provided by the
|
|
// The entity class and controller class extend the classes provided by the
|
|
// Entity API.
|
|
// Entity API.
|
|
'entity class' => 'TripalData',
|
|
'entity class' => 'TripalData',
|
|
'controller class' => 'TripalDataController',
|
|
'controller class' => 'TripalDataController',
|
|
-
|
|
|
|
|
|
+
|
|
// The table for this entity defined in hook_schema()
|
|
// The table for this entity defined in hook_schema()
|
|
'base table' => 'tripal_data',
|
|
'base table' => 'tripal_data',
|
|
-
|
|
|
|
|
|
+
|
|
// Returns the uri elements of an entity.
|
|
// Returns the uri elements of an entity.
|
|
'uri callback' => 'tripal_entities_vocbulary_term_uri',
|
|
'uri callback' => 'tripal_entities_vocbulary_term_uri',
|
|
-
|
|
|
|
|
|
+
|
|
// IF fieldable == FALSE, we can't attach fields.
|
|
// IF fieldable == FALSE, we can't attach fields.
|
|
'fieldable' => TRUE,
|
|
'fieldable' => TRUE,
|
|
-
|
|
|
|
|
|
+
|
|
// entity_keys tells the controller what database fields are used for key
|
|
// entity_keys tells the controller what database fields are used for key
|
|
// functions. It is not required if we don't have bundles or revisions.
|
|
// functions. It is not required if we don't have bundles or revisions.
|
|
// Here we do not support a revision, so that entity key is omitted.
|
|
// Here we do not support a revision, so that entity key is omitted.
|
|
'entity keys' => array (
|
|
'entity keys' => array (
|
|
'id' => 'id',
|
|
'id' => 'id',
|
|
- 'bundle' => 'type'
|
|
|
|
|
|
+ 'bundle' => 'bundle'
|
|
),
|
|
),
|
|
'bundle keys' => array (
|
|
'bundle keys' => array (
|
|
- 'bundle' => 'type'
|
|
|
|
|
|
+ 'bundle' => 'bundle'
|
|
),
|
|
),
|
|
-
|
|
|
|
|
|
+
|
|
// Callback function for access to this entity.
|
|
// Callback function for access to this entity.
|
|
'access callback' => 'tripal_data_access',
|
|
'access callback' => 'tripal_data_access',
|
|
-
|
|
|
|
|
|
+
|
|
// FALSE disables caching. Caching functionality is handled by Drupal core.
|
|
// FALSE disables caching. Caching functionality is handled by Drupal core.
|
|
'static cache' => FALSE,
|
|
'static cache' => FALSE,
|
|
-
|
|
|
|
|
|
+
|
|
// Bundles are added in the hook_entities_info_alter() function.
|
|
// Bundles are added in the hook_entities_info_alter() function.
|
|
'bundles' => array (),
|
|
'bundles' => array (),
|
|
-
|
|
|
|
|
|
+
|
|
'label callback' => 'tripal_data_label',
|
|
'label callback' => 'tripal_data_label',
|
|
- 'creation callback' => 'tripal_data_create',
|
|
|
|
-
|
|
|
|
|
|
+
|
|
// The information below is used by the TripalDataUIController
|
|
// The information below is used by the TripalDataUIController
|
|
// (which extends the EntityDefaultUIController). The admin_ui
|
|
// (which extends the EntityDefaultUIController). The admin_ui
|
|
// key here is mean to appear on the 'Find Content' page of the
|
|
// key here is mean to appear on the 'Find Content' page of the
|
|
@@ -206,20 +224,20 @@ function tripal_entities_entity_info() {
|
|
'path' => 'admin/content/data',
|
|
'path' => 'admin/content/data',
|
|
'controller class' => 'TripalDataUIController',
|
|
'controller class' => 'TripalDataUIController',
|
|
'menu wildcard' => '%tripal_data',
|
|
'menu wildcard' => '%tripal_data',
|
|
- 'file' => 'includes/TripalDataUIController.inc'
|
|
|
|
|
|
+ 'file' => 'includes/TripalDataUIController.inc'
|
|
),
|
|
),
|
|
'view modes' => array (
|
|
'view modes' => array (
|
|
'full' => array (
|
|
'full' => array (
|
|
'label' => t ( 'Full content' ),
|
|
'label' => t ( 'Full content' ),
|
|
- 'custom settings' => FALSE
|
|
|
|
|
|
+ 'custom settings' => FALSE
|
|
),
|
|
),
|
|
'teaser' => array (
|
|
'teaser' => array (
|
|
'label' => t ( 'Teaser' ),
|
|
'label' => t ( 'Teaser' ),
|
|
- 'custom settings' => TRUE
|
|
|
|
- )
|
|
|
|
- )
|
|
|
|
|
|
+ 'custom settings' => TRUE
|
|
|
|
+ )
|
|
|
|
+ )
|
|
);
|
|
);
|
|
-
|
|
|
|
|
|
+
|
|
// The entity that holds information about the entity types
|
|
// The entity that holds information about the entity types
|
|
$entities [$voc->db_id->name . '_type'] = array (
|
|
$entities [$voc->db_id->name . '_type'] = array (
|
|
'label' => t ($voc->db_id->name . ' (' . $voc->cv_id->name . ')' . ' Type' ),
|
|
'label' => t ($voc->db_id->name . ' (' . $voc->cv_id->name . ')' . ' Type' ),
|
|
@@ -234,7 +252,7 @@ function tripal_entities_entity_info() {
|
|
'entity keys' => array (
|
|
'entity keys' => array (
|
|
'id' => 'id',
|
|
'id' => 'id',
|
|
'name' => 'type',
|
|
'name' => 'type',
|
|
- 'label' => 'label'
|
|
|
|
|
|
+ 'label' => 'label'
|
|
),
|
|
),
|
|
'access callback' => 'tripal_data_type_access',
|
|
'access callback' => 'tripal_data_type_access',
|
|
'module' => 'tripal_entities',
|
|
'module' => 'tripal_entities',
|
|
@@ -242,8 +260,8 @@ function tripal_entities_entity_info() {
|
|
'admin ui' => array (
|
|
'admin ui' => array (
|
|
'path' => 'admin/structure/data_types',
|
|
'path' => 'admin/structure/data_types',
|
|
'controller class' => 'TripalDataTypeUIController',
|
|
'controller class' => 'TripalDataTypeUIController',
|
|
- 'file' => 'includes/TripalDataTypeUIController.inc'
|
|
|
|
- )
|
|
|
|
|
|
+ 'file' => 'includes/TripalDataTypeUIController.inc'
|
|
|
|
+ )
|
|
);
|
|
);
|
|
}
|
|
}
|
|
return $entities;
|
|
return $entities;
|
|
@@ -256,27 +274,27 @@ function tripal_entities_entity_info() {
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
function tripal_entities_entity_info_alter(&$entity_info) {
|
|
function tripal_entities_entity_info_alter(&$entity_info) {
|
|
-
|
|
|
|
|
|
+
|
|
// Get a list of published terms from 'tripal_term
|
|
// Get a list of published terms from 'tripal_term
|
|
$published_terms = chado_generate_var('tripal_term', array('publish' => 1), array('return_array' => 1));
|
|
$published_terms = chado_generate_var('tripal_term', array('publish' => 1), array('return_array' => 1));
|
|
foreach ( $published_terms as $term ) {
|
|
foreach ( $published_terms as $term ) {
|
|
-
|
|
|
|
|
|
+
|
|
// Bundles are alternative groups of fields or configuration
|
|
// Bundles are alternative groups of fields or configuration
|
|
// associated with a base entity type.
|
|
// associated with a base entity type.
|
|
// We want to dynamically add the bundles (or term types) to the entity.
|
|
// We want to dynamically add the bundles (or term types) to the entity.
|
|
$cvterm = $term->cvterm_id;
|
|
$cvterm = $term->cvterm_id;
|
|
$bundle_id = $cvterm->dbxref_id->db_id->name . '_' . $cvterm->dbxref_id->accession;
|
|
$bundle_id = $cvterm->dbxref_id->db_id->name . '_' . $cvterm->dbxref_id->accession;
|
|
- $label = preg_replace ( '/_/', ' ', ucwords ( $cvterm->name ) );
|
|
|
|
- $entity_info [$cvterm->dbxref_id->db_id->name] ['bundles'] [$bundle_id] = array (
|
|
|
|
|
|
+ $label = preg_replace('/_/', ' ', ucwords($cvterm->name));
|
|
|
|
+ $entity_info[$cvterm->dbxref_id->db_id->name]['bundles'][$bundle_id] = array (
|
|
'label' => $label,
|
|
'label' => $label,
|
|
'admin' => array (
|
|
'admin' => array (
|
|
'path' => 'admin/structure/data_types/manage/%tripal_data_type',
|
|
'path' => 'admin/structure/data_types/manage/%tripal_data_type',
|
|
'real path' => 'admin/structure/data_types/manage/' . $bundle_id,
|
|
'real path' => 'admin/structure/data_types/manage/' . $bundle_id,
|
|
'bundle argument' => 4,
|
|
'bundle argument' => 4,
|
|
'access arguments' => array (
|
|
'access arguments' => array (
|
|
- 'administer tripal data types'
|
|
|
|
- )
|
|
|
|
- )
|
|
|
|
|
|
+ 'administer tripal data types'
|
|
|
|
+ )
|
|
|
|
+ )
|
|
);
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|