You are here

function uc_attribute_type_info in Ubercart 8.4

Same name and namespace in other branches
  1. 6.2 uc_attribute/uc_attribute.module \uc_attribute_type_info()
  2. 7.3 uc_attribute/uc_attribute.module \uc_attribute_type_info()

Returns a list of names to abstract queries between products and classes.

Parameters

string $type: The type of attribute: 'product' or 'class'. Any other type will fetch a base attribute.

Return value

array Array of information helpful for creating SQL queries dealing with attributes.

10 calls to uc_attribute_type_info()
AttributeTest::attributeFieldsToTest in uc_attribute/tests/src/Functional/AttributeTest.php
Returns an array of available fields for product or class attributes.
AttributeTest::attributeOptionFieldsToTest in uc_attribute/tests/src/Functional/AttributeTest.php
Returns array of available fields for product or class attribute options.
uc_attribute_load in uc_attribute/uc_attribute.module
Loads an attribute from the database.
uc_attribute_load_multiple in uc_attribute/uc_attribute.module
Loads attribute objects from the database.
uc_attribute_subject_delete in uc_attribute/uc_attribute.module
Deletes an attribute and all options associated with it.

... See full list

File

uc_attribute/uc_attribute.module, line 1019
Ubercart Attribute module.

Code

function uc_attribute_type_info($type) {
  switch ($type) {
    case 'product':
      return [
        'attr_table' => 'uc_product_attributes',
        'opt_table' => 'uc_product_options',
        'id' => 'nid',
      ];
    case 'class':
      return [
        'attr_table' => 'uc_class_attributes',
        'opt_table' => 'uc_class_attribute_options',
        'id' => 'pcid',
      ];
  }
}