What's the best approach to translate zero/one boolean value to yes/no when loading a record

edited November 2014 in Modules
I have a boolean field called remain_anonymous and it returns as either a zero or one value. it's set to displayonly in form_fields within its model, however, I'd like it to translate the values to yes/no. What's the best approach to this? Where do you suggest I translate the values?

function form_fields($values = array())
{
    $fields = parent::form_fields($values);

    $fields['remain_anonymous']['displayonly'] = TRUE;
}

Comments

  • edited November 2014
    Currently, I have the following implementation:

    $CI =& get_instance(); $CI->load->helper('general'); $fields['remain_anonymous'] = array('displayonly' => TRUE, 'pre_process' => 'readable_boolean');
  • edited 11:23AM
    I take it that this pre_process isn't working correctly? Is there a function of readable_boolean that has been created and if so where does it exist and how is it loaded? Also, what are you seeing instead?
  • edited 11:23AM
    Got everything to work, admin!
Sign In or Register to comment.