function uc_termsofservice_get_nid_from_variable in Ubercart Terms of Service 6
Same name and namespace in other branches
- 7 uc_termsofservice.module \uc_termsofservice_get_nid_from_variable()
 
Function that filters the node nid from the autocomplete string.
1 call to uc_termsofservice_get_nid_from_variable()
- uc_termsofservice_get_node in ./
uc_termsofservice.module  - Retrieves the ToS node from database.
 
File
- ./
uc_termsofservice.module, line 211  - Ubercart Terms of Service.
 
Code
function uc_termsofservice_get_nid_from_variable($type = NULL) {
  $nid = 0;
  $tos_node = variable_get('uc_termsofservice_' . $type . '_node', $nid);
  $preg_matches = array();
  $match = preg_match('/\\[nid: (\\d+)\\]/', $tos_node, $preg_matches);
  if ($match) {
    $nid = $preg_matches[1];
  }
  return $nid;
}