function LinkitSearchPluginEntity::__construct in Linkit 7.3
Overrides LinkitSearchPlugin::__construct().
Initialize this plugin with the plugin, profile, and entity specific variables.
Parameters
array $plugin: The plugin array.
LinkitProfile object $profile: The Linkit profile to use.
Overrides LinkitSearchPlugin::__construct
2 calls to LinkitSearchPluginEntity::__construct()
- LinkitSearchPluginTaxonomy_term::__construct in plugins/
linkit_search/ taxonomy_term.class.php - Overrides LinkitSearchPluginEntity::__construct().
- LinkitSearchPluginUser::__construct in plugins/
linkit_search/ user.class.php - Overrides LinkitSearchPluginEntity::__construct().
2 methods override LinkitSearchPluginEntity::__construct()
- LinkitSearchPluginTaxonomy_term::__construct in plugins/
linkit_search/ taxonomy_term.class.php - Overrides LinkitSearchPluginEntity::__construct().
- LinkitSearchPluginUser::__construct in plugins/
linkit_search/ user.class.php - Overrides LinkitSearchPluginEntity::__construct().
File
- plugins/
linkit_search/ entity.class.php, line 60 - Define Linkit entity search plugin class.
Class
- LinkitSearchPluginEntity
- Represents a Linkit entity search plugin.
Code
function __construct($plugin, LinkitProfile $profile) {
parent::__construct($plugin, $profile);
// Load the corresponding entity info.
$this->entity_info = entity_get_info($this->plugin['entity_type']);
// Set bundle key name.
if (isset($this->entity_info['entity keys']['bundle']) && !isset($this->entity_key_bundle)) {
$this->entity_key_bundle = $this->entity_info['entity keys']['bundle'];
}
// Set the label field name.
if (!isset($this->entity_field_label)) {
// Check that the entity has a label in entity keys.
// If not, Linkit don't know what to search for.
if (!isset($this->entity_info['entity keys']['label'])) {
// This is only used when building the plugin list.
$this->unusable = TRUE;
}
else {
$this->entity_field_label = $this->entity_info['entity keys']['label'];
}
}
// Make a shortcut for the profile data settings for this plugin.
$this->conf = isset($this->profile->data[$this->plugin['name']]) ? $this->profile->data[$this->plugin['name']] : array();
}