You are here

function uc_dropdown_attributes_nodeapi in Dropdown Attributes 6

Implements hook_nodeapi().

File

./uc_dropdown_attributes.module, line 426
Show/hide attributes based on the values of other attributes.

Code

function uc_dropdown_attributes_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'load':
      if (isset($node->attributes)) {
        foreach ($node->attributes as $aid => $attribute) {
          $sql = 'SELECT required FROM {uc_dropdown_attributes}
            WHERE nid=%d AND aid=%d';
          $required = db_result(db_query($sql, $node->nid, $aid));
          if ($required) {
            $node->attributes[$aid]->default_option = '';
          }
        }
      }
      break;
  }
}