original_string: public function switcher($fieldName, array $options = [])
      {
          $input = parent::checkbox($fieldName, $options);
  
          if ($this->getConfig('materializeCss', false) === false) {
              return $input;
          }
  
          $options += [
              'before' => __d('backend', 'Off'),
              'after'  => __d('backend', 'On')
          ];
  
          $title = (Arr::key('title', $options)) ? $options['title'] : $fieldName;
  
          if (!empty($title)) {
              $title = $this->Html->div('switch-title', $title);
          }
  
          $content = $this->formatTemplate(__FUNCTION__, [
              'input'  => $input,
              'title'  => $title,
              'after'  => $options['after'],
              'before' => $options['before'],
              'lever'  => '<span class="lever"></span>'
          ]);
  
          return $content;
      }
code: public function switcher($fieldName, array $options = [])
      {
          $input = parent::checkbox($fieldName, $options);
  
          if ($this->getConfig('materializeCss', false) === false) {
              return $input;
          }
  
          $options += [
              'before' => __d('backend', 'Off'),
              'after'  => __d('backend', 'On')
          ];
  
          $title = (Arr::key('title', $options)) ? $options['title'] : $fieldName;
  
          if (!empty($title)) {
              $title = $this->Html->div('switch-title', $title);
          }
  
          $content = $this->formatTemplate(__FUNCTION__, [
              'input'  => $input,
              'title'  => $title,
              'after'  => $options['after'],
              'before' => $options['before'],
              'lever'  => '<span class="lever"></span>'
          ]);
  
          return $content;
      }
code_tokens: public function switcher ( $ fieldName , array $ options = [ ] ) { $ input = parent :: checkbox ( $ fieldName , $ options ) ; if ( $ this -> getConfig ( 'materializeCss' , false ) === false ) { return $ input ; } $ options += [ 'before' => __d ( 'backend' , 'Off' ) , 'after' => __d ( 'backend' , 'On' ) ] ; $ title = ( Arr :: key ( 'title' , $ options ) ) ? $ options [ 'title' ] : $ fieldName ; if ( ! empty ( $ title ) ) { $ title = $ this -> Html -> div ( 'switch-title' , $ title ) ; } $ content = $ this -> formatTemplate ( __FUNCTION__ , [ 'input' => $ input , 'title' => $ title , 'after' => $ options [ 'after' ] , 'before' => $ options [ 'before' ] , 'lever' => '<span class="lever"></span>' ] ) ; return $ content ; }
docstring: Form switcher.
  
  @param   string $fieldName
  @param   array $options
  @return  string
docstring_tokens: Form switcher .