original_string: protected function _renderInput($checkbox, $context)
      {
          $input = $this->_templates->format('checkbox', [
              'name' => $checkbox['name'] . '[]',
              'value' => $checkbox['escape'] ? h($checkbox['value']) : $checkbox['value'],
              'templateVars' => $checkbox['templateVars'],
              'attrs' => $this->_templates->formatAttributes(
                  $checkbox,
                  ['name', 'value', 'text', 'options', 'label', 'val', 'type']
              )
          ]);
  
          if ($checkbox['label'] === false && strpos($this->_templates->get('checkboxWrapper'), '{{input}}') === false) {
              $label = $input;
          } else {
              $labelAttrs = is_array($checkbox['label']) ? $checkbox['label'] : [];
              $labelAttrs += [
                  'for' => $checkbox['id'],
                  'escape' => $checkbox['escape'],
                  'text' => $checkbox['text'],
                  'templateVars' => $checkbox['templateVars'],
                  'input' => $input
              ];
  
              if ($checkbox['checked']) {
                  $labelAttrs = $this->_templates->addClass($labelAttrs, 'selected');
              }
  
              $label = $this->_label->render($labelAttrs, $context);
          }
  
          return $this->_templates->format('checkboxWrapper', [
              'templateVars' => $checkbox['templateVars'],
              'label' => $label,
              'input' => $input
          ]);
      }
code: protected function _renderInput($checkbox, $context)
      {
          $input = $this->_templates->format('checkbox', [
              'name' => $checkbox['name'] . '[]',
              'value' => $checkbox['escape'] ? h($checkbox['value']) : $checkbox['value'],
              'templateVars' => $checkbox['templateVars'],
              'attrs' => $this->_templates->formatAttributes(
                  $checkbox,
                  ['name', 'value', 'text', 'options', 'label', 'val', 'type']
              )
          ]);
  
          if ($checkbox['label'] === false && strpos($this->_templates->get('checkboxWrapper'), '{{input}}') === false) {
              $label = $input;
          } else {
              $labelAttrs = is_array($checkbox['label']) ? $checkbox['label'] : [];
              $labelAttrs += [
                  'for' => $checkbox['id'],
                  'escape' => $checkbox['escape'],
                  'text' => $checkbox['text'],
                  'templateVars' => $checkbox['templateVars'],
                  'input' => $input
              ];
  
              if ($checkbox['checked']) {
                  $labelAttrs = $this->_templates->addClass($labelAttrs, 'selected');
              }
  
              $label = $this->_label->render($labelAttrs, $context);
          }
  
          return $this->_templates->format('checkboxWrapper', [
              'templateVars' => $checkbox['templateVars'],
              'label' => $label,
              'input' => $input
          ]);
      }
code_tokens: protected function _renderInput ( $ checkbox , $ context ) { $ input = $ this -> _templates -> format ( 'checkbox' , [ 'name' => $ checkbox [ 'name' ] . '[]' , 'value' => $ checkbox [ 'escape' ] ? h ( $ checkbox [ 'value' ] ) : $ checkbox [ 'value' ] , 'templateVars' => $ checkbox [ 'templateVars' ] , 'attrs' => $ this -> _templates -> formatAttributes ( $ checkbox , [ 'name' , 'value' , 'text' , 'options' , 'label' , 'val' , 'type' ] ) ] ) ; if ( $ checkbox [ 'label' ] === false && strpos ( $ this -> _templates -> get ( 'checkboxWrapper' ) , '{{input}}' ) === false ) { $ label = $ input ; } else { $ labelAttrs = is_array ( $ checkbox [ 'label' ] ) ? $ checkbox [ 'label' ] : [ ] ; $ labelAttrs += [ 'for' => $ checkbox [ 'id' ] , 'escape' => $ checkbox [ 'escape' ] , 'text' => $ checkbox [ 'text' ] , 'templateVars' => $ checkbox [ 'templateVars' ] , 'input' => $ input ] ; if ( $ checkbox [ 'checked' ] ) { $ labelAttrs = $ this -> _templates -> addClass ( $ labelAttrs , 'selected' ) ; } $ label = $ this -> _label -> render ( $ labelAttrs , $ context ) ; } return $ this -> _templates -> format ( 'checkboxWrapper' , [ 'templateVars' => $ checkbox [ 'templateVars' ] , 'label' => $ label , 'input' => $ input ] ) ; }
docstring: Render a single checkbox & wrapper.
  
  @param array $checkbox An array containing checkbox key/value option pairs
  @param \Cake\View\Form\ContextInterface $context Context object.
  @return string
docstring_tokens: Render a single checkbox & wrapper .