function views_handler_argument::get_plugin

Same name in other branches
  1. 6.x-3.x handlers/views_handler_argument.inc \views_handler_argument::get_plugin()

Get the display or row plugin, if it exists.

9 calls to views_handler_argument::get_plugin()
views_handler_argument::default_argument_form in handlers/views_handler_argument.inc
Provide a form for selecting the default argument.
views_handler_argument::default_summary_form in handlers/views_handler_argument.inc
Form for selecting further summary options.
views_handler_argument::export_plugin in handlers/views_handler_argument.inc
Generic plugin export handler.
views_handler_argument::get_default_argument in handlers/views_handler_argument.inc
Get a default argument, if available.
views_handler_argument::options_form in handlers/views_handler_argument.inc
Build the options form.

... See full list

File

handlers/views_handler_argument.inc, line 1261

Class

views_handler_argument
Base class for arguments.

Code

public function get_plugin($type = 'argument default', $name = NULL) {
    $options = array();
    switch ($type) {
        case 'argument default':
            $plugin_name = $this->options['default_argument_type'];
            $options_name = 'default_argument_options';
            break;
        case 'argument validator':
            $plugin_name = $this->options['validate']['type'];
            $options_name = 'validate_options';
            break;
        case 'style':
            $plugin_name = $this->options['summary']['format'];
            $options_name = 'summary_options';
            break;
    }
    if (!$name) {
        $name = $plugin_name;
    }
    // We only fetch the options if we're fetching the plugin actually in use.
    if ($name == $plugin_name) {
        $options = $this->options[$options_name];
    }
    $plugin = views_get_plugin($type, $name);
    if ($plugin) {
        // Style plugins expects different parameters as argument related plugins.
        if ($type == 'style') {
            $plugin->init($this->view, $this->view->display_handler->display, $options);
        }
        else {
            $plugin->init($this->view, $this, $options);
        }
        return $plugin;
    }
}