views_query_views_alter(AlterableInterface $query)
Implements hook_query_TAG_alter().
This is the hook_query_alter() for queries tagged by Views and is used to add in substitutions from hook_views_query_substitutions().
File
- core/modules/views/views.module, line 655
- Primarily Drupal hooks and global API functions to manipulate views.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | function views_query_views_alter(AlterableInterface $query ) { $substitutions = $query ->getMetaData( 'views_substitutions' ); $tables = & $query ->getTables(); $where = & $query ->conditions(); // Replaces substitutions in tables. foreach ( $tables as $table_name => $table_metadata ) { foreach ( $table_metadata [ 'arguments' ] as $replacement_key => $value ) { if (isset( $substitutions [ $value ])) { $tables [ $table_name ][ 'arguments' ][ $replacement_key ] = $substitutions [ $value ]; } } } // Replaces substitutions in filter criteria. _views_query_tag_alter_condition( $query , $where , $substitutions ); } |
Please login to continue.