title: How do you modify Category Forms in Joomla?
body: <p>I'm working on creating a small plugin to modify the Category Forms (on the add/edit category view) in Joomla.</p>
  
  <p>I was able to use the <a href="http://docs.joomla.org/Creating_a_profile_plugin" rel="noreferrer">tutorial on Joomla's site</a> to modify the forms on User Profiles, Articles, and Menus; however, Categories do not seem to work properly.</p>
  
  <p>This the code that I am using:</p>
  
  <pre><code>defined('JPATH_BASE') or die;
  
  class plgContentCategoryType extends JPlugin {
  
      function onContentPrepareForm($form, $data) {
  
          // Load plugin language
          $lang = JFactory::getLanguage();
          $lang-&gt;load('plg_content_categorytype', JPATH_ADMINISTRATOR);
  
          if (!($form instanceof JForm)) {
              $this-&gt;_subject-&gt;setError('JERROR_NOT_A_FORM');
              return false;
          }
  
          // Check we are manipulating a valid form.
          if (!in_array($form-&gt;getName(), array('com_categories.category'))) {
              return true;
          }
  
          if ($form-&gt;getName()=='com_categories.category') {      
              // Add the fields to the form.
              JForm::addFormPath(dirname(__FILE__).'/forms');
              $form-&gt;loadFile('categorytype', false);
          }
  
  
      }
  
   }
  </code></pre>
  
  <p>and this is what the form XML looks like:</p>
  
  <pre><code>&lt;form&gt;
      &lt;fields name="params"&gt;
  
          &lt;fieldset name="categorytype" label="PLG_CONTENT_CATEOGRYTYPE_FIELDSET_LABEL"&gt;
  
              &lt;field name="category_type" type="list" label="PLG_CONTENT_CATEGORYTYPE_LABEL" description="PLG_CONTENT_CATEGORYTYPE_DESC"&gt;
                  &lt;option value=""&gt;&lt;/option&gt;
                  &lt;option value="features"&gt;PLG_CONTENT_CATEGORYTYPE_FEATURES&lt;/option&gt;
                  &lt;option value="columns"&gt;PLG_CONTENT_CATEGORYTYPE_COLUMNS&lt;/option&gt;
                  &lt;option value="spotlights"&gt;PLG_CONTENT_CATEGORYTYPE_SPOTLIGHTS&lt;/option&gt;
                  &lt;option value="slices"&gt;PLG_CONTENT_CATEGORYTYPE_SLICES&lt;/option&gt;
                  &lt;option value="news"&gt;PLG_CONTENT_CATEGORYTYPE_NEWS&lt;/option&gt;
              &lt;/field&gt;
  
          &lt;/fieldset&gt;
  
      &lt;/fields&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Any help in what I'm doing wrong would be greatly appreciated! Like I said, it will work on any other type of content, for instance, for it to work on menu's, just have to change the 'name' in the code.</p>
  
  <p>thanks!</p>