12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- function tripal_entity_delete(TripalEntity $tripal_entity) {
- $tripal_entity->delete();
- }
- function tripal_entity_save(TripalEntity $entity) {
- return $entity->save();
- }
- function tripal_bundle_save(TripalBundle $entity) {
- $entity->save();
- }
- function tripal_bundle_delete(TripalBundle $type) {
- $type->delete();
- }
- function tripal_entity_uri(TripalEntity $entity){
- return array(
- 'path' => 'data/' . $entity->id,
- );
- }
- function chado_get_entity_title($entity) {
-
- $details = db_select('chado_entity', 'ce')
- ->fields('ce')
- ->condition('entity_id', $entity->id)
- ->execute()
- ->fetchObject();
- $tablename = $details->data_table;
- $type_field = $details->field;
- $schema = chado_get_schema($tablename);
- $pkey_field = $schema['primary key'][0];
- $record_id = $details->record_id;
- $record = chado_generate_var($tablename, array($pkey_field => $record_id));
-
-
- $node = new stdClass();
- $node->$tablename = $record;
-
- $tokens = array();
- $title = chado_node_get_title_format('chado_' . $tablename, $tokens);
-
- if (preg_match_all('/\[[^]]+\]/', $title, $used_tokens)) {
-
- foreach ($used_tokens[0] as $token) {
- $token_info = $tokens[$token];
- if (!empty($token_info)) {
- $value = chado_get_token_value($token_info, $node);
- $title = str_replace($token, $value, $title);
- }
- }
- }
- else {
- return $title;
- }
- return $title;
- }
|