Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/views.api.php | ||
---|---|---|
244 | 244 |
* 'title' => t('Node'), |
245 | 245 |
* 'help' => t('Display the node with standard node view.'), |
246 | 246 |
* 'handler' => 'views_plugin_row_node_view', |
247 |
* 'path' => drupal_get_path('module', 'views') . '/modules/node', // not necessary for most modules |
|
247 |
* // Not necessary for most modules. |
|
248 |
* 'path' => drupal_get_path('module', 'views') . '/modules/node', |
|
248 | 249 |
* 'theme' => 'views_view_row_node', |
249 |
* 'base' => array('node'), // only works with 'node' as base. |
|
250 |
* // Only works with 'node' as base. |
|
251 |
* 'base' => array('node'), |
|
250 | 252 |
* 'uses options' => TRUE, |
251 | 253 |
* 'type' => 'normal', |
252 | 254 |
* ), |
... | ... | |
292 | 294 |
/** |
293 | 295 |
* Describes data tables (or the equivalent) to Views. |
294 | 296 |
* |
295 |
* This hook should be placed in MODULENAME.views.inc and it will be |
|
296 |
* auto-loaded. MODULENAME.views.inc must be in the directory specified by the
|
|
297 |
* 'path' key returned by MODULENAME_views_api(), or the same directory as the
|
|
298 |
* .module file, if 'path' is unspecified.
|
|
297 |
* This hook should be placed in MODULENAME.views.inc and it will be auto
|
|
298 |
* loaded. MODULENAME.views.inc must be in the directory specified by the 'path'
|
|
299 |
* key returned by MODULENAME_views_api(), or the same directory as the .module
|
|
300 |
* file, if 'path' is unspecified. |
|
299 | 301 |
* |
300 |
* @return |
|
302 |
* @return array
|
|
301 | 303 |
* An associative array describing the data structure. Primary key is the |
302 | 304 |
* name used internally by Views for the table(s) – usually the actual table |
303 | 305 |
* name. The values for the key entries are described in detail below. |
... | ... | |
307 | 309 |
// table: |
308 | 310 |
// |
309 | 311 |
// CREATE TABLE example_table ( |
310 |
// nid INT(11) NOT NULL COMMENT 'Primary key; refers to {node}.nid.',
|
|
312 |
// nid INT(11) NOT NULL COMMENT 'Primary key; refers to {node}.nid.', |
|
311 | 313 |
// plain_text_field VARCHAR(32) COMMENT 'Just a plain text field.', |
312 |
// numeric_field INT(11) COMMENT 'Just a numeric field.',
|
|
313 |
// boolean_field INT(1) COMMENT 'Just an on/off field.',
|
|
314 |
// timestamp_field INT(8) COMMENT 'Just a timestamp field.',
|
|
314 |
// numeric_field INT(11) COMMENT 'Just a numeric field.', |
|
315 |
// boolean_field INT(1) COMMENT 'Just an on/off field.', |
|
316 |
// timestamp_field INT(8) COMMENT 'Just a timestamp field.', |
|
315 | 317 |
// PRIMARY KEY(nid) |
316 | 318 |
// ); |
317 |
|
|
318 | 319 |
// First, the entry $data['example_table']['table'] describes properties of |
319 | 320 |
// the actual table – not its content. |
320 |
|
|
321 | 321 |
// The 'group' index will be used as a prefix in the UI for any of this |
322 | 322 |
// table's fields, sort criteria, etc. so it's easy to tell where they came |
323 | 323 |
// from. |
... | ... | |
328 | 328 |
// is not very useful for this table, as it isn't really a distinct object of |
329 | 329 |
// its own, but it makes a good example. |
330 | 330 |
$data['example_table']['table']['base'] = array( |
331 |
'field' => 'nid', // This is the identifier field for the view. |
|
331 |
// This is the identifier field for the view. |
|
332 |
'field' => 'nid', |
|
332 | 333 |
'title' => t('Example table'), |
333 | 334 |
'help' => t('Example table contains example content and can be related to nodes.'), |
334 | 335 |
'weight' => -10, |
... | ... | |
339 | 340 |
// table, the fields are automatically available. |
340 | 341 |
$data['example_table']['table']['join'] = array( |
341 | 342 |
// Index this array by the table name to which this table refers. |
342 |
// 'left_field' is the primary key in the referenced table. |
|
343 |
// 'field' is the foreign key in this table. |
|
344 | 343 |
'node' => array( |
344 |
// The primary key in the referenced table. |
|
345 | 345 |
'left_field' => 'nid', |
346 |
// The foreign key in this table. |
|
346 | 347 |
'field' => 'nid', |
347 | 348 |
), |
348 | 349 |
); |
... | ... | |
362 | 363 |
// footer or as no result behaviour. |
363 | 364 |
// |
364 | 365 |
// The handler descriptions are described with examples below. |
365 |
|
|
366 | 366 |
// Node ID table field. |
367 | 367 |
$data['example_table']['nid'] = array( |
368 | 368 |
'title' => t('Example content'), |
... | ... | |
372 | 372 |
// other direction, use hook_views_data_alter(), or use the 'implicit' join |
373 | 373 |
// method described above. |
374 | 374 |
'relationship' => array( |
375 |
'base' => 'node', // The name of the table to join with. |
|
376 |
'base field' => 'nid', // The name of the field on the joined table. |
|
375 |
// The name of the table to join with. |
|
376 |
'base' => 'node', |
|
377 |
// The name of the field on the joined table. |
|
378 |
'base field' => 'nid', |
|
377 | 379 |
// 'field' => 'nid' -- see hook_views_data_alter(); not needed here. |
378 | 380 |
'handler' => 'views_handler_relationship', |
379 | 381 |
'label' => t('Default label for the relationship'), |
... | ... | |
388 | 390 |
'help' => t('Just a plain text field.'), |
389 | 391 |
'field' => array( |
390 | 392 |
'handler' => 'views_handler_field', |
391 |
'click sortable' => TRUE, // This is use by the table display plugin. |
|
393 |
// This is use by the table display plugin. |
|
394 |
'click sortable' => TRUE, |
|
392 | 395 |
), |
393 | 396 |
'sort' => array( |
394 | 397 |
'handler' => 'views_handler_sort', |
... | ... | |
408 | 411 |
'field' => array( |
409 | 412 |
'handler' => 'views_handler_field_numeric', |
410 | 413 |
'click sortable' => TRUE, |
411 |
),
|
|
414 |
), |
|
412 | 415 |
'filter' => array( |
413 | 416 |
'handler' => 'views_handler_filter_numeric', |
414 | 417 |
), |
... | ... | |
427 | 430 |
), |
428 | 431 |
'filter' => array( |
429 | 432 |
'handler' => 'views_handler_filter_boolean_operator', |
430 |
// Note that you can override the field-wide label:
|
|
433 |
// Note that you can override the field-wide label.
|
|
431 | 434 |
'label' => t('Published'), |
432 | 435 |
// This setting is used by the boolean filter handler, as possible option. |
433 | 436 |
'type' => 'yes-no', |
... | ... | |
468 | 471 |
* 'path' key returned by MODULENAME_views_api(), or the same directory as the |
469 | 472 |
* .module file, if 'path' is unspecified. |
470 | 473 |
* |
471 |
* @param $data |
|
474 |
* @param array $data
|
|
472 | 475 |
* An array of all Views data, passed by reference. See hook_views_data() for |
473 | 476 |
* structure. |
474 | 477 |
* |
... | ... | |
500 | 503 |
'title' => t('Example relationship'), |
501 | 504 |
'help' => t('Example help'), |
502 | 505 |
'relationship' => array( |
503 |
'base' => 'example_table', // Table we're joining to. |
|
504 |
'base field' => 'eid', // Field on the joined table. |
|
505 |
'field' => 'fid', // Real field name on the 'foo' table. |
|
506 |
// Table we're joining to. |
|
507 |
'base' => 'example_table', |
|
508 |
// Field on the joined table. |
|
509 |
'base field' => 'eid', |
|
510 |
// Real field name on the 'foo' table. |
|
511 |
'field' => 'fid', |
|
506 | 512 |
'handler' => 'views_handler_relationship', |
507 | 513 |
'label' => t('Default label for relationship'), |
508 | 514 |
'title' => t('Title seen when adding relationship'), |
... | ... | |
516 | 522 |
/** |
517 | 523 |
* Override the default data for a Field API field. |
518 | 524 |
* |
519 |
* Field module's implementation of hook_views_data() invokes this for each
|
|
525 |
* Field module's Implements hook_views_data() invokes this for each
|
|
520 | 526 |
* field in the module that defines the field type (as declared in the field |
521 | 527 |
* array). It is not invoked in other modules. |
522 | 528 |
* |
523 | 529 |
* If no hook implementation exists, hook_views_data() falls back to |
524 | 530 |
* field_views_field_default_views_data(). |
525 | 531 |
* |
532 |
* @param array $field |
|
533 |
* A field definition array, as returned by field_info_fields(). |
|
534 |
* |
|
535 |
* @return array |
|
536 |
* An array of views data, in the same format as the return value of |
|
537 |
* hook_views_data(). |
|
538 |
* |
|
526 | 539 |
* @see field_views_data() |
527 | 540 |
* @see hook_field_views_data_alter() |
528 | 541 |
* @see hook_field_views_data_views_data_alter() |
529 |
* |
|
530 |
* @param $field |
|
531 |
* A field definition array, as returned by field_info_fields(). |
|
532 |
* |
|
533 |
* @return |
|
534 |
* An array of views data, in the same format as the return value of |
|
535 |
* hook_views_data(). |
|
536 | 542 |
*/ |
537 | 543 |
function hook_field_views_data($field) { |
538 |
|
|
544 |
return array(); |
|
539 | 545 |
} |
540 | 546 |
|
541 | 547 |
/** |
... | ... | |
545 | 551 |
* the field, and therefore may be used to alter the default data that |
546 | 552 |
* field_views_field_default_views_data() supplies for the field. |
547 | 553 |
* |
548 |
* @param $result |
|
549 |
* An array of views table data provided for a single field. This has the same |
|
550 |
* format as the return value of hook_views_data(). |
|
551 |
* @param $field |
|
552 |
* A field definition array, as returned by field_info_fields(). |
|
553 |
* @param $module |
|
554 |
* The module that defines the field type. |
|
554 |
* @param array $result
|
|
555 |
* An array of views table data provided for a single field. This has the same
|
|
556 |
* format as the return value of hook_views_data().
|
|
557 |
* @param array $field
|
|
558 |
* A field definition array, as returned by field_info_fields().
|
|
559 |
* @param string $module
|
|
560 |
* The module that defines the field type.
|
|
555 | 561 |
* |
556 | 562 |
* @see field_views_data() |
557 | 563 |
* @see hook_field_views_data() |
... | ... | |
564 | 570 |
/** |
565 | 571 |
* Alter the views data on a per field basis. |
566 | 572 |
* |
567 |
* Field module's implementation of hook_views_data_alter() invokes this for
|
|
573 |
* Field module's Implements hook_views_data_alter() invokes this for
|
|
568 | 574 |
* each field in the module that defines the field type (as declared in the |
569 | 575 |
* field array). It is not invoked in other modules. |
570 | 576 |
* |
... | ... | |
597 | 603 |
* .module file, if 'path' is unspecified. All plugin files need to be |
598 | 604 |
* referenced in MODULENAME.info with the files[] directive. |
599 | 605 |
* |
600 |
* @return |
|
606 |
* @return array
|
|
601 | 607 |
* An array on the form $plugins['PLUGIN TYPE']['PLUGIN NAME']. The plugin |
602 | 608 |
* must be one of row, display, display_extender, style, argument default, |
603 | 609 |
* argument validator, access, query, cache, pager, exposed_form or |
... | ... | |
619 | 625 |
* selectable in the ui, though on the api side they still exists. |
620 | 626 |
* - uses options: Set to TRUE to denote that the plugin has an additional |
621 | 627 |
* options form. |
622 |
* - help: A short help text, wrapped in t() used as description on the plugin settings form. |
|
628 |
* - help: A short help text, wrapped in t() used as description on the |
|
629 |
* plugin settings form. |
|
623 | 630 |
* - help topic: The name of an entry by advanced help for the plugin. |
624 | 631 |
* - theme: The name of a theme suggestion to use for the display. |
625 | 632 |
* - js: An array with paths to js files that should be included for the |
... | ... | |
646 | 653 |
* should be added. Can for example be 'page' or 'block'. If you don't |
647 | 654 |
* specify it there will be contextual links around the rendered view. If |
648 | 655 |
* this is not set or regions have been specified, views will display an |
649 |
* option to 'hide contextual links'. Use an empty array if you do not want
|
|
650 |
* this. |
|
656 |
* option to 'hide contextual links'. Use an empty array if you do not |
|
657 |
* want this.
|
|
651 | 658 |
* - uses hook menu: Set to TRUE to have the display included by |
652 | 659 |
* views_menu_alter(). views_menu_alter executes then execute_hook_menu |
653 | 660 |
* on the display object. |
... | ... | |
664 | 671 |
* - uses fields: Set to TRUE to have the style plugin accept field |
665 | 672 |
* handlers. |
666 | 673 |
* - uses grouping: Set to TRUE to allow the grouping settings for rows. |
667 |
* - even empty: May have the value 'even empty' to tell Views that the style
|
|
668 |
* should be rendered even if there are no results. |
|
674 |
* - even empty: May have the value 'even empty' to tell Views that the |
|
675 |
* style should be rendered even if there are no results.
|
|
669 | 676 |
* |
670 | 677 |
* - Used by row plugins: |
671 | 678 |
* - uses fields: Set to TRUE to have the row plugin accept field handlers. |
... | ... | |
682 | 689 |
); |
683 | 690 |
|
684 | 691 |
return array( |
685 |
'module' => 'views', // This just tells our themes are elsewhere. |
|
692 |
// This just tells our themes are elsewhere. |
|
693 |
'module' => 'views', |
|
686 | 694 |
'argument validator' => array( |
687 | 695 |
'taxonomy_term' => array( |
688 | 696 |
'title' => t('Taxonomy term'), |
689 | 697 |
'handler' => 'views_plugin_argument_validate_taxonomy_term', |
690 |
'path' => drupal_get_path('module', 'views') . '/modules/taxonomy', // not necessary for most modules |
|
698 |
// Declaring path explicitly not necessary for most modules. |
|
699 |
'path' => drupal_get_path('module', 'views') . '/modules/taxonomy', |
|
691 | 700 |
), |
692 | 701 |
), |
693 | 702 |
'argument default' => array( |
... | ... | |
711 | 720 |
$plugins['row']['node']['base'][] = 'apachesolr'; |
712 | 721 |
} |
713 | 722 |
|
723 |
/** |
|
724 |
* Alter existing plugin option definitions. |
|
725 |
* |
|
726 |
* This can be used to edit default or add new option definitions to existing |
|
727 |
* plugins. The reason for doing this is that only overriding the relevent form |
|
728 |
* with hook_form_alter() is insufficent because submitted form values will be |
|
729 |
* ignored if they haven't been declared as an available option. |
|
730 |
* |
|
731 |
* An alternative approach you could also take is to extend each plugin |
|
732 |
* individually. However if your goal is to override many, or even all plugins, |
|
733 |
* this results in a lot of additional code and files. This makes it a lot more |
|
734 |
* troublesome to maintain the codebase, as well as interoperability with other |
|
735 |
* modules. |
|
736 |
* |
|
737 |
* @param array $options |
|
738 |
* The option definitions to be altered. |
|
739 |
* @param $plugin |
|
740 |
* A views object of the plugin where the default options are defined. |
|
741 |
* |
|
742 |
* @see views_object::option_definition() |
|
743 |
* @see hook_views_handler_option_definition_alter() |
|
744 |
* @see hook_form_alter() |
|
745 |
*/ |
|
746 |
function hook_views_plugin_option_definition_alter(&$options, $plugin) { |
|
747 |
// Add a new option definition. |
|
748 |
$options['option_name'] = array('default' => ''); |
|
749 |
} |
|
750 |
|
|
751 |
/** |
|
752 |
* Alter existing handler option definitions. |
|
753 |
* |
|
754 |
* This can be used to edit default or add new option definitions to existing |
|
755 |
* handers. The reason for doing this is that only overriding the relevent form |
|
756 |
* with hook_form_alter() is insufficent because submitted form values will be |
|
757 |
* ignored if they haven't been declared as an available option. |
|
758 |
* |
|
759 |
* An alternative approach you could also take is to extend each handler |
|
760 |
* individually. However if your goal is to override many, or even all handlers, |
|
761 |
* this results in a lot of additional code and files. This makes it a lot more |
|
762 |
* troublesome to maintain the codebase, as well as interoperability with other |
|
763 |
* modules. |
|
764 |
* |
|
765 |
* @param array $options |
|
766 |
* The option definitions to be altered. |
|
767 |
* @param $handler |
|
768 |
* A views object of the handler where the default options are defined. |
|
769 |
* |
|
770 |
* @see views_handler::option_definition() |
|
771 |
* @see hook_views_plugin_option_definition_alter() |
|
772 |
* @see hook_form_alter() |
|
773 |
*/ |
|
774 |
function hook_views_handler_option_definition_alter(&$options, $handler) { |
|
775 |
// Add a new option definition. |
|
776 |
$options['option_name'] = array('default' => ''); |
|
777 |
} |
|
778 |
|
|
714 | 779 |
/** |
715 | 780 |
* Register View API information. |
716 | 781 |
* |
717 | 782 |
* This is required for your module to have its include files loaded; for |
718 | 783 |
* example, when implementing hook_views_default_views(). |
719 | 784 |
* |
720 |
* @return |
|
785 |
* @return array
|
|
721 | 786 |
* An array with the following possible keys: |
722 | 787 |
* - api: (required) The version of the Views API the module implements. |
723 | 788 |
* - path: (optional) If includes are stored somewhere other than within the |
... | ... | |
736 | 801 |
} |
737 | 802 |
|
738 | 803 |
/** |
739 |
* This hook allows modules to provide their own views which can either be used |
|
740 |
* as-is or as a "starter" for users to build from. |
|
804 |
* Allows modules to provide their own views. |
|
805 |
* |
|
806 |
* These can either be used as-is or as a "starter" for users to build from. |
|
741 | 807 |
* |
742 | 808 |
* This hook should be placed in MODULENAME.views_default.inc and it will be |
743 | 809 |
* auto-loaded. MODULENAME.views_default.inc must be in the directory specified |
... | ... | |
747 | 813 |
* The $view->disabled boolean flag indicates whether the View should be |
748 | 814 |
* enabled (FALSE) or disabled (TRUE) by default. |
749 | 815 |
* |
750 |
* @return |
|
816 |
* @return array
|
|
751 | 817 |
* An associative array containing the structures of views, as generated from |
752 | 818 |
* the Export tab, keyed by the view name. A best practice is to go through |
753 | 819 |
* and add t() to all title and label strings, with the exception of menu |
... | ... | |
755 | 821 |
*/ |
756 | 822 |
function hook_views_default_views() { |
757 | 823 |
// Begin copy and paste of output from the Export tab of a view. |
758 |
$view = new view; |
|
824 |
$view = new view();
|
|
759 | 825 |
$view->name = 'frontpage'; |
760 | 826 |
$view->description = 'Emulates the default Drupal front page; you may set the default home page path to this view to make it your front page.'; |
761 | 827 |
$view->tag = 'default'; |
... | ... | |
819 | 885 |
$handler->display->display_options['sitename_title'] = '1'; |
820 | 886 |
|
821 | 887 |
// (Export ends here.) |
822 |
|
|
823 | 888 |
// Add view to list of views to provide. |
824 | 889 |
$views[$view->name] = $view; |
825 | 890 |
|
826 |
// ...Repeat all of the above for each view the module should provide. |
|
827 |
|
|
828 |
// At the end, return array of default views. |
|
891 |
// Repeat all of the above for each view the module should provide. At the |
|
892 |
// end, return array of default views. |
|
829 | 893 |
return $views; |
830 | 894 |
} |
831 | 895 |
|
... | ... | |
855 | 919 |
/** |
856 | 920 |
* Performs replacements in the query before being performed. |
857 | 921 |
* |
858 |
* @param $view |
|
922 |
* @param object $view
|
|
859 | 923 |
* The View being executed. |
860 |
* @return |
|
924 |
* |
|
925 |
* @return array |
|
861 | 926 |
* An array with keys being the strings to replace, and the values the strings |
862 | 927 |
* to replace them with. The strings to replace are often surrounded with |
863 | 928 |
* '***', as illustrated in the example implementation. |
... | ... | |
874 | 939 |
} |
875 | 940 |
|
876 | 941 |
/** |
877 |
* This hook is called to get a list of placeholders and their substitutions, |
|
878 |
* used when preprocessing a View with form elements. |
|
942 |
* This hook is called to get a list of placeholders and their substitutions. |
|
943 |
* |
|
944 |
* Used when preprocessing a View with form elements. |
|
879 | 945 |
* |
880 |
* @return |
|
946 |
* @return array
|
|
881 | 947 |
* An array with keys being the strings to replace, and the values the strings |
882 | 948 |
* to replace them with. |
883 | 949 |
*/ |
... | ... | |
888 | 954 |
} |
889 | 955 |
|
890 | 956 |
/** |
891 |
* Allows altering a view at the very beginning of views processing, before |
|
892 |
* anything is done. |
|
957 |
* Allows altering a view at the very beginning of processing a preview. |
|
958 |
* |
|
959 |
* Occurs before anything is done. |
|
960 |
* |
|
961 |
* This hook is only triggered when the one of the following are invoked: |
|
962 |
* - $view->execute_display() |
|
963 |
* - $view->preview() |
|
964 |
* |
|
965 |
* As such code placed in this hook will not fire during: |
|
966 |
* - $view->build() |
|
967 |
* - $view->execute() |
|
968 |
* - $view->render() |
|
969 |
* |
|
970 |
* Likely, hook_views_pre_build() or hook_views_pre_execute() are much better |
|
971 |
* choices for most use cases since they are always invoked, not just when |
|
972 |
* previewing a display. |
|
893 | 973 |
* |
894 | 974 |
* Adding output to the view can be accomplished by placing text on |
895 | 975 |
* $view->attachment_before and $view->attachment_after. |
896 |
* @param $view |
|
976 |
* |
|
977 |
* @param object $view |
|
897 | 978 |
* The view object about to be processed. |
898 |
* @param $display_id |
|
979 |
* @param string $display_id
|
|
899 | 980 |
* The machine name of the active display. |
900 |
* @param $args |
|
981 |
* @param array $args
|
|
901 | 982 |
* An array of arguments passed into the view. |
902 | 983 |
*/ |
903 |
function hook_views_pre_view(&$view, &$display_id, &$args) { |
|
984 |
function hook_views_pre_preview(&$view, &$display_id, &$args) {
|
|
904 | 985 |
// Change the display if the acting user has 'administer site configuration' |
905 | 986 |
// permission, to display something radically different. |
906 | 987 |
// (Note that this is not necessarily the best way to solve that task. Feel |
907 | 988 |
// free to contribute another example!) |
908 | 989 |
if ( |
909 |
$view->name == 'my_special_view' &&
|
|
910 |
user_access('administer site configuration') &&
|
|
911 |
$display_id == 'public_display' |
|
990 |
$view->name == 'my_special_view' |
|
991 |
&& user_access('administer site configuration')
|
|
992 |
&& $display_id == 'public_display'
|
|
912 | 993 |
) { |
913 | 994 |
$view->set_display('private_display'); |
914 | 995 |
} |
915 | 996 |
} |
916 | 997 |
|
917 | 998 |
/** |
918 |
* This hook is called right before the build process, but after displays |
|
919 |
* are attached and the display performs its pre_execute phase. |
|
999 |
* Called after the display's pre_execute phase but before the build process. |
|
920 | 1000 |
* |
921 | 1001 |
* Adding output to the view can be accomplished by placing text on |
922 | 1002 |
* $view->attachment_before and $view->attachment_after. |
923 |
* @param $view |
|
1003 |
* |
|
1004 |
* @param object $view |
|
924 | 1005 |
* The view object about to be processed. |
925 | 1006 |
*/ |
926 | 1007 |
function hook_views_pre_build(&$view) { |
... | ... | |
934 | 1015 |
} |
935 | 1016 |
|
936 | 1017 |
/** |
937 |
* This hook is called right after the build process. The query is now fully |
|
938 |
* built, but it has not yet been run through db_rewrite_sql. |
|
1018 |
* This hook is called right after the build process. |
|
1019 |
* |
|
1020 |
* The query is now fully built, but it has not yet been run through |
|
1021 |
* db_rewrite_sql. |
|
939 | 1022 |
* |
940 | 1023 |
* Adding output to the view can be accomplished by placing text on |
941 | 1024 |
* $view->attachment_before and $view->attachment_after. |
942 |
* @param $view |
|
1025 |
* |
|
1026 |
* @param object $view |
|
943 | 1027 |
* The view object about to be processed. |
944 | 1028 |
*/ |
945 | 1029 |
function hook_views_post_build(&$view) { |
... | ... | |
957 | 1041 |
} |
958 | 1042 |
|
959 | 1043 |
/** |
960 |
* This hook is called right before the execute process. The query is now fully |
|
961 |
* built, but it has not yet been run through db_rewrite_sql. |
|
1044 |
* This hook is called right before the execute process. |
|
1045 |
* |
|
1046 |
* The query is now fully built, but it has not yet been run through |
|
1047 |
* db_rewrite_sql. |
|
962 | 1048 |
* |
963 | 1049 |
* Adding output to the view can be accomplished by placing text on |
964 | 1050 |
* $view->attachment_before and $view->attachment_after. |
965 |
* @param $view |
|
1051 |
* |
|
1052 |
* @param object $view |
|
966 | 1053 |
* The view object about to be processed. |
967 | 1054 |
*/ |
968 | 1055 |
function hook_views_pre_execute(&$view) { |
... | ... | |
976 | 1063 |
} |
977 | 1064 |
|
978 | 1065 |
/** |
979 |
* This hook is called right after the execute process. The query has |
|
980 |
* been executed, but the pre_render() phase has not yet happened for |
|
981 |
* handlers. |
|
1066 |
* This hook is called right after the execute process. |
|
1067 |
* |
|
1068 |
* The query has been executed, but the pre_render() phase has not yet happened |
|
1069 |
* for handlers. |
|
982 | 1070 |
* |
983 | 1071 |
* Adding output to the view can be accomplished by placing text on |
984 |
* $view->attachment_before and $view->attachment_after. Altering the |
|
985 |
* content can be achieved by editing the items of $view->result. |
|
986 |
* @param $view |
|
1072 |
* $view->attachment_before and $view->attachment_after. Altering the content |
|
1073 |
* can be achieved by editing the items of $view->result. |
|
1074 |
* |
|
1075 |
* @param object $view |
|
987 | 1076 |
* The view object about to be processed. |
988 | 1077 |
*/ |
989 | 1078 |
function hook_views_post_execute(&$view) { |
... | ... | |
997 | 1086 |
} |
998 | 1087 |
|
999 | 1088 |
/** |
1000 |
* This hook is called right before the render process. The query has been |
|
1001 |
* executed, and the pre_render() phase has already happened for handlers, so |
|
1002 |
* all data should be available. |
|
1089 |
* This hook is called right before the render process. |
|
1090 |
* |
|
1091 |
* The query has been executed, and the pre_render() phase has already happened |
|
1092 |
* for handlers, so all data should be available. |
|
1003 | 1093 |
* |
1004 | 1094 |
* Adding output to the view can be accomplished by placing text on |
1005 | 1095 |
* $view->attachment_before and $view->attachment_after. Altering the content |
1006 | 1096 |
* can be achieved by editing the items of $view->result. |
1007 | 1097 |
* |
1008 | 1098 |
* This hook can be utilized by themes. |
1009 |
* @param $view |
|
1099 |
* |
|
1100 |
* @param object $view |
|
1010 | 1101 |
* The view object about to be processed. |
1011 | 1102 |
*/ |
1012 | 1103 |
function hook_views_pre_render(&$view) { |
... | ... | |
1037 | 1128 |
* so all ids used in the query should be discoverable. |
1038 | 1129 |
* |
1039 | 1130 |
* This hook can be utilized by themes. |
1040 |
* @param $view |
|
1131 |
* |
|
1132 |
* @param object $view |
|
1041 | 1133 |
* The view object about to be processed. |
1042 |
* @param $output |
|
1134 |
* @param string $output
|
|
1043 | 1135 |
* A flat string with the rendered output of the view. |
1044 |
* @param $cache |
|
1136 |
* @param array $cache
|
|
1045 | 1137 |
* The cache settings. |
1046 | 1138 |
*/ |
1047 | 1139 |
function hook_views_post_render(&$view, &$output, &$cache) { |
... | ... | |
1061 | 1153 |
* 'path' key returned by MODULENAME_views_api(), or the same directory as the |
1062 | 1154 |
* .module file, if 'path' is unspecified. |
1063 | 1155 |
* |
1064 |
* @param $view |
|
1156 |
* @param object $view
|
|
1065 | 1157 |
* The view object about to be processed. |
1066 |
* @param $query |
|
1158 |
* @param object $query
|
|
1067 | 1159 |
* An object describing the query. |
1160 |
* |
|
1068 | 1161 |
* @see hook_views_query_substitutions() |
1069 | 1162 |
*/ |
1070 | 1163 |
function hook_views_query_alter(&$view, &$query) { |
... | ... | |
1090 | 1183 |
} |
1091 | 1184 |
|
1092 | 1185 |
/** |
1093 |
* Alter the information box that (optionally) appears with a view preview, |
|
1094 |
* including query and performance statistics. |
|
1186 |
* Alter the information box that (optionally) appears with a view preview. |
|
1187 |
* |
|
1188 |
* Includes query and performance statistics. |
|
1095 | 1189 |
* |
1096 | 1190 |
* This hook should be placed in MODULENAME.views.inc and it will be |
1097 | 1191 |
* auto-loaded. MODULENAME.views.inc must be in the directory specified by the |
... | ... | |
1101 | 1195 |
* Warning: $view is not a reference in PHP4 and cannot be modified here. But it |
1102 | 1196 |
* IS a reference in PHP5, and can be modified. Please be careful with it. |
1103 | 1197 |
* |
1104 |
* @param $rows |
|
1198 |
* @param array $rows
|
|
1105 | 1199 |
* An associative array with two keys: |
1106 | 1200 |
* - query: An array of rows suitable for theme('table'), containing |
1107 | 1201 |
* information about the query and the display title and path. |
1108 | 1202 |
* - statistics: An array of rows suitable for theme('table'), containing |
1109 | 1203 |
* performance statistics. |
1110 |
* @param $view |
|
1204 |
* @param object $view
|
|
1111 | 1205 |
* The view object. |
1206 |
* |
|
1112 | 1207 |
* @see theme_table() |
1113 | 1208 |
*/ |
1114 | 1209 |
function hook_views_preview_info_alter(&$rows, $view) { |
... | ... | |
1121 | 1216 |
} |
1122 | 1217 |
|
1123 | 1218 |
/** |
1124 |
* This hooks allows to alter the links at the top of the view edit form. Some |
|
1125 |
* modules might want to add links there. |
|
1219 |
* This hooks allows to alter the links at the top of the view edit form. |
|
1220 |
* |
|
1221 |
* Some modules might want to add links there. |
|
1126 | 1222 |
* |
1127 |
* @param $links |
|
1223 |
* @param array $links
|
|
1128 | 1224 |
* An array of links which will be displayed at the top of the view edit form. |
1129 | 1225 |
* Each entry should be on a form suitable for theme('link'). |
1130 |
* @param view $view
|
|
1226 |
* @param object $view
|
|
1131 | 1227 |
* The full view object which is currently edited. |
1132 |
* @param $display_id |
|
1228 |
* @param string $display_id
|
|
1133 | 1229 |
* The current display id which is edited. For example that's 'default' or |
1134 | 1230 |
* 'page_1'. |
1135 | 1231 |
*/ |
... | ... | |
1141 | 1237 |
} |
1142 | 1238 |
|
1143 | 1239 |
/** |
1144 |
* This hook allows to alter the commands which are used on a views ajax |
|
1145 |
* request. |
|
1240 |
* Allows altering the commands which are used on a views AJAX request. |
|
1146 | 1241 |
* |
1147 |
* @param $commands |
|
1148 |
* An array of ajax commands |
|
1149 |
* @param $view view
|
|
1242 |
* @param array $commands
|
|
1243 |
* An array of ajax commands.
|
|
1244 |
* @param object $view
|
|
1150 | 1245 |
* The view which is requested. |
1151 | 1246 |
*/ |
1152 | 1247 |
function hook_views_ajax_data_alter(&$commands, $view) { |
Formats disponibles : Unified diff
Weekly update of contrib modules