I'm running into a bit of a wall when it comes to extending the blog post module.
I've successfully added a "Featured Image" field, but I can't add a simple, varchar text field.
Here's my code:
public function subscribeEvents()
{
Backend::$events->addEvent('blog:onExtendPostModel', $this, 'extend_blogpost_model');
Backend::$events->addEvent('blog:onExtendPostForm', $this, 'extend_blogpost_form');
}
public function extend_blogpost_model($post)
{
$post->add_relation('has_many',
'featuredimage',
array('class_name'=>'Db_File',
'foreign_key'=>'master_object_id',
'conditions'=>"master_object_class='Blog_Post' and field='featuredimage'",
'order'=>'sort_order, id',
'delete' => true
)
);
$post->define_multi_relation_column('featuredimage', 'featuredimage', 'Featured Image', '@name');
$post->define_column('featured_link_text', 'Featured Link Text');
}
public function extend_blogpost_form($post)
{
$post->add_form_field('featuredimage')->renderAs(frm_file_attachments)->renderFilesAs('single_image')->addDocumentLabel('Upload photo')->tab('Featured Image')->noAttachmentsLabel('Photo is not uploaded')->imageThumbSize(100)->fileDownloadBaseUrl(url('ls_backend/files/get/'));
$post->add_form_field('featured_link_text')->tab('Featured Image');
}
To match, I've added a mysql update file:
alter table blog_posts add column featured_link_text varchar(255);
What am I missing here? The error I get is that "Render mode is unknown for featured_link_text field." But when I extend the product model, as long as the update file is there, I don't need to specify a render mode for the field.
Thanks!

Help












