<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Fields_View_Helper_FieldSingleCheckbox extends Fields_View_Helper_FieldAbstract
{

  protected $_options = array(
    0 => 'FIELD_SINGLE_CHECKBOX_UNCHECKED',
    1 => 'FIELD_SINGLE_CHECKBOX_CHECKED'
  );

  public function fieldSingleCheckbox($subject, $field, $value)
  {
    if( is_object($value) ) {

      if( $value->field_id != $field->field_id ) {
        return '';
      }
      $value = (int) $value->value;
      $label = $this->view->translate($this->_options[$value]);
      return $this->encloseInLink($subject, $field, $value, $label);
    }
  }

}
