original_string: public function fieldset($fields = '', array $options = [])
      {
          $fieldset = $legend = true;
          $context = $this->_getContext();
          $out = $fields;
  
          if (isset($options['legend'])) {
              $legend = $options['legend'];
          }
          if (isset($options['fieldset'])) {
              $fieldset = $options['fieldset'];
          }
  
          if ($legend === true) {
              $isCreate = $context->isCreate();
              $modelName = Inflector::humanize(Inflector::singularize($this->_View->getRequest()->getParam('controller')));
              if (!$isCreate) {
                  $legend = __d('cake', 'Edit {0}', $modelName);
              } else {
                  $legend = __d('cake', 'New {0}', $modelName);
              }
          }
  
          if ($fieldset !== false) {
              if ($legend) {
                  $out = $this->formatTemplate('legend', ['text' => $legend]) . $out;
              }
  
              $fieldsetParams = ['content' => $out, 'attrs' => ''];
              if (is_array($fieldset) && !empty($fieldset)) {
                  $fieldsetParams['attrs'] = $this->templater()->formatAttributes($fieldset);
              }
              $out = $this->formatTemplate('fieldset', $fieldsetParams);
          }
  
          return $out;
      }
code: public function fieldset($fields = '', array $options = [])
      {
          $fieldset = $legend = true;
          $context = $this->_getContext();
          $out = $fields;
  
          if (isset($options['legend'])) {
              $legend = $options['legend'];
          }
          if (isset($options['fieldset'])) {
              $fieldset = $options['fieldset'];
          }
  
          if ($legend === true) {
              $isCreate = $context->isCreate();
              $modelName = Inflector::humanize(Inflector::singularize($this->_View->getRequest()->getParam('controller')));
              if (!$isCreate) {
                  $legend = __d('cake', 'Edit {0}', $modelName);
              } else {
                  $legend = __d('cake', 'New {0}', $modelName);
              }
          }
  
          if ($fieldset !== false) {
              if ($legend) {
                  $out = $this->formatTemplate('legend', ['text' => $legend]) . $out;
              }
  
              $fieldsetParams = ['content' => $out, 'attrs' => ''];
              if (is_array($fieldset) && !empty($fieldset)) {
                  $fieldsetParams['attrs'] = $this->templater()->formatAttributes($fieldset);
              }
              $out = $this->formatTemplate('fieldset', $fieldsetParams);
          }
  
          return $out;
      }
code_tokens: public function fieldset ( $ fields = '' , array $ options = [ ] ) { $ fieldset = $ legend = true ; $ context = $ this -> _getContext ( ) ; $ out = $ fields ; if ( isset ( $ options [ 'legend' ] ) ) { $ legend = $ options [ 'legend' ] ; } if ( isset ( $ options [ 'fieldset' ] ) ) { $ fieldset = $ options [ 'fieldset' ] ; } if ( $ legend === true ) { $ isCreate = $ context -> isCreate ( ) ; $ modelName = Inflector :: humanize ( Inflector :: singularize ( $ this -> _View -> getRequest ( ) -> getParam ( 'controller' ) ) ) ; if ( ! $ isCreate ) { $ legend = __d ( 'cake' , 'Edit {0}' , $ modelName ) ; } else { $ legend = __d ( 'cake' , 'New {0}' , $ modelName ) ; } } if ( $ fieldset !== false ) { if ( $ legend ) { $ out = $ this -> formatTemplate ( 'legend' , [ 'text' => $ legend ] ) . $ out ; } $ fieldsetParams = [ 'content' => $ out , 'attrs' => '' ] ; if ( is_array ( $ fieldset ) && ! empty ( $ fieldset ) ) { $ fieldsetParams [ 'attrs' ] = $ this -> templater ( ) -> formatAttributes ( $ fieldset ) ; } $ out = $ this -> formatTemplate ( 'fieldset' , $ fieldsetParams ) ; } return $ out ; }
docstring: Wrap a set of inputs in a fieldset
  
  @param string $fields the form inputs to wrap in a fieldset
  @param array $options Options array. Valid keys are:
  - `fieldset` Set to false to disable the fieldset. You can also pass an array of params to be
  applied as HTML attributes to the fieldset tag. If you pass an empty array, the fieldset will
  be enabled
  - `legend` Set to false to disable the legend for the generated input set. Or supply a string
  to customize the legend text.
  @return string Completed form inputs.
docstring_tokens: Wrap a set of inputs in a fieldset