You are here

abstract public function MediaBrowserPlugin::view in D7 Media 7.4

Same name and namespace in other branches
  1. 7.2 includes/MediaBrowserPlugin.inc \MediaBrowserPlugin::view()
  2. 7.3 includes/MediaBrowserPlugin.inc \MediaBrowserPlugin::view()

Provide a render array to display the plugin in a media browser.

This render array will be a jQuery tab in the media browser.

Some elements are special:

  • #settings: Drupal.settings.media.browser.$key (where key is the array key).
  • #callback: If provided, will make the tab an "ajax" tab.
  • #title: If provided, will be used as the tab's title. Otherwise the 'title' value from the plugin's hook_media_browser_plugin_info() will be used.
  • #weight: If provided, will be used to order the tabs between each other. A lower weight will be displayed first while a higher weight will be displayed later. If not provided, and there is a 'weight' value in the plugin's hook_media_browser_plugin_info() then it will be used, otherwise a default of 0 will be used.
  • form: If the plugin is to display a native Drupal form, then the output of drupal_get_form should be returned into the 'form' render key. If a form's callback isn't normally loaded, module_load_include() should be used to ensure that the form can be displayed.

Example usage:

module_load_include('inc', 'mymodule', 'mymodule.pages');
$build['#attached']['js'][] = drupal_get_path('module', 'mymodule') . '/js/mymodule.media.browser.js';
$build['form'] = drupal_get_form('mymodule_media_form');
return $build;

Return value

array Renderable array.

4 methods override MediaBrowserPlugin::view()
MediaBrowserInternet::view in modules/media_internet/includes/MediaBrowserInternet.inc
Implements MediaBrowserPlugin::view().
MediaBrowserUpload::view in includes/MediaBrowserUpload.inc
Implements MediaBrowserPlugin::view().
MediaBrowserView::view in includes/MediaBrowserView.inc
Implements MediaBrowserPlugin::view().
MediaModuleTest::view in tests/includes/MediaModuleTest.inc
Implements MediaBrowserPlugin::view().

File

includes/MediaBrowserPlugin.inc, line 84
Definition of MediaBrowserPlugin.

Class

MediaBrowserPlugin
Defines a Media browser plugin base class.

Code

public abstract function view();