Skip to content

Commit

Permalink
Fix TripalField issue
Browse files Browse the repository at this point in the history
  • Loading branch information
almasaeed2010 committed Aug 22, 2017
1 parent 360a1ee commit 331dde3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ protected function make($files)
$fields_name = $this->module_name;
if ($this->options->output) {
if (file_exists("{$path['includes']}/{$fields_name}.fields.inc")) {
$fields_name .= 'stub';
$fields_name .= '.stub';
}
}
file_put_contents("{$path['includes']}/{$fields_name}.fields.inc", $files['fields']);
Expand Down
6 changes: 6 additions & 0 deletions stubs/tripal_field_class
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ class $$field_name$$ extends TripalField {
*
*/
public function load($entity) {
// Tripal fields, by default, won't show up on the page unless there
// is a value attached to them. Therefore, this line adds a default
// value for testing purposes. Change this line to load the data
// your field requires.
$field_name = get_class();
$entity->{$field_name}['und'][0]['value'] = TRUE;
}

}
2 changes: 1 addition & 1 deletion stubs/tripal_field_widget
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class $$field_name$$_widget extends TripalFieldWidget {
public static $default_label = '$$field_label$$';

// The list of field types for which this formatter is appropriate.
public static $field_types = array('$$field_name$$_widget');
public static $field_types = array('$$field_name$$');

/**
* Provides the form for editing of this field.
Expand Down
6 changes: 3 additions & 3 deletions stubs/tripal_fields
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ function $$module_name$$_bundle_instances_info($entity_type, $bundle) {
'required' => FALSE,
'settings' => array(
'auto_attach' => FALSE,
'chado_table' => $bundle->data_table,
'chado_column' => 'organism_id',
'base_table' => $bundle->data_table,
// 'chado_table' => $bundle->data_table,
// 'chado_column' => 'organism_id',
// 'base_table' => $bundle->data_table,
),
'widget' => array(
'type' => '$$field_name$$_widget',
Expand Down

0 comments on commit 331dde3

Please sign in to comment.