You are here

protected function LinkitSearchPluginFile::getDefaultUrlType in Linkit 7.3

Gets the default URL type to use if no URL type has been explicitly set.

Return value

string The URL type

2 calls to LinkitSearchPluginFile::getDefaultUrlType()
LinkitSearchPluginFile::buildSettingsForm in plugins/linkit_search/file.class.php
Overrides LinkitSearchPluginEntity::buildSettingsForm().
LinkitSearchPluginFile::createPath in plugins/linkit_search/file.class.php
Overrides LinkitSearchPluginEntity::createPath().

File

plugins/linkit_search/file.class.php, line 208
Define Linkit file search plugin class.

Class

LinkitSearchPluginFile
Reprecents a Linkit file search plugin.

Code

protected function getDefaultUrlType() {
  $info = entity_get_info('file');
  $callback = $info['uri callback'];
  if ($callback == 'entity_metadata_uri_file') {

    // The Drupal core file URI callback would be used if we were to use the
    // "Entity view page" URL mode, which generates absolute URLs to files.
    // The "Direct link" URL mode is preferable in this case as it generates
    // relative links.
    return LINKIT_FILE_URL_TYPE_DIRECT;
  }
  else {

    // We use a custom URI callback such as in Media 1.x or File Entity 2.x.
    // The "Entity view page" URL mode is preferable in this case.
    return LINKIT_FILE_URL_TYPE_ENTITY;
  }
}