function uc_stock_views_tables in Ubercart 5
Implementation of hook_views_tables().
File
- uc_stock/
uc_stock.module, line 424
Code
function uc_stock_views_tables() {
$tables['uc_product_stock'] = array(
'name' => 'uc_product_stock',
'join' => array(
'left' => array(
'table' => 'node',
'field' => 'nid',
),
'right' => array(
'field' => 'nid',
),
),
'fields' => array(
'sku' => array(
'name' => t('Stock: SKU'),
'help' => t('The model or SKU of the stock level'),
'sortable' => TRUE,
),
'active' => array(
'name' => t('Stock: Active'),
'help' => t('Whether or not the stock level is currently being tracked'),
'handler' => 'uc_stock_views_handler_active',
'sortable' => TRUE,
),
'stock' => array(
'name' => t('Stock: Stock Level'),
'help' => t('The current stock level'),
'sortable' => TRUE,
),
'threshold' => array(
'name' => t('Stock: Threshold'),
'help' => t('The threshold or warning limit of the stock level'),
'sortable' => TRUE,
),
),
'sorts' => array(
'sku' => array(
'name' => t('Stock: SKU'),
),
'stock' => array(
'name' => t('Stock: Stock Level'),
'help' => t('The current stock level'),
),
'threshold' => array(
'name' => t('Stock: Threshold'),
'help' => t('The threshold or warning limit of the stock level'),
),
),
'filters' => array(
'sku' => array(
'name' => 'Stock: SKU',
'operator' => 'views_handler_operator_like',
'handler' => 'views_handler_filter_like',
'help' => t('Filter the node based on stock SKU.'),
),
'stock' => array(
'name' => 'Stock: Stock Level',
'operator' => 'views_handler_operator_gtlt',
'help' => t('Filter the node based on stock level.'),
),
'threshold' => array(
'name' => 'Stock: Threshold',
'operator' => 'views_handler_operator_gtlt',
'help' => t('Filter the node based on threshold level.'),
),
'is_active' => array(
'name' => 'Stock: Is Active',
'operator' => array(
'=' => 'Equals',
),
'list' => 'views_handler_operator_yesno',
'list-type' => 'select',
'handler' => 'uc_stock_views_handler_filter_is_active',
'help' => t('Filter the data based on whether or not stock tracking is active for the SKU.'),
),
'below_threshold' => array(
'name' => 'Stock: Is Below Threshold',
'operator' => array(
'=' => 'Equals',
),
'list' => 'views_handler_operator_yesno',
'list-type' => 'select',
'handler' => 'uc_stock_views_handler_filter_below_threshold',
'help' => t('Filter the node based on whether it stock level is below the threshold for the SKU.'),
),
),
);
return $tables;
}