function views_plugin_display::get_plugin in Views (for Drupal 7) 6.3
Same name and namespace in other branches
- 6.2 plugins/views_plugin_display.inc \views_plugin_display::get_plugin()
- 7.3 plugins/views_plugin_display.inc \views_plugin_display::get_plugin()
Get the instance of a plugin, for example style or row.
Parameters
string $type: The type of the plugin.
string $name: The name of the plugin defined in hook_views_plugins.
Return value
views_plugin|FALSE
17 calls to views_plugin_display::get_plugin()
- views_plugin_display::access in plugins/
views_plugin_display.inc - Determine if the user has access to this display of the view.
- views_plugin_display::export_plugin in plugins/
views_plugin_display.inc - Special handling for plugin export
- views_plugin_display::export_style in plugins/
views_plugin_display.inc - Special handling for the style export.
- views_plugin_display::options_form in plugins/
views_plugin_display.inc - Provide the default form for setting options.
- views_plugin_display::options_submit in plugins/
views_plugin_display.inc - Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.
File
- plugins/
views_plugin_display.inc, line 768 - Contains the base display plugin.
Class
- views_plugin_display
- The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.
Code
function get_plugin($type = 'style', $name = NULL) {
static $cache = array();
if (!isset($cache[$type][$name])) {
switch ($type) {
case 'style':
case 'row':
$option_name = $type . '_plugin';
$options = $this
->get_option($type . '_options');
if (!$name) {
$name = $this
->get_option($option_name);
}
break;
case 'query':
$views_data = views_fetch_data($this->view->base_table);
$name = !empty($views_data['table']['base']['query class']) ? $views_data['table']['base']['query class'] : 'views_query';
default:
$option_name = $type;
$options = $this
->get_option($type);
if (!$name) {
$name = $options['type'];
}
// access & cache store their options as siblings with the
// type; all others use an 'options' array.
if ($type != 'access' && $type != 'cache') {
$options = $options['options'];
}
}
$plugin = views_get_plugin($type, $name);
if (!$plugin) {
return;
}
if ($type != 'query') {
$plugin
->init($this->view, $this->display, $options);
}
else {
$display_id = $this
->is_defaulted($option_name) ? $this->display->id : 'default';
$plugin->localization_keys = array(
$display_id,
$type,
);
if (!isset($this->base_field)) {
$views_data = views_fetch_data($this->view->base_table);
$this->view->base_field = $views_data['table']['base']['field'];
}
$plugin
->init($this->view->base_table, $this->view->base_field, $options);
}
$cache[$type][$name] = $plugin;
}
return $cache[$type][$name];
}