Concrete5.7 modify block - how to add new field to DB
Permalink
I want to modify a Page List block and to add a few more questions (variables) to the add block form. I know how to do that for a package (in the db.xml), but I don't want to deal with the package while modifying the block.
Is there any other Concrete5 simple way to add new fields to the block's database apart from directly using sql methods? For example, if I change the db.xml in the block, will it make changes in the block's DB automatically?
Thank you.
Is there any other Concrete5 simple way to add new fields to the block's database apart from directly using sql methods? For example, if I change the db.xml in the block, will it make changes in the block's DB automatically?
Thank you.
Yes, I know, I'd do all of that if I wanted to make a package out of it. I just want to override the core Page List block. Yes, I've copied it to the application/blocks folder, changed the namespace.
But I found out to change an overridden block db table is quite easy actually. I then added a new field into the block's db.xml, made all necessary changes to the add, edit and save functions in the block's controller and also changed the block add form.
Then simply go to Dashboard -> Stack & Blocks -> Block Types -> Page List -> Refresh and it updated the db schema and added my new field to the db!
BTW, renaming the overridden block's name is a good idea!
But I found out to change an overridden block db table is quite easy actually. I then added a new field into the block's db.xml, made all necessary changes to the add, edit and save functions in the block's controller and also changed the block add form.
Then simply go to Dashboard -> Stack & Blocks -> Block Types -> Page List -> Refresh and it updated the db schema and added my new field to the db!
BTW, renaming the overridden block's name is a good idea!
ah refresh :D
nice
nice
Also I wouldn't recommend modifying a core block.
I would create a copy from the block and rename it
You also will need to change the namespaces
Also you will need to create a package installer for it.
There are quite a few docs on how to do these things available