Adding more "Forms" to Page Types?

Permalink
I'm rebuilding a demo site of mine in c5.7 and have just created a new page type called "News". As most of the news posted on the site has an attachment, I thought it'd be a good idea to add a file selection box to the composer so when a user creates a new News page, they can instantly pick a file from the manager, instead of having to drag out a File block and set it up that way.

Only problem is, I can only see HTML, Content, Image and Image Slider in the "Edit Form" section of Pages & Themes in the dashboard. How do I go about adding or coding in support for Files or in fact, any other type of content I wish to have in there?

Grayda
View Replies:
andrew replied on at Permalink Reply
andrew
I think it's really just a a question of time and picking blocks that make sense in composer mode. Ideally, all block types would support composer form mode – we just need to add it.

That said, file is an obvious choice and should definitely be something we support. Good idea.
bashton replied on at Permalink Reply
Does that mean there is no way to add custom blocks to the Composer Form?
andrew replied on at Permalink Reply
andrew
No, there is – you just have to make sure that a composer.php file lives in a custom block's directory. A tutorial on how to create this view is coming soon. It's basically a combined add/edit form for the block that will be shown in composer view.
bashton replied on at Permalink Reply
Excellent.
bashton replied on at Permalink Reply
Hi Andrew,

I seem to be having an issue adding a custom block (from a package) to the composer form even thought I have set up a composer.php file within the block.

From what I can tell from looking under the hood the function getPageTypeComposerControlObjects within the blockType.php file seems to be only looking for the composer.php file within the application/blocks and the concrete/blocks directory however not the packages folder.

Am I missing something?
andrew replied on at Permalink Reply
andrew
Yeah, taking a look at the code I wonder if adding this:

$cmf = $env->getRecord(DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . '/' . FILENAME_BLOCK_COMPOSER, $bt->getPackageHandle());


to that code would fix the problem.
bashton replied on at Permalink Reply
Thanks very much.
andrew replied on at Permalink Reply
andrew
Glad that helped – we'll include it in the core.