You are here

function _biblio_feeds_set__type_target in Bibliography Module 7.2

Same name and namespace in other branches
  1. 7 includes/biblio.feeds.inc \_biblio_feeds_set__type_target()
1 string reference to '_biblio_feeds_set__type_target'
_biblio_feeds_processor_targets_alter in includes/biblio.feeds.inc

File

includes/biblio.feeds.inc, line 32

Code

function _biblio_feeds_set__type_target($source, $entity, $target, $value) {
  static $types = array();
  if (isset($value[0]) && !empty($value[0])) {
    if (empty($types)) {
      $result = db_query('SELECT t.* FROM {biblio_types} as t WHERE t.tid > 0');
      foreach ($result as $row) {
        $types[$row->tid] = str_replace(" ", "_", strtolower($row->name));
      }
    }
    $type = array_search($value[0], $types);
    $entity->biblio_type = !empty($type) ? $type : 129;
  }
}