title: how to change the default settings for cactiveform, chtml, and other widgets/components in Yii
body: <p>I like to globally change default settings for 'CWidgets' like 'CActiveForm', 'CHtml', etc for use with bootstrap or other css frameworks. For this I am using the 'WidgetFactory' in main.php.</p>
  
  <p>Here is my main.php file</p>
  
  <p>main.php</p>
  
  <pre><code>'widgetFactory'=&gt;array(
  'widgets'=&gt;array(
  
      // &lt;form&gt;&lt;/form&gt;
      'CActiveForm' =&gt; array(
  
          // the CSS class name for error messages. (CHtml::$errorMessageCss)
          'errorMessageCssClass'=&gt;'errorMessage help-block',
  
          // Please note: When you enable ajax validation, make sure the corresponding
          // controller action is handling ajax validation correctly.
          // There is a call to performAjaxValidation() commented in generated controller code.
          // See class documentation of CActiveForm for details on this.
          'enableAjaxValidation'=&gt;false,
          'enableClientValidation' =&gt; false,
  
          'htmlOptions'=&gt;array(
          ),
      ),
  ),
  ),
  </code></pre>
  
  <p>This works and both the classes 'errorMessage' and 'help-block' are 
  added to all single error messages in the form when doing</p>
  
  <pre><code>&lt;?php echo $form-&gt;error($model,'username'); ?&gt;
  </code></pre>
  
  <p>would render </p>
  
  <pre><code>&lt;div class="errorMessage help-block" id="Tbltask_username_em_"&gt;Username cannot be empty
  &lt;/div&gt;
  </code></pre>
  
  <p>'errorMessageCssClass' from 'CActiveForm' is a 'Public Property'. </p>
  
  <p>But now I want to change the 'errorSummary' from 'CActiveForm' which is a 'Public Method'. I want to add the classes 'alert' and 'alert-danger'.</p>
  
  <pre><code>&lt;?php echo $form-&gt;errorSummary($model); ?&gt;
  </code></pre>
  
  <p>which would normally  render</p>
  
  <pre><code>&lt;div class="errorSummary" id="tbltask-form_es_"&gt;
  &lt;ul&gt;
      &lt;li&gt;Username cannot be empty.&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How to do this? adding it to 'CActiveForm' in the 'WidgetFactory' does not work</p>
  
  <pre><code>// &lt;form&gt;&lt;/form&gt;
  'CActiveForm' =&gt; array(
  
          // 'Public Property' SUCCESS :) CHtml::$errorMessageCss
          'errorMessageCssClass'=&gt;'errorMessage help-block',
  
          // 'Public Method' FAIL :( CHtml::errorSummary
          'errorSummary'=&gt;'errorSummary alert alert-danger',
  ),
  </code></pre>
  
  <p>Can someone explain to me the difference between 'Public Properties' and 'Public Methods' and how do setup default settings for 'Public Methods'? like the errorSummary from 'CActiveForm'?</p>
  
  <p>I noticed all message come from 'CHtml'. How can you change the default 'CHtml' settings in main.php? adding it to the 'widgetFactory' does not work (or does it?)</p>