/** * Set all enabled search plugins. */ public function setEnabledsearchPlugins() { // Sort plugins by weight. uasort($this->data['search_plugins'], 'linkit_sort_plugins_by_weight'); foreach ($this->data['search_plugins'] as $plugin_name => $plugin) { if ($plugin['enabled']) { // Load plugin definition. $plugin_definition = linkit_search_plugin_load($plugin_name); // Get a Linkit search plugin object. $search_plugin = LinkitSearchPlugin::factory($plugin_definition, $this); // Only register none broken plugins. if ($search_plugin->broken() !== TRUE) { $this->enabled_search_plugins[$plugin_name] = $search_plugin; } } } }
/** * Overrides LinkitSearchPlugin::__construct(). * * Initialize this plugin with the plugin, profile, and entity specific * variables. * * @param array $plugin * The plugin array. * * @param LinkitProfile object $profile * The Linkit profile to use. */ 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(); }