class MediaBrowserView in D7 Media 7.4
Same name and namespace in other branches
- 7.2 includes/MediaBrowserView.inc \MediaBrowserView
- 7.3 includes/MediaBrowserView.inc \MediaBrowserView
Media browser plugin for displaying a specific view and display.
Hierarchy
- class \MediaBrowserPlugin implements MediaBrowserPluginInterface
- class \MediaBrowserView
Expanded class hierarchy of MediaBrowserView
1 string reference to 'MediaBrowserView'
- media_media_browser_plugin_info in ./
media.media.inc - Implements hook_media_browser_plugin_info().
File
- includes/
MediaBrowserView.inc, line 11 - Definition of MediaBrowserView.
View source
class MediaBrowserView extends MediaBrowserPlugin {
/**
* The view object from views_get_view() for this plugin.
*
* @var view
*/
protected $view;
/**
* Implements MediaBrowserPluginInterface::__construct().
*/
public function __construct($info, $params) {
parent::__construct($info, $params);
// Set up the view object with the proper display.
if ($view = views_get_view($info['view_name'])) {
$display_id = !empty($info['view_display_id']) ? $info['view_display_id'] : NULL;
if ($view
->set_display($display_id)) {
$this->view = $view;
}
}
}
/**
* Implements MediaBrowserPluginInterface::access().
*/
public function access($account = NULL) {
return !empty($this->view) && $this->view
->access($this->view->current_display, $account);
}
/**
* Implements MediaBrowserPlugin::view().
*/
public function view() {
if (!empty($this->view)) {
$build['#markup'] = $this->view
->preview();
// Allow the View title to override the plugin title.
if ($title = $this->view
->get_title()) {
$build['#title'] = $title;
}
return $build;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MediaBrowserPlugin:: |
protected | property | The plugin metadata array from hook_media_browser_plugin_info(). | |
MediaBrowserPlugin:: |
protected | property | The parameters for current media browser from media_get_browser_params(). | |
MediaBrowserView:: |
protected | property | The view object from views_get_view() for this plugin. | |
MediaBrowserView:: |
public | function |
Implements MediaBrowserPluginInterface::access(). Overrides MediaBrowserPlugin:: |
|
MediaBrowserView:: |
public | function |
Implements MediaBrowserPlugin::view(). Overrides MediaBrowserPlugin:: |
|
MediaBrowserView:: |
public | function |
Implements MediaBrowserPluginInterface::__construct(). Overrides MediaBrowserPlugin:: |