public function FacetapiAdapter::loadUrlProcessor in Facet API 7.2
Same name and namespace in other branches
- 7 plugins/facetapi/adapter.inc \FacetapiAdapter::loadUrlProcessor()
Loads the URL processor associated with this adapter.
Use FacetapiAdapter::getUrlProcessor() in favor of this method when getting the adapter for use in other classes. This method is separated out form the constructor for testing purposes only.
Parameters
string $id: The machine name of the url processor plugin.
Return value
FacetapiUrlProcessor An instance of the url processor plugin.
See also
http://drupal.org/node/1668484
1 call to FacetapiAdapter::loadUrlProcessor()
- FacetapiAdapter::__construct in plugins/
facetapi/ adapter.inc - Constructs a FacetapiAdapter object.
File
- plugins/
facetapi/ adapter.inc, line 204 - Adapter plugin and adapter related classes.
Class
- FacetapiAdapter
- Abstract class extended by Facet API adapters.
Code
public function loadUrlProcessor($id) {
// Ensure all required url processor classes are loaded.
// See http://drupal.org/node/1306198
$plugin_path = dirname(__FILE__);
require_once $plugin_path . '/url_processor.inc';
require_once $plugin_path . '/url_processor_standard.inc';
// Get the url processor plugin class. If the class for the passed plugin
// cannot be retrieved, log the error and load the standard plugin.
if (!($class = ctools_plugin_load_class('facetapi', 'url_processors', $id, 'handler'))) {
if ('standard' != $id) {
watchdog('facetapi', 'Url processor plugin "@id" not valid, loading standard plugin.', array(
'@id' => $id,
), WATCHDOG_ERROR);
$class = ctools_plugin_load_class('facetapi', 'url_processors', 'standard', 'handler');
}
else {
// The plugins are not registered, probably because CTools is weighted
// heavier than Facet API. It is still unclear why this even matters.
// Let's raise a call to action and explicitly set the class to prevent
// fatal errors.
// @see http://drupal.org/node/1816110
watchdog('facetapi', 'Url processor plugins are not yet registered, loading standard plugin. Please visit <a href="@url">@url</a> for more information.', array(
'@id' => $id,
'@url' => 'http://drupal.org/node/1816110',
), WATCHDOG_ERROR);
$class = 'FacetapiUrlProcessorStandard';
}
}
// Instantiates and initializes plugin.
return new $class($this);
}