uc_product_kit.views.inc in Ubercart 8.4
Views hooks for Ubercart product kits.
File
uc_product_kit/uc_product_kit.views.incView source
<?php
/**
* @file
* Views hooks for Ubercart product kits.
*/
/**
* Implements hook_views_data().
*/
function uc_product_kit_views_data() {
$data['uc_product_kits']['table']['group'] = t('Product kit');
// Explain how to link product kit nodes to back to their parents.
$data['node']['table']['join']['uc_product_kits'] = [
'left_field' => 'vid',
'field' => 'vid',
];
$data['uc_products']['table']['join']['uc_product_kits'] = [
'left_field' => 'vid',
'field' => 'vid',
];
// Relate components to their parent kits.
$data['uc_products']['product_kit'] = [
'group' => t('Product kit'),
'relationship' => [
'title' => t('Parent'),
'help' => t('Relate product kit components to their parent kits.'),
'id' => 'standard',
'base' => 'uc_product_kits',
'base field' => 'product_id',
'relationship field' => 'nid',
'label' => t('kit'),
],
];
// Explain how to link parents back to their components.
$data['uc_product_kit_parents']['table']['join']['node'] = [
'left_field' => 'vid',
'field' => 'vid',
'table' => 'uc_product_kits',
];
// Relate kits to their components.
$data['uc_products']['product_kit_component'] = [
'group' => t('Product kit'),
'relationship' => [
'title' => t('Component'),
'help' => t('Relate product kits to their components. This relationship will create one record for each component of the kit.'),
'id' => 'standard',
'base' => 'node',
'base field' => 'nid',
'relationship table' => 'uc_product_kit_parents',
'relationship field' => 'product_id',
'label' => t('component'),
],
];
$data['uc_product_kits']['mutable'] = [
'title' => t('Mutable'),
'help' => t('A flag indicating whether the contents of the kit can be changed by the customer.'),
'field' => [
'id' => 'boolean',
'click sortable' => TRUE,
],
'filter' => [
'id' => 'boolean',
'type' => 'yes-no',
],
'sort' => [
'id' => 'standard',
],
];
$data['uc_product_kits']['qty'] = [
'title' => t('Quantity'),
'help' => t('The number of this product contained in the kit.'),
'field' => [
'id' => 'numeric',
'click sortable' => TRUE,
],
'filter' => [
'id' => 'numeric',
'allow empty' => TRUE,
],
'argument' => [
'id' => 'numeric',
],
'sort' => [
'id' => 'standard',
],
];
$data['uc_product_kits']['discount'] = [
'title' => t('Discount'),
'help' => t('The adjustment to the price of the product.'),
'field' => [
'id' => 'numeric',
'click sortable' => TRUE,
],
'filter' => [
'id' => 'numeric',
'allow empty' => TRUE,
],
'argument' => [
'id' => 'numeric',
],
'sort' => [
'id' => 'standard',
],
];
$data['uc_product_kits']['ordering'] = [
'title' => t('Weight'),
'help' => 'The weight of this product in relation to other products in the kit.',
'field' => [
'id' => 'numeric',
'click sortable' => TRUE,
],
'filter' => [
'id' => 'numeric',
'allow empty' => TRUE,
],
'argument' => [
'id' => 'numeric',
],
'sort' => [
'id' => 'standard',
],
];
$data['uc_product_kits']['synchronized'] = [
'title' => t('Synchronized'),
'help' => t('A flag indicating that changes to the price of this product will change the total price of the kit. 1 => Yes. 0 => No.'),
'field' => [
'id' => 'boolean',
'click sortable' => TRUE,
],
'filter' => [
'id' => 'boolean',
'type' => 'yes-no',
],
'sort' => [
'id' => 'standard',
],
];
$data['uc_product_kits']['is_kit_item'] = [
'title' => t('Is part of a product kit'),
'help' => t('Check for the fields provided by the Ubercart product_kit module.'),
'group' => t('Node'),
'filter' => [
'handler' => 'uc_product_kit_handler_filter_product_kit_item',
'label' => t('Is part of a product kit'),
],
];
$data['uc_product_kits']['is_kit'] = [
'title' => t('Is a product kit'),
'help' => t('Check for the fields provided by the Ubercart product_kit module.'),
'group' => t('Node'),
'filter' => [
'handler' => 'uc_product_kit_handler_filter_product_kit',
'label' => t('Is a product kit'),
],
];
return $data;
}
Functions
Name![]() |
Description |
---|---|
uc_product_kit_views_data | Implements hook_views_data(). |