You are here

function _tvi_get_xid in Taxonomy Views Integrator 7

Convert the entity id into its best parameter.

Vocabulary's vid converts to machine_name. Term's tid converts to uuid if set.

Parameters

string|int $xid: The identifier of the object for which we are loading these settings. It can be an integer and/or a UUID.

string $type: The type of the object for which we are loading these settings. It can be TVI_TYPE_TERM or TVI_TYPE_VOCAB.

Return value

string Vocabulary machine_name or term uuid.

3 calls to _tvi_get_xid()
tvi_load_settings in includes/tvi.query.inc
Load a setting from the database or return a default.
tvi_remove_settings in includes/tvi.query.inc
Delete settings information for a taxonomy term/vocabulary in the database.
tvi_submit_handler in includes/tvi.admin.inc
Save the view taxonomy data to the database.

File

includes/tvi.query.inc, line 160
Database interface for the tvi module.

Code

function _tvi_get_xid($xid, $type = TVI_TYPE_TERM) {
  if ($type == TVI_TYPE_VOCAB) {
    $vocabulary = taxonomy_vocabulary_load($xid);
    if (!empty($vocabulary->machine_name)) {
      $xid = $vocabulary->machine_name;
    }
  }
  elseif ($type == TVI_TYPE_TERM && module_exists('uuid') && $xid != '_autocreate') {
    $uuids = entity_get_uuid_by_id('taxonomy_term', array(
      $xid,
    ));
    $uuid = reset($uuids);
    if (!empty($uuid)) {
      $xid = $uuid;
    }
  }
  return $xid;
}