setDisplayMode() in custom attribute not working

Permalink
Inside my package's install function, I have placed a code that installs custom page attributes. I am also trying to set the default display mode of 'textarea' attribute type to 'rich_text' but it's not working. Can someone figure out what I've done wrong?
public function install() {
  $pkg = parent::install();
  BlockType::installBlockTypeFromPackage('my_package', $pkg);
  $at = AttributeType::getByHandle('textarea');
  $key = CollectionAttributeKey::add($at, array(
        'akHandle' => 'my_handle_name',
        'akName' => t('My Attribute Name'),
        'akIsSearchable' => 1,
        'akIsSearchableIndexed' => 1,
        'akIsEditable' => 0
      ), $pkg);
  TextareaAttributeTypeController::setDisplayMode('rich_text');
}

BlueFractals
 
Mainio replied on at Permalink Reply
Mainio
$key->getController()->setDisplayMode('rich_text');