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?
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?
Does that mean there is no way to add custom blocks to the Composer Form?
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.
Excellent.
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?
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?
Yeah, taking a look at the code I wonder if adding this:
to that code would fix the problem.
$cmf = $env->getRecord(DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . '/' . FILENAME_BLOCK_COMPOSER, $bt->getPackageHandle());
to that code would fix the problem.
Thanks very much.
Glad that helped – we'll include it in the core.
That said, file is an obvious choice and should definitely be something we support. Good idea.