drupal_html_id() alternative for non-Ajax content? I am looking for a drupal_html_id() function alternative which returns incremented ID's of non-Ajax contents only.


Is this "ajax/non-ajax" distinction feasible in this context or any other way?
If yes, can anyone provide a solution or recommendation?
Here's a simpler version I came up with by altering drupal_html_id() that doesn't pay attention to the $ajax_html_ids. Also note that it produces dashes instead of hyphens:

function foo_html_id($id) {
  $id = strtr(drupal_strtolower($id), array(' ' =&gt; '_', '_' =&gt; '_', '[' =&gt; '_', ']' =&gt; ''));
  $id = preg_replace('/[^A-Za-z0-9\-_]/', '', $id);
  $id = preg_replace('/\-+/', '_', $id);

  $seen_ids = &amp;drupal_static(__FUNCTION__);

  if (isset($seen_ids[$id])) {
    $id = $id . '_' . ++$seen_ids[$id];
  }
  else {
    $seen_ids[$id] = 1;
  }

  return $id;
}