Skip to content

Commit

Permalink
Merge pull request #1371 from tripal/1370-tv3-skip-if-missing-field_name
Browse files Browse the repository at this point in the history
Issue 1370 skip if missing field_name
  • Loading branch information
dsenalik committed Dec 22, 2022
2 parents 13c87d7 + d9c4839 commit 98b6160
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions tripal/api/tripal.entities.api.inc
Original file line number Diff line number Diff line change
Expand Up @@ -678,24 +678,26 @@ function tripal_tripal_cron_notification() {
$info = $function($entity_type, $bundle);
drupal_alter('bundle_instances_info', $info, $bundle, $term);
foreach ($info as $field_name => $details) {

// If the field is already attached to this bundle then skip it.
$field = field_info_field($details['field_name']);
if ($field and array_key_exists('bundles', $field) and
array_key_exists('TripalEntity', $field['bundles']) and
in_array($bundle->name, $field['bundles']['TripalEntity'])) {
continue;
if (isset($details['field_name'])) {

// If the field is already attached to this bundle then skip it.
$field = field_info_field($details['field_name']);
if ($field and array_key_exists('bundles', $field) and
array_key_exists('TripalEntity', $field['bundles']) and
in_array($bundle->name, $field['bundles']['TripalEntity'])) {
continue;
}

// Create notification that new fields exist.
$detail_info = ' Tripal has detected a new field ' . $details['field_name'] . ' for ' . $bundle->label . ' content type is available for import.';
$title = 'New field available for import';
$actions['Import'] = 'admin/import/field/' . $details['field_name'] . '/' . $bundle->name . '/' . $module . '/instance';
$type = 'Field';
$submitter_id = $details['field_name'] . '-' . $bundle_name->name . '-' . $module;

tripal_add_notification($title, $detail_info, $type, $actions, $submitter_id);
$num_created++;
}

// Create notification that new fields exist.
$detail_info = ' Tripal has detected a new field ' . $details['field_name'] . ' for ' . $bundle->label . ' content type is available for import.';
$title = 'New field available for import';
$actions['Import'] = 'admin/import/field/' . $details['field_name'] . '/' . $bundle->name . '/' . $module . '/instance';
$type = 'Field';
$submitter_id = $details['field_name'] . '-' . $bundle_name->name . '-' . $module;

tripal_add_notification($title, $detail_info, $type, $actions, $submitter_id);
$num_created++;
}
}
}
Expand Down

0 comments on commit 98b6160

Please sign in to comment.