title: CakePhp 3 - How to extend an helper
body: <p>in CakePhp 2.x I was able to extend a core helper with my own class and use it in view files.</p>
  
  <p>In CakePhp 3.8 I want to extends FormHelper, for example to change some default properties.
  I've tried this:</p>
  
  <pre><code>class MyFormHelper extends FormHelper
  {
    public function control($fieldName, array $options = [])
    {
      $options += [
            'label' =&gt; false,
            'class' =&gt; 'form-control'
      ];
  
      return parent::control($fieldName, $options);
    }
  }
  </code></pre>
  
  <p>and my options are correctly taken but many other original behavior does not works anymore.
  For example CakePhp doesn't recognize the fields type (boolean type fields are shown as text inputs and not checkboxes) and doesn't insert the value of field inside a edit form.</p>
  
  <p>Do you know why?</p>
  
  <p>I've also tried calling parent method in this way without success:</p>
  
  <pre><code>[...]
  // return parent::control($fieldName, $options);
  return $this-&gt;__xformCallParent(array($this, 'parent::control'), func_get_args());
  [...]
  private function __xformCallParent($call, $args)
  {
      if (PHP_VERSION &gt;= 5.3 &amp;&amp; is_array($call)) {
          $call = $call[1];
      }
      return call_user_func_array($call, $args);
  }
  </code></pre>