You are here

function uc_dropdown_attributes_get_type in Dropdown Attributes 8

Same name and namespace in other branches
  1. 6 uc_dropdown_attributes.module \uc_dropdown_attributes_get_type()
  2. 7 uc_dropdown_attributes.module \uc_dropdown_attributes_get_type()

Retrieve product class from the node ID.

Parameters

int $nid: Node id.

Return value

string The type field from the node object.

9 calls to uc_dropdown_attributes_get_type()
UCDropdownAttributesClassTest::testClassAttributeDependency in src/Tests/UCDropdownAttributesClassTest.php
Test for dropdown attributes in classes.
uc_dropdown_attributes_dependency_type in ./uc_dropdown_attributes.module
Retrieve whether dependencies are defined by node or class.
uc_dropdown_attributes_order_product_alter in ./uc_dropdown_attributes.module
Alter products on oder page in preparation for drop down attributes.
uc_dropdown_attributes_product_alter in ./uc_dropdown_attributes.module
Alter products in preparation for drop down attributes.
_uc_dropdown_attributes_class_build in ./uc_dropdown_attributes.module
Form build for classes.

... See full list

File

./uc_dropdown_attributes.module, line 706
A module for uc_dropdown_attributes.

Code

function uc_dropdown_attributes_get_type($nid) {
  $type = \Drupal::database()
    ->select('node', 'n')
    ->fields('n', array(
    'type',
  ))
    ->condition('n.nid', $nid)
    ->execute()
    ->fetchField();
  return $type;
}