00001 <?php
00008
00009 views_include('base');
00010
00014 function views_views_plugins() {
00015 $js_path = drupal_get_path('module', 'ctools') . '/js';
00016 $plugins = array(
00017
00018 'display' => array(
00019
00020 'default' => array(
00021 'title' => t('Master'),
00022 'help' => t('Default settings for this view.'),
00023 'handler' => 'views_plugin_display_default',
00024 'theme' => 'views_view',
00025 'no ui' => TRUE,
00026 'no remove' => TRUE,
00027 'js' => array('misc/form.js', 'misc/collapse.js', 'misc/textarea.js', 'misc/tabledrag.js', 'misc/autocomplete.js', "$js_path/dependent.js"),
00028 'use ajax' => TRUE,
00029 'use pager' => TRUE,
00030 'use more' => TRUE,
00031 'accept attachments' => TRUE,
00032 'help topic' => 'display-default',
00033 ),
00034 'page' => array(
00035 'title' => t('Page'),
00036 'help' => t('Display the view as a page, with a URL and menu links.'),
00037 'handler' => 'views_plugin_display_page',
00038 'theme' => 'views_view',
00039 'uses hook menu' => TRUE,
00040 'contextual links locations' => array('page'),
00041 'use ajax' => TRUE,
00042 'use pager' => TRUE,
00043 'use more' => TRUE,
00044 'accept attachments' => TRUE,
00045 'admin' => t('Page'),
00046 'help topic' => 'display-page',
00047 ),
00048 'block' => array(
00049 'title' => t('Block'),
00050 'help' => t('Display the view as a block.'),
00051 'handler' => 'views_plugin_display_block',
00052 'theme' => 'views_view',
00053 'uses hook block' => TRUE,
00054 'contextual links locations' => array('block'),
00055 'use ajax' => TRUE,
00056 'use pager' => TRUE,
00057 'use more' => TRUE,
00058 'accept attachments' => TRUE,
00059 'admin' => t('Block'),
00060 'help topic' => 'display-block',
00061 ),
00062 'attachment' => array(
00063 'title' => t('Attachment'),
00064 'help' => t('Attachments added to other displays to achieve multiple views in the same view.'),
00065 'handler' => 'views_plugin_display_attachment',
00066 'theme' => 'views_view',
00067 'contextual links locations' => array(),
00068 'use ajax' => TRUE,
00069 'use pager' => FALSE,
00070 'use more' => TRUE,
00071 'accept attachments' => FALSE,
00072 'help topic' => 'display-attachment',
00073 ),
00074 'feed' => array(
00075 'title' => t('Feed'),
00076 'help' => t('Display the view as a feed, such as an RSS feed.'),
00077 'handler' => 'views_plugin_display_feed',
00078 'uses hook menu' => TRUE,
00079 'use ajax' => FALSE,
00080 'use pager' => FALSE,
00081 'accept attachments' => FALSE,
00082 'admin' => t('Feed'),
00083 'help topic' => 'display-feed',
00084 ),
00085 'embed' => array(
00086 'title' => t('Embed'),
00087 'help' => t('Provide a display which can be embedded using the views api.'),
00088 'handler' => 'views_plugin_display_embed',
00089 'uses hook menu' => FALSE,
00090 'use ajax' => TRUE,
00091 'use pager' => TRUE,
00092 'accept attachments' => FALSE,
00093 'admin' => t('Embed'),
00094 'no ui' => !variable_get('views_ui_display_embed', FALSE),
00095 ),
00096 ),
00097 'display_extender' => array(
00098
00099 'default' => array(
00100 'title' => t('Empty display extender'),
00101 'help' => t('Default settings for this view.'),
00102 'handler' => 'views_plugin_display_extender',
00103
00104 'enabled' => FALSE,
00105 'no ui' => TRUE,
00106 ),
00107 ),
00108 'style' => array(
00109
00110 'default' => array(
00111 'title' => t('Unformatted list'),
00112 'help' => t('Displays rows one after another.'),
00113 'handler' => 'views_plugin_style_default',
00114 'theme' => 'views_view_unformatted',
00115 'uses row plugin' => TRUE,
00116 'uses row class' => TRUE,
00117 'uses grouping' => TRUE,
00118 'uses options' => TRUE,
00119 'type' => 'normal',
00120 'help topic' => 'style-unformatted',
00121 ),
00122 'list' => array(
00123 'title' => t('HTML list'),
00124 'help' => t('Displays rows as an HTML list.'),
00125 'handler' => 'views_plugin_style_list',
00126 'theme' => 'views_view_list',
00127 'uses row plugin' => TRUE,
00128 'uses row class' => TRUE,
00129 'uses options' => TRUE,
00130 'type' => 'normal',
00131 'help topic' => 'style-list',
00132 ),
00133 'grid' => array(
00134 'title' => t('Grid'),
00135 'help' => t('Displays rows in a grid.'),
00136 'handler' => 'views_plugin_style_grid',
00137 'theme' => 'views_view_grid',
00138 'uses row plugin' => TRUE,
00139 'uses row class' => TRUE,
00140 'uses options' => TRUE,
00141 'type' => 'normal',
00142 'help topic' => 'style-grid',
00143 ),
00144 'table' => array(
00145 'title' => t('Table'),
00146 'help' => t('Displays rows in a table.'),
00147 'handler' => 'views_plugin_style_table',
00148 'theme' => 'views_view_table',
00149 'uses row plugin' => FALSE,
00150 'uses row class' => TRUE,
00151 'uses fields' => TRUE,
00152 'uses options' => TRUE,
00153 'type' => 'normal',
00154 'help topic' => 'style-table',
00155 ),
00156 'default_summary' => array(
00157 'title' => t('List'),
00158 'help' => t('Displays the default summary as a list.'),
00159 'handler' => 'views_plugin_style_summary',
00160 'theme' => 'views_view_summary',
00161 'type' => 'summary',
00162 'uses options' => TRUE,
00163 'help topic' => 'style-summary',
00164 ),
00165 'unformatted_summary' => array(
00166 'title' => t('Unformatted'),
00167 'help' => t('Displays the summary unformatted, with option for one after another or inline.'),
00168 'handler' => 'views_plugin_style_summary_unformatted',
00169 'theme' => 'views_view_summary_unformatted',
00170 'type' => 'summary',
00171 'uses options' => TRUE,
00172 'help topic' => 'style-summary-unformatted',
00173 ),
00174 'rss' => array(
00175 'title' => t('RSS Feed'),
00176 'help' => t('Generates an RSS feed from a view.'),
00177 'handler' => 'views_plugin_style_rss',
00178 'theme' => 'views_view_rss',
00179 'uses row plugin' => TRUE,
00180 'uses options' => TRUE,
00181 'type' => 'feed',
00182 'help topic' => 'style-rss',
00183 ),
00184 ),
00185 'row' => array(
00186 'fields' => array(
00187 'title' => t('Fields'),
00188 'help' => t('Displays the fields with an optional template.'),
00189 'handler' => 'views_plugin_row_fields',
00190 'theme' => 'views_view_fields',
00191 'uses fields' => TRUE,
00192 'uses options' => TRUE,
00193 'type' => 'normal',
00194 'help topic' => 'style-row-fields',
00195 ),
00196 ),
00197 'argument default' => array(
00198 'parent' => array(
00199 'no ui' => TRUE,
00200 'handler' => 'views_plugin_argument_default',
00201 'parent' => '',
00202 ),
00203 'fixed' => array(
00204 'title' => t('Fixed value'),
00205 'handler' => 'views_plugin_argument_default_fixed',
00206 ),
00207 'php' => array(
00208 'title' => t('PHP Code'),
00209 'handler' => 'views_plugin_argument_default_php',
00210 ),
00211 'raw' => array(
00212 'title' => t('Raw value from URL'),
00213 'handler' => 'views_plugin_argument_default_raw',
00214 ),
00215 ),
00216 'argument validator' => array(
00217 'php' => array(
00218 'title' => t('PHP Code'),
00219 'handler' => 'views_plugin_argument_validate_php',
00220 ),
00221 'numeric' => array(
00222 'title' => t('Numeric'),
00223 'handler' => 'views_plugin_argument_validate_numeric',
00224 ),
00225 ),
00226 'access' => array(
00227 'none' => array(
00228 'title' => t('None'),
00229 'help' => t('Will be available to all users.'),
00230 'handler' => 'views_plugin_access_none',
00231 'help topic' => 'access-none',
00232 ),
00233 'role' => array(
00234 'title' => t('Role'),
00235 'help' => t('Access will be granted to users with any of the specified roles.'),
00236 'handler' => 'views_plugin_access_role',
00237 'uses options' => TRUE,
00238 'help topic' => 'access-role',
00239 ),
00240 'perm' => array(
00241 'title' => t('Permission'),
00242 'help' => t('Access will be granted to users with the specified permission string.'),
00243 'handler' => 'views_plugin_access_perm',
00244 'uses options' => TRUE,
00245 'help topic' => 'access-perm',
00246 ),
00247 ),
00248 'query' => array(
00249 'parent' => array(
00250 'no ui' => TRUE,
00251 'handler' => 'views_plugin_query',
00252 'parent' => '',
00253 ),
00254 'views_query' => array(
00255 'title' => t('SQL Query'),
00256 'help' => t('Query will be generated and run using the Drupal database API.'),
00257 'handler' => 'views_plugin_query_default'
00258 ),
00259 ),
00260 'cache' => array(
00261 'parent' => array(
00262 'no ui' => TRUE,
00263 'handler' => 'views_plugin_cache',
00264 'parent' => '',
00265 ),
00266 'none' => array(
00267 'title' => t('None'),
00268 'help' => t('No caching of Views data.'),
00269 'handler' => 'views_plugin_cache_none',
00270 'help topic' => 'cache-none',
00271 ),
00272 'time' => array(
00273 'title' => t('Time-based'),
00274 'help' => t('Simple time-based caching of data.'),
00275 'handler' => 'views_plugin_cache_time',
00276 'uses options' => TRUE,
00277 'help topic' => 'cache-time',
00278 ),
00279 ),
00280 'exposed_form' => array(
00281 'parent' => array(
00282 'no ui' => TRUE,
00283 'handler' => 'views_plugin_exposed_form',
00284 'parent' => '',
00285 ),
00286 'basic' => array(
00287 'title' => t('Basic'),
00288 'help' => t('Basic exposed form'),
00289 'handler' => 'views_plugin_exposed_form_basic',
00290 'uses options' => TRUE,
00291 'help topic' => 'exposed-form-basic',
00292 ),
00293 'input_required' => array(
00294 'title' => t('Input required'),
00295 'help' => t('An exposed form that only renders a view if the form contains user input.'),
00296 'handler' => 'views_plugin_exposed_form_input_required',
00297 'uses options' => TRUE,
00298 'help topic' => 'exposed-form-input-required',
00299 ),
00300 ),
00301 'pager' => array(
00302 'parent' => array(
00303 'no ui' => TRUE,
00304 'handler' => 'views_plugin_pager',
00305 'parent' => '',
00306 ),
00307 'none' => array(
00308 'title' => t('Display all items'),
00309 'help' => t("Display all items that this view might find"),
00310 'handler' => 'views_plugin_pager_none',
00311 'help topic' => 'pager-none',
00312 'uses options' => TRUE,
00313 'type' => 'basic',
00314 ),
00315 'some' => array(
00316 'title' => t('Display a specified number of items'),
00317 'help' => t('Display a limited number items that this view might find.'),
00318 'handler' => 'views_plugin_pager_some',
00319 'help topic' => 'pager-some',
00320 'uses options' => TRUE,
00321 'type' => 'basic',
00322 ),
00323 'full' => array(
00324 'title' => t('Paged output, full pager'),
00325 'short title' => t('Full'),
00326 'help' => t('Paged output, full Drupal style'),
00327 'handler' => 'views_plugin_pager_full',
00328 'help topic' => 'pager-full',
00329 'uses options' => TRUE,
00330 ),
00331 'mini' => array(
00332 'title' => t('Paged output, mini pager'),
00333 'short title' => t('Mini'),
00334 'help' => t('Use the mini pager output.'),
00335 'handler' => 'views_plugin_pager_mini',
00336 'help topic' => 'pager-mini',
00337 'uses options' => TRUE,
00338 'parent' => 'full',
00339 ),
00340 ),
00341 'localization' => array(
00342 'parent' => array(
00343 'no ui' => TRUE,
00344 'handler' => 'views_plugin_localization',
00345 'parent' => '',
00346 ),
00347 'none' => array(
00348 'title' => t('None'),
00349 'help' => t('Do not pass admin strings for translation.'),
00350 'handler' => 'views_plugin_localization_none',
00351 'help topic' => 'localization-none',
00352 ),
00353 'core' => array(
00354 'title' => t('Core'),
00355 'help' => t("Use Drupal core t() function. Not recommended, as it doesn't support updates to existing strings."),
00356 'handler' => 'views_plugin_localization_core',
00357 'help topic' => 'localization-core',
00358 ),
00359 ),
00360 );
00361
00362 if (!module_exists('i18nviews')) {
00363 $plugins['localization']['core']['help'] .= ' ' . t('If you need to translate Views labels into other languages, consider installing the <a href="!path">Internationalization</a> package\'s Views translation module.', array('!path' => url('http://drupal.org/project/i18n', array('absolute' => TRUE))));
00364 }
00365
00366 if (module_invoke('ctools', 'api_version', '1.3')) {
00367 $plugins['style']['jump_menu_summary'] = array(
00368 'title' => t('Jump menu'),
00369 'help' => t('Puts all of the results into a select box and allows the user to go to a different page based upon the results.'),
00370 'handler' => 'views_plugin_style_summary_jump_menu',
00371 'theme' => 'views_view_summary_jump_menu',
00372 'type' => 'summary',
00373 'uses options' => TRUE,
00374 'help topic' => 'style-summary-jump-menu',
00375 );
00376 $plugins['style']['jump_menu'] = array(
00377 'title' => t('Jump menu'),
00378 'help' => t('Puts all of the results into a select box and allows the user to go to a different page based upon the results.'),
00379 'handler' => 'views_plugin_style_jump_menu',
00380 'theme' => 'views_view_jump_menu',
00381 'uses row plugin' => TRUE,
00382 'uses fields' => TRUE,
00383 'uses options' => TRUE,
00384 'type' => 'normal',
00385 'help topic' => 'style-jump-menu',
00386 );
00387 }
00388
00389 return $plugins;
00390 }
00391
00397 function views_discover_plugins() {
00398 $cache = array('display' => array(), 'style' => array(), 'row' => array(), 'argument default' => array(), 'argument validator' => array(), 'access' => array(), 'cache' => array(), 'exposed_form' => array());
00399
00400 foreach (module_implements('views_plugins') as $module) {
00401 $function = $module . '_views_plugins';
00402 $result = $function();
00403 if (!is_array($result)) {
00404 continue;
00405 }
00406
00407 $module_dir = isset($result['module']) ? $result['module'] : $module;
00408
00409 if ($module_dir == 'views') {
00410 $theme_path = drupal_get_path('module', $module_dir) . '/theme';
00411 $theme_file = 'theme.inc';
00412 $path = drupal_get_path('module', $module_dir) . '/plugins';
00413 }
00414 else {
00415 $theme_path = $path = drupal_get_path('module', $module_dir);
00416 $theme_file = "$module.views.inc";
00417 }
00418
00419 foreach ($result as $type => $info) {
00420 if ($type == 'module') {
00421 continue;
00422 }
00423 foreach ($info as $plugin => $def) {
00424 $def['module'] = $module_dir;
00425 if (!isset($def['theme path'])) {
00426 $def['theme path'] = $theme_path;
00427 }
00428 if (!isset($def['theme file'])) {
00429 $def['theme file'] = $theme_file;
00430 }
00431 if (!isset($def['path'])) {
00432 $def['path'] = $path;
00433 }
00434 if (!isset($def['file'])) {
00435 $def['file'] = $def['handler'] . '.inc';
00436 }
00437 if (!isset($def['parent'])) {
00438 $def['parent'] = 'parent';
00439 }
00440
00441 $def['name'] = $plugin;
00442
00443
00444 $cache[$type][$plugin] = $def;
00445 }
00446 }
00447 }
00448
00449
00450 drupal_alter('views_plugins', $cache);
00451 return $cache;
00452 }
00453
00457 class views_plugin extends views_object {
00463 var $view = NULL;
00464
00470 var $display = NULL;
00471
00475 var $plugin_type = NULL;
00476
00485 function options_form(&$form, &$form_state) {
00486
00487
00488
00489
00490 $form['#pre_render'][] = 'views_ui_pre_render_add_fieldset_markup';
00491 }
00492
00496 function options_validate(&$form, &$form_state) { }
00497
00501 function options_submit(&$form, &$form_state) { }
00502
00506 function query() { }
00507
00511 function theme_functions() {
00512 return views_theme_functions($this->definition['theme'], $this->view, $this->display);
00513 }
00514
00518 function additional_theme_functions() {
00519 $funcs = array();
00520 if (!empty($this->definition['additional themes'])) {
00521 foreach ($this->definition['additional themes'] as $theme => $type) {
00522 $funcs[] = views_theme_functions($theme, $this->view, $this->display);
00523 }
00524 }
00525 return $funcs;
00526 }
00527
00535 function validate() { return array(); }
00536
00540 function summary_title() {
00541 return t('Settings');
00542 }
00548 function plugin_title() {
00549 if (isset($this->definition['short title'])) {
00550 return check_plain($this->definition['short title']);
00551 }
00552 return check_plain($this->definition['title']);
00553 }
00554 }
00555
00559 function views_get_enabled_display_extenders() {
00560 $enabled = array_filter(variable_get('views_display_extenders', array()));
00561 $options = views_fetch_plugin_names('display_extender');
00562 foreach ($options as $name => $plugin) {
00563 $enabled[$name] = $name;
00564 }
00565
00566 return $enabled;
00567 }