title: explicitly set "required" in div class using custom FormHelper (cakephp 1.3)
body: <p>I am using cakephp 1.3, and want to set form inputs as "required" explicitly instead of relying on model validation.  A form input example:</p>
  
  <pre><code>&lt;div class="input text required"&gt;
    &lt;label for="ClaimClaimantFirstName"&gt;First Name&lt;/label&gt;
    &lt;input name="data[ClaimClaimant][first_name]" type="text" id="ClaimClaimantFirstName" /&gt; 
  &lt;/div&gt;
  </code></pre>
  
  <p>I also want to maintain the FormHelper naming instead of using custom form helper names.  Example:</p>
  
  <pre><code>$this-&gt;Form-&gt;input(...)
  </code></pre>
  
  <p>The solution I came up with is </p>
  
  <ol>
  <li><p>implement MyFormHelper, extending from FormHelper and overriding the input method.  Specifically, around line 804 of the FormHelper, replacing</p>
  
  <pre><code>if (
    isset($this-&gt;fieldset[$modelKey]) 
    &amp;&amp; in_array($fieldKey, $this-&gt;fieldset[$modelKey]['validates'])
  ) {
    $divOptions = $this-&gt;addClass($divOptions, 'required');
  }
  </code></pre>
  
  <p>with</p>
  
  <pre><code>if (isset($options['required'])) {
    if ($options['required'] === true) {
      $divOptions = $this-&gt;addClass($divOptions, 'required');
    } elseif ($options['required'] === false) {
      // do not add class 'required'
    }
  } elseif (
    isset($this-&gt;fieldset[$modelKey]) 
    &amp;&amp; in_array($fieldKey, $this-&gt;fieldset[$modelKey]['validates'])
  ) {
    $divOptions = $this-&gt;addClass($divOptions, 'required');
  }
  </code></pre>
  
  <p>This ensures the presence of <code>$options['required']</code> takes precedence before we rely on the model validation.</p></li>
  <li><p>use Joe Beeson's <a href="https://github.com/joebeeson/analogue" rel="nofollow">analogue plugin</a>, to alias MyForm to Form:</p>
  
  <pre><code>public $helpers = array(
    'Analogue.Analogue' =&gt; array(
      array(
        'helper' =&gt; 'MyForm',
        'rename' =&gt; 'Form'
  ) ) )
  </code></pre></li>
  <li><p>then, specifying the form input as required looks like:</p>
  
  <pre><code>$this-&gt;Form-&gt;Input(
    'SomeModel.SomeField',
    array('required' =&gt; true)
  )
  </code></pre></li>
  </ol>
  
  <p>Is there some other better approach than this, or potential issues with this solution?</p>