original_string: public function generateRadioField($attr)
      {
          if (empty($attr['name'])) {
              return '';
          }
  
          $out = '';
  
          $options = array();
          if (! empty($attr['options'])) {
              $options = $attr['options'];
          }
  
          if (isset($attr['checked'])) {
              $checkedItem = $attr['checked'];
          }
  
          unset($attr['options'], $attr['checked']);
  
          foreach ($options as $value => $label) {
              $id = $attr['id'] . '_' . $value;
  
              $optionsAttr = array('id' => $id, 'value' => $value);
              if (isset($checkedItem) && $checkedItem == $value) {
                  $optionsAttr[] = 'checked';
              }
              $input = $this->Html->tag(
                  'input',
                  array_merge(
                      $attr,
                      $optionsAttr
                  )
              );
  
              $label = $this->Html->tag(
                  'label',
                  array('for' => $id),
                  $label,
                  true
              );
  
              $out .= $this->Html->tag(
                  'div',
                  array(
                      'class' => 'radio-item'
                  ),
                  $input . $label,
                  true
              );
          }
  
          return $out;
      }
code: public function generateRadioField($attr)
      {
          if (empty($attr['name'])) {
              return '';
          }
  
          $out = '';
  
          $options = array();
          if (! empty($attr['options'])) {
              $options = $attr['options'];
          }
  
          if (isset($attr['checked'])) {
              $checkedItem = $attr['checked'];
          }
  
          unset($attr['options'], $attr['checked']);
  
          foreach ($options as $value => $label) {
              $id = $attr['id'] . '_' . $value;
  
              $optionsAttr = array('id' => $id, 'value' => $value);
              if (isset($checkedItem) && $checkedItem == $value) {
                  $optionsAttr[] = 'checked';
              }
              $input = $this->Html->tag(
                  'input',
                  array_merge(
                      $attr,
                      $optionsAttr
                  )
              );
  
              $label = $this->Html->tag(
                  'label',
                  array('for' => $id),
                  $label,
                  true
              );
  
              $out .= $this->Html->tag(
                  'div',
                  array(
                      'class' => 'radio-item'
                  ),
                  $input . $label,
                  true
              );
          }
  
          return $out;
      }
code_tokens: public function generateRadioField ( $ attr ) { if ( empty ( $ attr [ 'name' ] ) ) { return '' ; } $ out = '' ; $ options = array ( ) ; if ( ! empty ( $ attr [ 'options' ] ) ) { $ options = $ attr [ 'options' ] ; } if ( isset ( $ attr [ 'checked' ] ) ) { $ checkedItem = $ attr [ 'checked' ] ; } unset ( $ attr [ 'options' ] , $ attr [ 'checked' ] ) ; foreach ( $ options as $ value => $ label ) { $ id = $ attr [ 'id' ] . '_' . $ value ; $ optionsAttr = array ( 'id' => $ id , 'value' => $ value ) ; if ( isset ( $ checkedItem ) && $ checkedItem == $ value ) { $ optionsAttr [ ] = 'checked' ; } $ input = $ this -> Html -> tag ( 'input' , array_merge ( $ attr , $ optionsAttr ) ) ; $ label = $ this -> Html -> tag ( 'label' , array ( 'for' => $ id ) , $ label , true ) ; $ out .= $ this -> Html -> tag ( 'div' , array ( 'class' => 'radio-item' ) , $ input . $ label , true ) ; } return $ out ; }
docstring: generate a selection of radio buttons
  
  @param   array   array of attributes
  @return  string
docstring_tokens: generate a selection of radio buttons