function LinkitSearchPluginEntity::createPath in Linkit 7.3
Create an uri for an entity.
Parameters
$entity: The entity to get the path from.
Return value
A string containing the path of the entity, NULL if the entity has no uri of its own.
2 calls to LinkitSearchPluginEntity::createPath()
- LinkitSearchPluginEntity::fetchResults in plugins/
linkit_search/ entity.class.php  - Implements LinkitSearchPluginInterface::fetchResults().
 - LinkitSearchPluginFile::createPath in plugins/
linkit_search/ file.class.php  - Overrides LinkitSearchPluginEntity::createPath().
 
1 method overrides LinkitSearchPluginEntity::createPath()
- LinkitSearchPluginFile::createPath in plugins/
linkit_search/ file.class.php  - Overrides LinkitSearchPluginEntity::createPath().
 
File
- plugins/
linkit_search/ entity.class.php, line 133  - Define Linkit entity search plugin class.
 
Class
- LinkitSearchPluginEntity
 - Represents a Linkit entity search plugin.
 
Code
function createPath($entity) {
  // Create the URI for the entity.
  $uri = entity_uri($this->plugin['entity_type'], $entity);
  $options = array();
  // Handle multilingual sites.
  if (isset($entity->language) && $entity->language != LANGUAGE_NONE && drupal_multilingual() && language_negotiation_get_any(LOCALE_LANGUAGE_NEGOTIATION_URL)) {
    $languages = language_list('enabled');
    // Only use enabled languages.
    $languages = $languages[1];
    if ($languages && isset($languages[$entity->language])) {
      $options['language'] = $languages[$entity->language];
    }
  }
  // Process the uri with the insert plugin.
  $path = linkit_get_insert_plugin_processed_path($this->profile, $uri['path'], $options);
  return $path;
}