00001 <?php
00002
00012 function views_views_plugins() {
00013 $path = drupal_get_path('module', 'views') . '/js';
00014
00015 $plugins = array(
00016 'module' => 'views',
00017 'display' => array(
00018 'parent' => array(
00019
00020
00021 'no ui' => TRUE,
00022 'handler' => 'views_plugin_display',
00023 'parent' => '',
00024 ),
00025 'default' => array(
00026 'title' => t('Defaults'),
00027 'help' => t('Default settings for this view.'),
00028 'handler' => 'views_plugin_display_default',
00029 'theme' => 'views_view',
00030 'no ui' => TRUE,
00031 'no remove' => TRUE,
00032 'js' => array('misc/collapse.js', 'misc/textarea.js', 'misc/tabledrag.js', 'misc/autocomplete.js', "$path/dependent.js"),
00033 'use ajax' => TRUE,
00034 'use pager' => TRUE,
00035 'use more' => TRUE,
00036 'accept attachments' => TRUE,
00037 'help topic' => 'display-default',
00038 ),
00039 'page' => array(
00040 'title' => t('Page'),
00041 'help' => t('Display the view as a page, with a URL and menu links.'),
00042 'handler' => 'views_plugin_display_page',
00043 'theme' => 'views_view',
00044 'uses hook menu' => TRUE,
00045 'use ajax' => TRUE,
00046 'use pager' => TRUE,
00047 'accept attachments' => TRUE,
00048 'admin' => t('Page'),
00049 'help topic' => 'display-page',
00050 ),
00051 'block' => array(
00052 'title' => t('Block'),
00053 'help' => t('Display the view as a block.'),
00054 'handler' => 'views_plugin_display_block',
00055 'theme' => 'views_view',
00056 'uses hook block' => TRUE,
00057 'use ajax' => TRUE,
00058 'use pager' => TRUE,
00059 'use more' => TRUE,
00060 'accept attachments' => TRUE,
00061 'admin' => t('Block'),
00062 'help topic' => 'display-block',
00063 ),
00064 'attachment' => array(
00065 'title' => t('Attachment'),
00066 'help' => t('Attachments added to other displays to achieve multiple views in the same view.'),
00067 'handler' => 'views_plugin_display_attachment',
00068 'theme' => 'views_view',
00069 'use ajax' => TRUE,
00070 'help topic' => 'display-attachment',
00071 ),
00072 'feed' => array(
00073 'title' => t('Feed'),
00074 'help' => t('Display the view as a feed, such as an RSS feed.'),
00075 'handler' => 'views_plugin_display_feed',
00076 'parent' => 'page',
00077 'uses hook menu' => TRUE,
00078 'use ajax' => FALSE,
00079 'use pager' => FALSE,
00080 'accept attachments' => FALSE,
00081 'admin' => t('Feed'),
00082 'help topic' => 'display-feed',
00083 ),
00084 ),
00085 'style' => array(
00086 'parent' => array(
00087
00088
00089 'no ui' => TRUE,
00090 'handler' => 'views_plugin_style',
00091 'parent' => '',
00092 ),
00093 'default' => array(
00094 'title' => t('Unformatted'),
00095 'help' => t('Displays rows one after another.'),
00096 'handler' => 'views_plugin_style_default',
00097 'theme' => 'views_view_unformatted',
00098 'uses row plugin' => TRUE,
00099 'uses grouping' => TRUE,
00100 'uses options' => TRUE,
00101 'type' => 'normal',
00102 'help topic' => 'style-unformatted',
00103 ),
00104 'list' => array(
00105 'title' => t('HTML List'),
00106 'help' => t('Displays rows as an HTML list.'),
00107 'handler' => 'views_plugin_style_list',
00108 'theme' => 'views_view_list',
00109 'uses row plugin' => TRUE,
00110 'uses options' => TRUE,
00111 'type' => 'normal',
00112 'help topic' => 'style-list',
00113 ),
00114 'grid' => array(
00115 'title' => t('Grid'),
00116 'help' => t('Displays rows in a grid.'),
00117 'handler' => 'views_plugin_style_grid',
00118 'theme' => 'views_view_grid',
00119 'uses row plugin' => TRUE,
00120 'uses options' => TRUE,
00121 'type' => 'normal',
00122 'help topic' => 'style-grid',
00123 ),
00124 'table' => array(
00125 'title' => t('Table'),
00126 'help' => t('Displays rows in a table.'),
00127 'handler' => 'views_plugin_style_table',
00128 'theme' => 'views_view_table',
00129 'uses row plugin' => FALSE,
00130 'uses fields' => TRUE,
00131 'uses options' => TRUE,
00132 'type' => 'normal',
00133 'help topic' => 'style-table',
00134 ),
00135 'default_summary' => array(
00136 'title' => t('List'),
00137 'help' => t('Displays the default summary as a list.'),
00138 'handler' => 'views_plugin_style_summary',
00139 'theme' => 'views_view_summary',
00140 'type' => 'summary',
00141 'uses options' => TRUE,
00142 'help topic' => 'style-summary',
00143 ),
00144 'unformatted_summary' => array(
00145 'title' => t('Unformatted'),
00146 'help' => t('Displays the summary unformatted, with option for one after another or inline.'),
00147 'handler' => 'views_plugin_style_summary_unformatted',
00148 'parent' => 'default_summary',
00149 'theme' => 'views_view_summary_unformatted',
00150 'type' => 'summary',
00151 'uses options' => TRUE,
00152 'help topic' => 'style-summary-unformatted',
00153 ),
00154 'rss' => array(
00155 'title' => t('RSS Feed'),
00156 'help' => t('Generates an RSS feed from a view.'),
00157 'handler' => 'views_plugin_style_rss',
00158 'theme' => 'views_view_rss',
00159 'uses row plugin' => TRUE,
00160 'uses options' => TRUE,
00161 'type' => 'feed',
00162 'help topic' => 'style-rss',
00163 ),
00164 ),
00165 'row' => array(
00166 'parent' => array(
00167
00168
00169 'no ui' => TRUE,
00170 'handler' => 'views_plugin_row',
00171 'parent' => '',
00172 ),
00173 'fields' => array(
00174 'title' => t('Fields'),
00175 'help' => t('Displays the fields with an optional template.'),
00176 'handler' => 'views_plugin_row_fields',
00177 'theme' => 'views_view_fields',
00178 'uses fields' => TRUE,
00179 'uses options' => TRUE,
00180 'type' => 'normal',
00181 'help topic' => 'style-row-fields',
00182 ),
00183 ),
00184 'argument default' => array(
00185
00186
00187 'fixed' => array(
00188 'title' => t('Fixed entry'),
00189 'handler' => 'views_plugin_argument_default',
00190 ),
00191 'php' => array(
00192 'title' => t('PHP Code'),
00193 'handler' => 'views_plugin_argument_default_php',
00194 'parent' => 'fixed',
00195 ),
00196 ),
00197 'argument validator' => array(
00198 'parent' => array(
00199 'no ui' => TRUE,
00200 'handler' => 'views_plugin_argument_validate',
00201 'parent' => '',
00202 ),
00203 'php' => array(
00204 'title' => t('PHP Code'),
00205 'handler' => 'views_plugin_argument_validate_php',
00206 ),
00207 'numeric' => array(
00208 'title' => t('Numeric'),
00209 'handler' => 'views_plugin_argument_validate_numeric',
00210 ),
00211 ),
00212 'access' => array(
00213 'parent' => array(
00214 'no ui' => TRUE,
00215 'handler' => 'views_plugin_access',
00216 'parent' => '',
00217 ),
00218 'none' => array(
00219 'title' => t('None'),
00220 'help' => t('Will be available to all users.'),
00221 'handler' => 'views_plugin_access_none',
00222 'help topic' => 'access-none',
00223 ),
00224 'role' => array(
00225 'title' => t('Role'),
00226 'help' => t('Access will be granted to users with any of the specified roles.'),
00227 'handler' => 'views_plugin_access_role',
00228 'uses options' => TRUE,
00229 'help topic' => 'access-role',
00230 ),
00231 'perm' => array(
00232 'title' => t('Permission'),
00233 'help' => t('Access will be granted to users with the specified permission string.'),
00234 'handler' => 'views_plugin_access_perm',
00235 'uses options' => TRUE,
00236 'help topic' => 'access-perm',
00237 ),
00238 ),
00239 'cache' => array(
00240 'parent' => array(
00241 'no ui' => TRUE,
00242 'handler' => 'views_plugin_cache',
00243 'parent' => '',
00244 ),
00245 'none' => array(
00246 'title' => t('None'),
00247 'help' => t('No caching of Views data.'),
00248 'handler' => 'views_plugin_cache_none',
00249 'help topic' => 'cache-none',
00250 ),
00251 'time' => array(
00252 'title' => t('Time-based'),
00253 'help' => t('Simple time-based caching of data.'),
00254 'handler' => 'views_plugin_cache_time',
00255 'uses options' => TRUE,
00256 'help topic' => 'cache-time',
00257 ),
00258 ),
00259 );
00260
00261 if (module_invoke('ctools', 'api_version', '1.3')) {
00262 $plugins['style']['jump_menu_summary'] = array(
00263 'title' => t('Jump menu'),
00264 '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.'),
00265 'handler' => 'views_plugin_style_summary_jump_menu',
00266 'theme' => 'views_view_summary_jump_menu',
00267 'type' => 'summary',
00268 'uses options' => TRUE,
00269 'help topic' => 'style-summary-jump-menu',
00270 );
00271 $plugins['style']['jump_menu'] = array(
00272 'title' => t('Jump menu'),
00273 '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.'),
00274 'handler' => 'views_plugin_style_jump_menu',
00275 'theme' => 'views_view_jump_menu',
00276 'uses row plugin' => TRUE,
00277 'uses fields' => TRUE,
00278 'uses options' => TRUE,
00279 'type' => 'normal',
00280 'help topic' => 'style-jump-menu',
00281 );
00282 }
00283
00284 return $plugins;
00285 }
00286
00292 function views_discover_plugins() {
00293 $cache = array('display' => array(), 'style' => array(), 'row' => array(), 'argument default' => array(), 'argument validator' => array(), 'access' => array(), 'cache' => array());
00294
00295 foreach (module_implements('views_plugins') as $module) {
00296 $function = $module . '_views_plugins';
00297 $result = $function();
00298 if (!is_array($result)) {
00299 continue;
00300 }
00301
00302 $module_dir = isset($result['module']) ? $result['module'] : $module;
00303
00304 if ($module_dir == 'views') {
00305 $theme_path = drupal_get_path('module', $module_dir) . '/theme';
00306 $theme_file = 'theme.inc';
00307 $path = drupal_get_path('module', $module_dir) . '/plugins';
00308 }
00309 else {
00310 $theme_path = $path = drupal_get_path('module', $module_dir);
00311 $theme_file = "$module.views.inc";
00312 }
00313
00314 foreach ($result as $type => $info) {
00315 if ($type == 'module') {
00316 continue;
00317 }
00318 foreach ($info as $plugin => $def) {
00319 $def['module'] = $module_dir;
00320 if (!isset($def['theme path'])) {
00321 $def['theme path'] = $theme_path;
00322 }
00323 if (!isset($def['theme file'])) {
00324 $def['theme file'] = $theme_file;
00325 }
00326 if (!isset($def['path'])) {
00327 $def['path'] = $path;
00328 }
00329 if (!isset($def['file'])) {
00330 $def['file'] = $def['handler'] . '.inc';
00331 }
00332 if (!isset($def['parent'])) {
00333 $def['parent'] = 'parent';
00334 }
00335
00336 $cache[$type][$plugin] = $def;
00337 }
00338 }
00339 }
00340 return $cache;
00341 }
00342
00346 class views_plugin extends views_object {
00351 function init(&$view, &$display) {
00352 $this->view = &$view;
00353 $this->display = &$display;
00354 }
00355
00359 function options_form(&$form, &$form_state) { }
00360
00364 function options_validate(&$form, &$form_state) { }
00365
00369 function options_submit(&$form, &$form_state) { }
00370
00374 function query() { }
00375
00379 function theme_functions() {
00380 return views_theme_functions($this->definition['theme'], $this->view, $this->display);
00381 }
00382
00386 function additional_theme_functions() {
00387 $funcs = array();
00388 if (!empty($this->definition['additional themes'])) {
00389 foreach ($this->definition['additional themes'] as $theme => $type) {
00390 $funcs[] = views_theme_functions($theme, $this->view, $this->display);
00391 }
00392 }
00393 return $funcs;
00394 }
00395
00403 function validate() { return array(); }
00404 }
00405