Have you seen our video tutorials? Check 'em out!

How/Can I override a field type in a different stream?

daviesgeek - 1 month ago

I am trying to change the field type in a different stream namespace. Is this possible and if so, how can I do this?

Use case: I'm trying to use the forum module, but I'd like to change the posts to a WYSIWYG field instead of just a text box. I'd prefer not to have to fork it, but rather just create a migration that'll change it.

Answer

ryanthompson - 3 weeks ago

Check out the video on migrations: http://pyrocms.com/videos/series/module-development/module-migrations

You will wanna use the repository methods.

1.) Delete the field 2.) Create the field 3.) Assign the field (hint, you'll need the stream)

ryanthompson - 4 weeks ago

As of right this moment changing is not supported - but you can delete the field - then create / assign your own with the same name.

Good thought on that btw - I like that idea.

daviesgeek - 4 weeks ago

@ryanthompson Thanks! What would be the best way to delete the field in a migration so it can be easily migrated and then rolled back?

ryanthompson - 3 weeks ago

Check out the video on migrations: http://pyrocms.com/videos/series/module-development/module-migrations

You will wanna use the repository methods.

1.) Delete the field 2.) Create the field 3.) Assign the field (hint, you'll need the stream)