public ViewsData::fetchBaseTables()
Fetches a list of all base tables available.
Return value
array An array of base table data keyed by table name. Each item contains the following keys:
- title: The title label for the base table.
- help: The help text for the base table.
- weight: The weight of the base table.
File
- core/modules/views/src/ViewsData.php, line 299
Class
- ViewsData
- Class to manage and lazy load cached views data.
Namespace
Drupal\views
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | public function fetchBaseTables() { $tables = array (); foreach ( $this ->get() as $table => $info ) { if (! empty ( $info [ 'table' ][ 'base' ])) { $tables [ $table ] = array ( 'title' => $info [ 'table' ][ 'base' ][ 'title' ], 'help' => ! empty ( $info [ 'table' ][ 'base' ][ 'help' ]) ? $info [ 'table' ][ 'base' ][ 'help' ] : '' , 'weight' => ! empty ( $info [ 'table' ][ 'base' ][ 'weight' ]) ? $info [ 'table' ][ 'base' ][ 'weight' ] : 0, ); } } // Sorts by the 'weight' and then by 'title' element. uasort( $tables , function ( $a , $b ) { if ( $a [ 'weight' ] != $b [ 'weight' ]) { return $a [ 'weight' ] < $b [ 'weight' ] ? -1 : 1; } if ( $a [ 'title' ] != $b [ 'title' ]) { return $a [ 'title' ] < $b [ 'title' ] ? -1 : 1; } return 0; }); return $tables ; } |
Please login to continue.