From 7c432d03e8d9a9c0ea1a5a98bef18a63655957a1 Mon Sep 17 00:00:00 2001 From: Malladi Date: Mon, 28 Aug 2023 13:12:33 -0500 Subject: [PATCH] Removed ChadoLocalSourceData*.php files that were a repeat of ChadoSourceData*.php files --- .../ChadoLocalSourceDataFormatterDefault.php | 67 ----------- .../FieldType/ChadoLocalSourceDataDefault.php | 108 ------------------ .../ChadoLocalSourceDataWidgetDefault.php | 79 ------------- 3 files changed, 254 deletions(-) delete mode 100755 tripal_chado/src/Plugin/Field/FieldFormatter/ChadoLocalSourceDataFormatterDefault.php delete mode 100755 tripal_chado/src/Plugin/Field/FieldType/ChadoLocalSourceDataDefault.php delete mode 100755 tripal_chado/src/Plugin/Field/FieldWidget/ChadoLocalSourceDataWidgetDefault.php diff --git a/tripal_chado/src/Plugin/Field/FieldFormatter/ChadoLocalSourceDataFormatterDefault.php b/tripal_chado/src/Plugin/Field/FieldFormatter/ChadoLocalSourceDataFormatterDefault.php deleted file mode 100755 index 9798d7dd0..000000000 --- a/tripal_chado/src/Plugin/Field/FieldFormatter/ChadoLocalSourceDataFormatterDefault.php +++ /dev/null @@ -1,67 +0,0 @@ - $item) { - $content = "
"; -<<<<<<< HEAD -======= - $prog_vers_val = $item->get( 'programversion' )->getString() ; - if ( !empty( $prog_vers_val ) ) { - $content .= "
Software version
: " . $prog_vers_val . "
"; - } ->>>>>>> b73440286faed0b3cf68dec7fdff3e2bb4528450 - $sourcename_val = $item->get( 'sourcename' )->getString() ; - if ( !empty( $sourcename_val ) ) { - $content .= "
Source Name
: " . $sourcename_val . "
"; - } - $sourceversion_val = $item->get( 'sourceversion' )->getString() ; - if ( !empty( $sourceversion_val ) ) { - $content .= "
Source Version
: " . $sourceversion_val . "
"; - } - $sourceuri_val = $item->get( 'sourceuri' )->getString() ; - /* - if (preg_match('/^https?:/i', $sourceuri_val ) ) { - $sourceuri_val = Link::fromTextAndUrl($sourceuri_val, $sourceuri_val); - } - */ - if ( !empty( $sourceuri_val ) ) { - $content .= "
Source URI
: " . $sourceuri_val . "
"; - } - $content .= "
"; - } - $elements[$delta] = [ - '#type' => 'markup', - '#markup' => $content, - ]; - - return $elements; - } -} diff --git a/tripal_chado/src/Plugin/Field/FieldType/ChadoLocalSourceDataDefault.php b/tripal_chado/src/Plugin/Field/FieldType/ChadoLocalSourceDataDefault.php deleted file mode 100755 index 2ca8f71d8..000000000 --- a/tripal_chado/src/Plugin/Field/FieldType/ChadoLocalSourceDataDefault.php +++ /dev/null @@ -1,108 +0,0 @@ -getTargetEntityTypeId(); - - // Get the property terms by using the Chado table columns they map to. - $storage = \Drupal::entityTypeManager()->getStorage('chado_term_mapping'); - $mapping = $storage->load('core_mapping'); - - $record_id_term = $mapping->getColumnTermId('analysis', 'analysis_id'); - - $prog_vers_term = $mapping->getColumnTermId('analysis', 'programversion'); - $src_uri_term = $mapping->getColumnTermId('analysis', 'sourceuri'); - $src_name_term = $mapping->getColumnTermId('analysis', 'sourcename'); - $src_vers_term = $mapping->getColumnTermId('analysis', 'sourceversion'); - - // Get property terms using Chado table columns they map to. Return the properties for this field. - $properties = []; - - $properties[] = new ChadoIntStoragePropertyType($entity_type_id, self::$id, 'record_id', $record_id_term, [ - 'action' => 'store_id', - 'drupal_store' => TRUE, - 'chado_table' => 'analysis', - 'chado_column' => 'analysis_id', - ]); -<<<<<<< HEAD -======= - $properties[] = new ChadoVarCharStoragePropertyType($entity_type_id, self::$id, 'programversion', $prog_vers_term, 100, [ - 'action' => 'store', - 'chado_table' => 'analysis', - 'chado_column' => 'programversion', - ]); ->>>>>>> b73440286faed0b3cf68dec7fdff3e2bb4528450 - $properties[] = new ChadoVarCharStoragePropertyType($entity_type_id, self::$id, 'sourceuri', $src_uri_term, 100, [ - 'action' => 'store', - 'chado_table' => 'analysis', - 'chado_column' => 'sourceuri', - ]); - $properties[] = new ChadoVarCharStoragePropertyType($entity_type_id, self::$id, 'sourcename', $src_name_term, 200, [ - 'action' => 'store', - 'chado_table' => 'analysis', - 'chado_column' => 'sourcename', - 'delete_if_empty' => TRUE, - 'empty_value' => '', - ]); - $properties[] = new ChadoVarCharStoragePropertyType($entity_type_id, self::$id, 'sourceversion', $src_vers_term, 100, [ - 'action' => 'store', - 'chado_table' => 'analysis', - 'chado_column' => 'sourceversion', - ]); - - return($properties); - } - -} diff --git a/tripal_chado/src/Plugin/Field/FieldWidget/ChadoLocalSourceDataWidgetDefault.php b/tripal_chado/src/Plugin/Field/FieldWidget/ChadoLocalSourceDataWidgetDefault.php deleted file mode 100755 index 01adf86ad..000000000 --- a/tripal_chado/src/Plugin/Field/FieldWidget/ChadoLocalSourceDataWidgetDefault.php +++ /dev/null @@ -1,79 +0,0 @@ -getValue(); - - $elements = []; - $elements['record_id'] = [ - '#type' => 'value', - '#default_value' => $item_vals['record_id'] ?? 0, - ]; -<<<<<<< HEAD -======= - - $elements['programversion'] = [ - '#title' => "Software version", - '#type' => 'textfield', - '#default_value' => $item_vals['programversion'] ?? '', - ]; ->>>>>>> b73440286faed0b3cf68dec7fdff3e2bb4528450 - $elements['sourceuri'] = [ - '#title' => "Local Source URI", - '#type' => 'textfield', - '#default_value' => $item_vals['sourceuri'] ?? '', - ]; - $elements['sourcename'] = [ - '#title' => "Local Source Name", - '#type' => 'textfield', - '#default_value' => $item_vals['sourcename'] ?? '', - ]; - $elements['sourceversion'] = [ - '#type' => 'textfield', - '#default_value' => $item_vals['sourceversion'] ?? '', - '#title' => 'Local Source Version', - ]; - - return $elements; - } - - - /** - * {@inheritDoc} - */ - public function massageFormValues(array $values, array $form, FormStateInterface $form_state) { - - // Remove any empty values that aren't mapped to a record id. - foreach ($values as $val_key => $value) { - $values[$val_key]['programversion'] = $value['programversion']; - $values[$val_key]['sourceuri'] = $value['sourceuri']; - $values[$val_key]['sourcename'] = $value['sourcename']; - $values[$val_key]['sourceversion'] = $value['sourceversion']; - } - return $values; - } - -} \ No newline at end of file