Answers.Body: <p>Defining your a plugin with it's own field type that extends RichTextFieldType might work (haven't tested), but your current code is slightly off.</p>
  
  <p>The field type class/file name needs to be <a href="http://buildwithcraft.com/docs/plugins/field-types" rel="nofollow">PluginHandle_FieldTypeNameFieldType</a> before Craft will even recognize it.</p>
  
  <p>Also, the <code>ColumnType</code> enum uses <code>MediumText</code>, not <code>Mediumtext</code>.</p>
  
  <p>Really, what we should probably do is make this a setting on the field type because it does pop up every so often and there currently isn't a clean answer.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-26T16:17:08.493Z
Answers.Text: Thanks for noticing the pluginHandle issue. This helps, but the field silently fails when trying to render the 'Edit Entry' page. And getting a weird garnish error when switching to entry type with this field 'Double-instantiating a transparent text input on an element.' +1 for adding as setting.
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-26T16:18:38.653Z
Answers.Text: Yeah, I thought there might be some JavaScript coupled to the RTE class. I'll see what we can do about a setting.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-28T01:31:06.867Z
Answers.Text: In the meantime, do you think it would be safe to change the column type in the database directly. Any reason that would ever get overwritten by craft? Doesn't matter now while in dev, but would be pretty disastrous once the site gets populated.
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-28T02:15:21.160Z
Answers.Text: As far as hacking the db schema goes, it's probably a relatively safe change. But if some update comes down the road, breaks it and you email support, we're just going to tell you that you shouldn't have hacked the schema. ;) Probably worth doing a test locally to make sure there are places in the code we're not assuming a ColumnType::Text, too.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-26T03:00:36.447Z
Answers.LastActivityDate: 2014-10-26T03:00:36.447Z
Answers.UserDisplayName: Brad Bell
Body: <p>Some articles are very long and getting cut off when saved to the database. </p>
  
  <p>Is it possible to define a 'richtext' fieldtype as 'MEDIUMTEXT', or would I have to write a plugin to replicate the 'richtext' fieldtype with a different field attribute defined in <code>defineContentAttribute</code>? Any other considerations to take into account? Such as search, indexing, redactor or otherwise?</p>
  
  <p>Part 2 of this question would be: what is the simplest way to duplicate the RichTextField in a plugin? Can I just extend 'RichTextFieldType' and redefine <code>getName</code> and <code>defineContentAttribute</code>? I tried the following with no luck. </p>
  
  <p><strong>Update:</strong> This creates a 'Rich Text (Medium)' field with the correct DB column type of 'MEDIUMTEXT', but causes the 'Edit Entry' screen in the CP to be blank below the entry title (silent fail?); and if switching to entry type with this field getting a garnish error 'Double-instantiating a transparent text input on an element'.</p>
  
  <pre><code>class LongTextFields_MediumRichTextFieldType extends RichTextFieldType
  {
      public function getName()
      {
          return Craft::t('Rich Text (Medium)');
      }
      public function defineContentAttribute()
      {
          return array(AttributeType::String, 'column' =&gt; ColumnType::MediumText);
      }
  }
  </code></pre>
  
  <p>Another option might be to just redefine the columntype manually in the database. Is there any chance this value will ever get overwritten? (i.e. upgrades, migrations, etc).</p>
  
Tags: <database><field><custom-fieldtype>
Title: Is it possible to define a 'richtext' fieldtype as 'MEDIUMTEXT' in DB?
ThreadText: # Is it possible to define a 'richtext' fieldtype as 'MEDIUMTEXT' in DB?
  
  (Asked by: username_0 on 2014-10-25)
  
  Some articles are very long and getting cut off when saved to the database.
  
  Is it possible to define a 'richtext' fieldtype as 'MEDIUMTEXT', or would I have to write a plugin to replicate the 'richtext' fieldtype with a different field attribute defined in `defineContentAttribute`? Any other considerations to take into account? Such as search, indexing, redactor or otherwise?
  
  Part 2 of this question would be: what is the simplest way to duplicate the RichTextField in a plugin? Can I just extend 'RichTextFieldType' and redefine `getName` and `defineContentAttribute`? I tried the following with no luck.
  
  **Update:** This creates a 'Rich Text (Medium)' field with the correct DB column type of 'MEDIUMTEXT', but causes the 'Edit Entry' screen in the CP to be blank below the entry title (silent fail?); and if switching to entry type with this field getting a garnish error 'Double-instantiating a transparent text input on an element'.
  
  ```
  class LongTextFields_MediumRichTextFieldType extends RichTextFieldType
  {
      public function getName()
      {
          return Craft::t('Rich Text (Medium)');
      }
      public function defineContentAttribute()
      {
          return array(AttributeType::String, 'column' => ColumnType::MediumText);
      }
  }
  
  ```
  
  Another option might be to just redefine the columntype manually in the database. Is there any chance this value will ever get overwritten? (i.e. upgrades, migrations, etc).
  
  **Tags:** database, field, custom-fieldtype
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-10-26. Score: 1 | Accepted answer
  
  Defining your a plugin with it's own field type that extends RichTextFieldType might work (haven't tested), but your current code is slightly off.
  
  The field type class/file name needs to be [PluginHandle\_FieldTypeNameFieldType](http://buildwithcraft.com/docs/plugins/field-types) before Craft will even recognize it.
  
  Also, the `ColumnType` enum uses `MediumText`, not `Mediumtext`.
  
  Really, what we should probably do is make this a setting on the field type because it does pop up every so often and there currently isn't a clean answer.
  
  > **Comments:**
  > **username_0**: Thanks for noticing the pluginHandle issue. This helps, but the field silently fails when trying to render the 'Edit Entry' page. And getting a weird garnish error when switching to entry type with this field 'Double-instantiating a transparent text input on an element.' +1 for adding as setting.  
  > **username_1**: Yeah, I thought there might be some JavaScript coupled to the RTE class. I'll see what we can do about a setting.  
  > **username_0**: In the meantime, do you think it would be safe to change the column type in the database directly. Any reason that would ever get overwritten by craft? Doesn't matter now while in dev, but would be pretty disastrous once the site gets populated.  
  > **username_1**: As far as hacking the db schema goes, it's probably a relatively safe change. But if some update comes down the road, breaks it and you email support, we're just going to tell you that you shouldn't have hacked the schema. ;) Probably worth doing a test locally to make sure there are places in the code we're not assuming a ColumnType::Text, too.  
  
  ---
  
  