Convert CCK allowed value machine name to human-readable
language: Drupal 6.x
Mon, 12/05/2011 - 19:46 — trevor
Convert CCK allowed value machine name to human-readable
When querying the database directly for CCK data, it's not uncommon to get the machine name values of a CCK field where you've specified a pipe-split pair of machine|human readable values. If you want to output this data, you'll need to be able to pull that human readable value from the machine name. There may be a better way, but CCK provides a few functions that should help:
//for a|Option A $machine_name = 'a';//this came from a query $field = content_fields("field_your_field"); $allowed = content_allowed_values($field); $human_readable = $allowed[$machine_name];

Comments
Good!
Still CCK is quite helpful in retrieving the needed data from the system.
watch winder